Change Packet parameters on Port methods from references to pointers.

--HG--
extra : convert_revision : 7193e70304d4cbe1e4cbe16ce0d8527b2754d066
This commit is contained in:
Steve Reinhardt 2006-05-18 22:32:21 -04:00
parent 381c4f6720
commit 796fa429fe
38 changed files with 528 additions and 528 deletions

View file

@ -78,21 +78,21 @@ AtomicSimpleCPU::init()
} }
bool bool
AtomicSimpleCPU::CpuPort::recvTiming(Packet &pkt) AtomicSimpleCPU::CpuPort::recvTiming(Packet *pkt)
{ {
panic("AtomicSimpleCPU doesn't expect recvAtomic callback!"); panic("AtomicSimpleCPU doesn't expect recvAtomic callback!");
return true; return true;
} }
Tick Tick
AtomicSimpleCPU::CpuPort::recvAtomic(Packet &pkt) AtomicSimpleCPU::CpuPort::recvAtomic(Packet *pkt)
{ {
panic("AtomicSimpleCPU doesn't expect recvAtomic callback!"); panic("AtomicSimpleCPU doesn't expect recvAtomic callback!");
return curTick; return curTick;
} }
void void
AtomicSimpleCPU::CpuPort::recvFunctional(Packet &pkt) AtomicSimpleCPU::CpuPort::recvFunctional(Packet *pkt)
{ {
panic("AtomicSimpleCPU doesn't expect recvFunctional callback!"); panic("AtomicSimpleCPU doesn't expect recvFunctional callback!");
} }
@ -263,7 +263,7 @@ AtomicSimpleCPU::read(Addr addr, T &data, unsigned flags)
data_read_pkt->addr = data_read_req->getPaddr(); data_read_pkt->addr = data_read_req->getPaddr();
data_read_pkt->size = sizeof(T); data_read_pkt->size = sizeof(T);
dcache_complete = dcachePort.sendAtomic(*data_read_pkt); dcache_complete = dcachePort.sendAtomic(data_read_pkt);
dcache_access = true; dcache_access = true;
assert(data_read_pkt->result == Success); assert(data_read_pkt->result == Success);
@ -345,7 +345,7 @@ AtomicSimpleCPU::write(T data, Addr addr, unsigned flags, uint64_t *res)
data_write_pkt->addr = data_write_req->getPaddr(); data_write_pkt->addr = data_write_req->getPaddr();
data_write_pkt->size = sizeof(T); data_write_pkt->size = sizeof(T);
dcache_complete = dcachePort.sendAtomic(*data_write_pkt); dcache_complete = dcachePort.sendAtomic(data_write_pkt);
dcache_access = true; dcache_access = true;
assert(data_write_pkt->result == Success); assert(data_write_pkt->result == Success);
@ -430,7 +430,7 @@ AtomicSimpleCPU::tick()
Fault fault = setupFetchPacket(ifetch_pkt); Fault fault = setupFetchPacket(ifetch_pkt);
if (fault == NoFault) { if (fault == NoFault) {
Tick icache_complete = icachePort.sendAtomic(*ifetch_pkt); Tick icache_complete = icachePort.sendAtomic(ifetch_pkt);
// ifetch_req is initialized to read the instruction directly // ifetch_req is initialized to read the instruction directly
// into the CPU object's inst field. // into the CPU object's inst field.

View file

@ -90,11 +90,11 @@ class AtomicSimpleCPU : public BaseSimpleCPU
protected: protected:
virtual bool recvTiming(Packet &pkt); virtual bool recvTiming(Packet *pkt);
virtual Tick recvAtomic(Packet &pkt); virtual Tick recvAtomic(Packet *pkt);
virtual void recvFunctional(Packet &pkt); virtual void recvFunctional(Packet *pkt);
virtual void recvStatusChange(Status status); virtual void recvStatusChange(Status status);

View file

@ -60,14 +60,14 @@ TimingSimpleCPU::init()
} }
Tick Tick
TimingSimpleCPU::CpuPort::recvAtomic(Packet &pkt) TimingSimpleCPU::CpuPort::recvAtomic(Packet *pkt)
{ {
panic("TimingSimpleCPU doesn't expect recvAtomic callback!"); panic("TimingSimpleCPU doesn't expect recvAtomic callback!");
return curTick; return curTick;
} }
void void
TimingSimpleCPU::CpuPort::recvFunctional(Packet &pkt) TimingSimpleCPU::CpuPort::recvFunctional(Packet *pkt)
{ {
panic("TimingSimpleCPU doesn't expect recvFunctional callback!"); panic("TimingSimpleCPU doesn't expect recvFunctional callback!");
} }
@ -192,7 +192,7 @@ TimingSimpleCPU::read(Addr addr, T &data, unsigned flags)
data_read_pkt->size = sizeof(T); data_read_pkt->size = sizeof(T);
data_read_pkt->dest = Packet::Broadcast; data_read_pkt->dest = Packet::Broadcast;
if (!dcachePort.sendTiming(*data_read_pkt)) { if (!dcachePort.sendTiming(data_read_pkt)) {
_status = DcacheRetry; _status = DcacheRetry;
dcache_pkt = data_read_pkt; dcache_pkt = data_read_pkt;
} else { } else {
@ -274,7 +274,7 @@ TimingSimpleCPU::write(T data, Addr addr, unsigned flags, uint64_t *res)
data_write_pkt->addr = data_write_req->getPaddr(); data_write_pkt->addr = data_write_req->getPaddr();
data_write_pkt->dest = Packet::Broadcast; data_write_pkt->dest = Packet::Broadcast;
if (!dcachePort.sendTiming(*data_write_pkt)) { if (!dcachePort.sendTiming(data_write_pkt)) {
_status = DcacheRetry; _status = DcacheRetry;
dcache_pkt = data_write_pkt; dcache_pkt = data_write_pkt;
} else { } else {
@ -354,7 +354,7 @@ TimingSimpleCPU::fetch()
Fault fault = setupFetchPacket(ifetch_pkt); Fault fault = setupFetchPacket(ifetch_pkt);
if (fault == NoFault) { if (fault == NoFault) {
if (!icachePort.sendTiming(*ifetch_pkt)) { if (!icachePort.sendTiming(ifetch_pkt)) {
// Need to wait for retry // Need to wait for retry
_status = IcacheRetry; _status = IcacheRetry;
} else { } else {
@ -406,7 +406,7 @@ TimingSimpleCPU::completeIfetch()
bool bool
TimingSimpleCPU::IcachePort::recvTiming(Packet &pkt) TimingSimpleCPU::IcachePort::recvTiming(Packet *pkt)
{ {
cpu->completeIfetch(); cpu->completeIfetch();
return true; return true;
@ -442,9 +442,9 @@ TimingSimpleCPU::completeDataAccess(Packet *pkt)
bool bool
TimingSimpleCPU::DcachePort::recvTiming(Packet &pkt) TimingSimpleCPU::DcachePort::recvTiming(Packet *pkt)
{ {
cpu->completeDataAccess(&pkt); cpu->completeDataAccess(pkt);
return true; return true;
} }

View file

@ -77,9 +77,9 @@ class TimingSimpleCPU : public BaseSimpleCPU
protected: protected:
virtual Tick recvAtomic(Packet &pkt); virtual Tick recvAtomic(Packet *pkt);
virtual void recvFunctional(Packet &pkt); virtual void recvFunctional(Packet *pkt);
virtual void recvStatusChange(Status status); virtual void recvStatusChange(Status status);
@ -98,7 +98,7 @@ class TimingSimpleCPU : public BaseSimpleCPU
protected: protected:
virtual bool recvTiming(Packet &pkt); virtual bool recvTiming(Packet *pkt);
virtual Packet *recvRetry(); virtual Packet *recvRetry();
}; };
@ -113,7 +113,7 @@ class TimingSimpleCPU : public BaseSimpleCPU
protected: protected:
virtual bool recvTiming(Packet &pkt); virtual bool recvTiming(Packet *pkt);
virtual Packet *recvRetry(); virtual Packet *recvRetry();
}; };

View file

@ -87,7 +87,7 @@ AlphaConsole::startup()
} }
Tick Tick
AlphaConsole::read(Packet &pkt) AlphaConsole::read(Packet *pkt)
{ {
/** XXX Do we want to push the addr munging to a bus brige or something? So /** XXX Do we want to push the addr munging to a bus brige or something? So
@ -95,109 +95,109 @@ AlphaConsole::read(Packet &pkt)
* machine dependent address swizzle is required? * machine dependent address swizzle is required?
*/ */
assert(pkt.result == Unknown); assert(pkt->result == Unknown);
assert(pkt.addr >= pioAddr && pkt.addr < pioAddr + pioSize); assert(pkt->addr >= pioAddr && pkt->addr < pioAddr + pioSize);
pkt.time += pioDelay; pkt->time += pioDelay;
Addr daddr = pkt.addr - pioAddr; Addr daddr = pkt->addr - pioAddr;
pkt.allocate(); pkt->allocate();
switch (pkt.size) switch (pkt->size)
{ {
case sizeof(uint32_t): case sizeof(uint32_t):
switch (daddr) switch (daddr)
{ {
case offsetof(AlphaAccess, last_offset): case offsetof(AlphaAccess, last_offset):
pkt.set(alphaAccess->last_offset); pkt->set(alphaAccess->last_offset);
break; break;
case offsetof(AlphaAccess, version): case offsetof(AlphaAccess, version):
pkt.set(alphaAccess->version); pkt->set(alphaAccess->version);
break; break;
case offsetof(AlphaAccess, numCPUs): case offsetof(AlphaAccess, numCPUs):
pkt.set(alphaAccess->numCPUs); pkt->set(alphaAccess->numCPUs);
break; break;
case offsetof(AlphaAccess, intrClockFrequency): case offsetof(AlphaAccess, intrClockFrequency):
pkt.set(alphaAccess->intrClockFrequency); pkt->set(alphaAccess->intrClockFrequency);
break; break;
default: default:
/* Old console code read in everyting as a 32bit int /* Old console code read in everyting as a 32bit int
* we now break that for better error checking. * we now break that for better error checking.
*/ */
pkt.result = BadAddress; pkt->result = BadAddress;
} }
DPRINTF(AlphaConsole, "read: offset=%#x val=%#x\n", daddr, DPRINTF(AlphaConsole, "read: offset=%#x val=%#x\n", daddr,
pkt.get<uint32_t>()); pkt->get<uint32_t>());
break; break;
case sizeof(uint64_t): case sizeof(uint64_t):
switch (daddr) switch (daddr)
{ {
case offsetof(AlphaAccess, inputChar): case offsetof(AlphaAccess, inputChar):
pkt.set(console->console_in()); pkt->set(console->console_in());
break; break;
case offsetof(AlphaAccess, cpuClock): case offsetof(AlphaAccess, cpuClock):
pkt.set(alphaAccess->cpuClock); pkt->set(alphaAccess->cpuClock);
break; break;
case offsetof(AlphaAccess, mem_size): case offsetof(AlphaAccess, mem_size):
pkt.set(alphaAccess->mem_size); pkt->set(alphaAccess->mem_size);
break; break;
case offsetof(AlphaAccess, kernStart): case offsetof(AlphaAccess, kernStart):
pkt.set(alphaAccess->kernStart); pkt->set(alphaAccess->kernStart);
break; break;
case offsetof(AlphaAccess, kernEnd): case offsetof(AlphaAccess, kernEnd):
pkt.set(alphaAccess->kernEnd); pkt->set(alphaAccess->kernEnd);
break; break;
case offsetof(AlphaAccess, entryPoint): case offsetof(AlphaAccess, entryPoint):
pkt.set(alphaAccess->entryPoint); pkt->set(alphaAccess->entryPoint);
break; break;
case offsetof(AlphaAccess, diskUnit): case offsetof(AlphaAccess, diskUnit):
pkt.set(alphaAccess->diskUnit); pkt->set(alphaAccess->diskUnit);
break; break;
case offsetof(AlphaAccess, diskCount): case offsetof(AlphaAccess, diskCount):
pkt.set(alphaAccess->diskCount); pkt->set(alphaAccess->diskCount);
break; break;
case offsetof(AlphaAccess, diskPAddr): case offsetof(AlphaAccess, diskPAddr):
pkt.set(alphaAccess->diskPAddr); pkt->set(alphaAccess->diskPAddr);
break; break;
case offsetof(AlphaAccess, diskBlock): case offsetof(AlphaAccess, diskBlock):
pkt.set(alphaAccess->diskBlock); pkt->set(alphaAccess->diskBlock);
break; break;
case offsetof(AlphaAccess, diskOperation): case offsetof(AlphaAccess, diskOperation):
pkt.set(alphaAccess->diskOperation); pkt->set(alphaAccess->diskOperation);
break; break;
case offsetof(AlphaAccess, outputChar): case offsetof(AlphaAccess, outputChar):
pkt.set(alphaAccess->outputChar); pkt->set(alphaAccess->outputChar);
break; break;
default: default:
int cpunum = (daddr - offsetof(AlphaAccess, cpuStack)) / int cpunum = (daddr - offsetof(AlphaAccess, cpuStack)) /
sizeof(alphaAccess->cpuStack[0]); sizeof(alphaAccess->cpuStack[0]);
if (cpunum >= 0 && cpunum < 64) if (cpunum >= 0 && cpunum < 64)
pkt.set(alphaAccess->cpuStack[cpunum]); pkt->set(alphaAccess->cpuStack[cpunum]);
else else
panic("Unknown 64bit access, %#x\n", daddr); panic("Unknown 64bit access, %#x\n", daddr);
} }
DPRINTF(AlphaConsole, "read: offset=%#x val=%#x\n", daddr, DPRINTF(AlphaConsole, "read: offset=%#x val=%#x\n", daddr,
pkt.get<uint64_t>()); pkt->get<uint64_t>());
break; break;
default: default:
pkt.result = BadAddress; pkt->result = BadAddress;
} }
if (pkt.result == Unknown) pkt.result = Success; if (pkt->result == Unknown) pkt->result = Success;
return pioDelay; return pioDelay;
} }
Tick Tick
AlphaConsole::write(Packet &pkt) AlphaConsole::write(Packet *pkt)
{ {
pkt.time += pioDelay; pkt->time += pioDelay;
assert(pkt.result == Unknown); assert(pkt->result == Unknown);
assert(pkt.addr >= pioAddr && pkt.addr < pioAddr + pioSize); assert(pkt->addr >= pioAddr && pkt->addr < pioAddr + pioSize);
Addr daddr = pkt.addr - pioAddr; Addr daddr = pkt->addr - pioAddr;
uint64_t val = pkt.get<uint64_t>(); uint64_t val = pkt->get<uint64_t>();
assert(pkt.size == sizeof(uint64_t)); assert(pkt->size == sizeof(uint64_t));
switch (daddr) { switch (daddr) {
case offsetof(AlphaAccess, diskUnit): case offsetof(AlphaAccess, diskUnit):
@ -240,7 +240,7 @@ AlphaConsole::write(Packet &pkt)
panic("Unknown 64bit access, %#x\n", daddr); panic("Unknown 64bit access, %#x\n", daddr);
} }
pkt.result = Success; pkt->result = Success;
return pioDelay; return pioDelay;
} }

View file

@ -116,8 +116,8 @@ class AlphaConsole : public BasicPioDevice
/** /**
* memory mapped reads and writes * memory mapped reads and writes
*/ */
virtual Tick read(Packet &pkt); virtual Tick read(Packet *pkt);
virtual Tick write(Packet &pkt); virtual Tick write(Packet *pkt);
/** /**
* standard serialization routines for checkpointing * standard serialization routines for checkpointing

View file

@ -51,13 +51,13 @@ BadDevice::BadDevice(Params *p)
} }
Tick Tick
BadDevice::read(Packet &pkt) BadDevice::read(Packet *pkt)
{ {
panic("Device %s not imlpmented\n", devname); panic("Device %s not imlpmented\n", devname);
} }
Tick Tick
BadDevice::write(Packet &pkt) BadDevice::write(Packet *pkt)
{ {
panic("Device %s not imlpmented\n", devname); panic("Device %s not imlpmented\n", devname);
} }

View file

@ -65,8 +65,8 @@ class BadDevice : public BasicPioDevice
*/ */
BadDevice(Params *p); BadDevice(Params *p);
virtual Tick read(Packet &pkt); virtual Tick read(Packet *pkt);
virtual Tick write(Packet &pkt); virtual Tick write(Packet *pkt);
}; };
#endif // __DEV_BADDEV_HH__ #endif // __DEV_BADDEV_HH__

View file

@ -423,39 +423,39 @@ IdeController::writeConfig(int offset, const uint32_t data)
} }
Tick Tick
IdeController::read(Packet &pkt) IdeController::read(Packet *pkt)
{ {
Addr offset; Addr offset;
IdeChannel channel; IdeChannel channel;
IdeRegType reg_type; IdeRegType reg_type;
int disk; int disk;
pkt.time += pioDelay; pkt->time += pioDelay;
pkt.allocate(); pkt->allocate();
if (pkt.size != 1 && pkt.size != 2 && pkt.size !=4) if (pkt->size != 1 && pkt->size != 2 && pkt->size !=4)
panic("Bad IDE read size: %d\n", pkt.size); panic("Bad IDE read size: %d\n", pkt->size);
parseAddr(pkt.addr, offset, channel, reg_type); parseAddr(pkt->addr, offset, channel, reg_type);
if (!io_enabled) { if (!io_enabled) {
pkt.result = Success; pkt->result = Success;
return pioDelay; return pioDelay;
} }
switch (reg_type) { switch (reg_type) {
case BMI_BLOCK: case BMI_BLOCK:
switch (pkt.size) { switch (pkt->size) {
case sizeof(uint8_t): case sizeof(uint8_t):
pkt.set(bmi_regs.data[offset]); pkt->set(bmi_regs.data[offset]);
break; break;
case sizeof(uint16_t): case sizeof(uint16_t):
pkt.set(*(uint16_t*)&bmi_regs.data[offset]); pkt->set(*(uint16_t*)&bmi_regs.data[offset]);
break; break;
case sizeof(uint32_t): case sizeof(uint32_t):
pkt.set(*(uint32_t*)&bmi_regs.data[offset]); pkt->set(*(uint32_t*)&bmi_regs.data[offset]);
break; break;
default: default:
panic("IDE read of BMI reg invalid size: %#x\n", pkt.size); panic("IDE read of BMI reg invalid size: %#x\n", pkt->size);
} }
break; break;
@ -464,53 +464,53 @@ IdeController::read(Packet &pkt)
disk = getDisk(channel); disk = getDisk(channel);
if (disks[disk] == NULL) { if (disks[disk] == NULL) {
pkt.set<uint8_t>(0); pkt->set<uint8_t>(0);
break; break;
} }
switch (offset) { switch (offset) {
case DATA_OFFSET: case DATA_OFFSET:
switch (pkt.size) { switch (pkt->size) {
case sizeof(uint16_t): case sizeof(uint16_t):
disks[disk]->read(offset, reg_type, pkt.getPtr<uint8_t>()); disks[disk]->read(offset, reg_type, pkt->getPtr<uint8_t>());
break; break;
case sizeof(uint32_t): case sizeof(uint32_t):
disks[disk]->read(offset, reg_type, pkt.getPtr<uint8_t>()); disks[disk]->read(offset, reg_type, pkt->getPtr<uint8_t>());
disks[disk]->read(offset, reg_type, disks[disk]->read(offset, reg_type,
pkt.getPtr<uint8_t>() + sizeof(uint16_t)); pkt->getPtr<uint8_t>() + sizeof(uint16_t));
break; break;
default: default:
panic("IDE read of data reg invalid size: %#x\n", pkt.size); panic("IDE read of data reg invalid size: %#x\n", pkt->size);
} }
break; break;
default: default:
if (pkt.size == sizeof(uint8_t)) { if (pkt->size == sizeof(uint8_t)) {
disks[disk]->read(offset, reg_type, pkt.getPtr<uint8_t>()); disks[disk]->read(offset, reg_type, pkt->getPtr<uint8_t>());
} else } else
panic("IDE read of command reg of invalid size: %#x\n", pkt.size); panic("IDE read of command reg of invalid size: %#x\n", pkt->size);
} }
break; break;
default: default:
panic("IDE controller read of unknown register block type!\n"); panic("IDE controller read of unknown register block type!\n");
} }
if (pkt.size == 1) if (pkt->size == 1)
DPRINTF(IdeCtrl, "read from offset: %#x size: %#x data: %#x\n", DPRINTF(IdeCtrl, "read from offset: %#x size: %#x data: %#x\n",
offset, pkt.size, (uint32_t)pkt.get<uint8_t>()); offset, pkt->size, (uint32_t)pkt->get<uint8_t>());
else if (pkt.size == 2) else if (pkt->size == 2)
DPRINTF(IdeCtrl, "read from offset: %#x size: %#x data: %#x\n", DPRINTF(IdeCtrl, "read from offset: %#x size: %#x data: %#x\n",
offset, pkt.size, pkt.get<uint16_t>()); offset, pkt->size, pkt->get<uint16_t>());
else else
DPRINTF(IdeCtrl, "read from offset: %#x size: %#x data: %#x\n", DPRINTF(IdeCtrl, "read from offset: %#x size: %#x data: %#x\n",
offset, pkt.size, pkt.get<uint32_t>()); offset, pkt->size, pkt->get<uint32_t>());
pkt.result = Success; pkt->result = Success;
return pioDelay; return pioDelay;
} }
Tick Tick
IdeController::write(Packet &pkt) IdeController::write(Packet *pkt)
{ {
Addr offset; Addr offset;
IdeChannel channel; IdeChannel channel;
@ -518,12 +518,12 @@ IdeController::write(Packet &pkt)
int disk; int disk;
uint8_t oldVal, newVal; uint8_t oldVal, newVal;
pkt.time += pioDelay; pkt->time += pioDelay;
parseAddr(pkt.addr, offset, channel, reg_type); parseAddr(pkt->addr, offset, channel, reg_type);
if (!io_enabled) { if (!io_enabled) {
pkt.result = Success; pkt->result = Success;
DPRINTF(IdeCtrl, "io not enabled\n"); DPRINTF(IdeCtrl, "io not enabled\n");
return pioDelay; return pioDelay;
} }
@ -531,7 +531,7 @@ IdeController::write(Packet &pkt)
switch (reg_type) { switch (reg_type) {
case BMI_BLOCK: case BMI_BLOCK:
if (!bm_enabled) { if (!bm_enabled) {
pkt.result = Success; pkt->result = Success;
return pioDelay; return pioDelay;
} }
@ -539,14 +539,14 @@ IdeController::write(Packet &pkt)
// Bus master IDE command register // Bus master IDE command register
case BMIC1: case BMIC1:
case BMIC0: case BMIC0:
if (pkt.size != sizeof(uint8_t)) if (pkt->size != sizeof(uint8_t))
panic("Invalid BMIC write size: %x\n", pkt.size); panic("Invalid BMIC write size: %x\n", pkt->size);
// select the current disk based on DEV bit // select the current disk based on DEV bit
disk = getDisk(channel); disk = getDisk(channel);
oldVal = bmi_regs.chan[channel].bmic; oldVal = bmi_regs.chan[channel].bmic;
newVal = pkt.get<uint8_t>(); newVal = pkt->get<uint8_t>();
// if a DMA transfer is in progress, R/W control cannot change // if a DMA transfer is in progress, R/W control cannot change
if (oldVal & SSBM) { if (oldVal & SSBM) {
@ -595,11 +595,11 @@ IdeController::write(Packet &pkt)
// Bus master IDE status register // Bus master IDE status register
case BMIS0: case BMIS0:
case BMIS1: case BMIS1:
if (pkt.size != sizeof(uint8_t)) if (pkt->size != sizeof(uint8_t))
panic("Invalid BMIS write size: %x\n", pkt.size); panic("Invalid BMIS write size: %x\n", pkt->size);
oldVal = bmi_regs.chan[channel].bmis; oldVal = bmi_regs.chan[channel].bmis;
newVal = pkt.get<uint8_t>(); newVal = pkt->get<uint8_t>();
// the BMIDEA bit is RO // the BMIDEA bit is RO
newVal |= (oldVal & BMIDEA); newVal |= (oldVal & BMIDEA);
@ -622,28 +622,28 @@ IdeController::write(Packet &pkt)
case BMIDTP0: case BMIDTP0:
case BMIDTP1: case BMIDTP1:
{ {
if (pkt.size != sizeof(uint32_t)) if (pkt->size != sizeof(uint32_t))
panic("Invalid BMIDTP write size: %x\n", pkt.size); panic("Invalid BMIDTP write size: %x\n", pkt->size);
bmi_regs.chan[channel].bmidtp = htole(pkt.get<uint32_t>() & ~0x3); bmi_regs.chan[channel].bmidtp = htole(pkt->get<uint32_t>() & ~0x3);
} }
break; break;
default: default:
if (pkt.size != sizeof(uint8_t) && if (pkt->size != sizeof(uint8_t) &&
pkt.size != sizeof(uint16_t) && pkt->size != sizeof(uint16_t) &&
pkt.size != sizeof(uint32_t)) pkt->size != sizeof(uint32_t))
panic("IDE controller write of invalid write size: %x\n", panic("IDE controller write of invalid write size: %x\n",
pkt.size); pkt->size);
// do a default copy of data into the registers // do a default copy of data into the registers
memcpy(&bmi_regs.data[offset], pkt.getPtr<uint8_t>(), pkt.size); memcpy(&bmi_regs.data[offset], pkt->getPtr<uint8_t>(), pkt->size);
} }
break; break;
case COMMAND_BLOCK: case COMMAND_BLOCK:
if (offset == IDE_SELECT_OFFSET) { if (offset == IDE_SELECT_OFFSET) {
uint8_t *devBit = &dev[channel]; uint8_t *devBit = &dev[channel];
*devBit = (letoh(pkt.get<uint8_t>()) & IDE_SELECT_DEV_BIT) ? 1 : 0; *devBit = (letoh(pkt->get<uint8_t>()) & IDE_SELECT_DEV_BIT) ? 1 : 0;
} }
// fall-through ok! // fall-through ok!
case CONTROL_BLOCK: case CONTROL_BLOCK:
@ -654,43 +654,43 @@ IdeController::write(Packet &pkt)
switch (offset) { switch (offset) {
case DATA_OFFSET: case DATA_OFFSET:
switch (pkt.size) { switch (pkt->size) {
case sizeof(uint16_t): case sizeof(uint16_t):
disks[disk]->write(offset, reg_type, pkt.getPtr<uint8_t>()); disks[disk]->write(offset, reg_type, pkt->getPtr<uint8_t>());
break; break;
case sizeof(uint32_t): case sizeof(uint32_t):
disks[disk]->write(offset, reg_type, pkt.getPtr<uint8_t>()); disks[disk]->write(offset, reg_type, pkt->getPtr<uint8_t>());
disks[disk]->write(offset, reg_type, pkt.getPtr<uint8_t>() + disks[disk]->write(offset, reg_type, pkt->getPtr<uint8_t>() +
sizeof(uint16_t)); sizeof(uint16_t));
break; break;
default: default:
panic("IDE write of data reg invalid size: %#x\n", pkt.size); panic("IDE write of data reg invalid size: %#x\n", pkt->size);
} }
break; break;
default: default:
if (pkt.size == sizeof(uint8_t)) { if (pkt->size == sizeof(uint8_t)) {
disks[disk]->write(offset, reg_type, pkt.getPtr<uint8_t>()); disks[disk]->write(offset, reg_type, pkt->getPtr<uint8_t>());
} else } else
panic("IDE write of command reg of invalid size: %#x\n", pkt.size); panic("IDE write of command reg of invalid size: %#x\n", pkt->size);
} }
break; break;
default: default:
panic("IDE controller write of unknown register block type!\n"); panic("IDE controller write of unknown register block type!\n");
} }
if (pkt.size == 1) if (pkt->size == 1)
DPRINTF(IdeCtrl, "write to offset: %#x size: %#x data: %#x\n", DPRINTF(IdeCtrl, "write to offset: %#x size: %#x data: %#x\n",
offset, pkt.size, (uint32_t)pkt.get<uint8_t>()); offset, pkt->size, (uint32_t)pkt->get<uint8_t>());
else if (pkt.size == 2) else if (pkt->size == 2)
DPRINTF(IdeCtrl, "write to offset: %#x size: %#x data: %#x\n", DPRINTF(IdeCtrl, "write to offset: %#x size: %#x data: %#x\n",
offset, pkt.size, pkt.get<uint16_t>()); offset, pkt->size, pkt->get<uint16_t>());
else else
DPRINTF(IdeCtrl, "write to offset: %#x size: %#x data: %#x\n", DPRINTF(IdeCtrl, "write to offset: %#x size: %#x data: %#x\n",
offset, pkt.size, pkt.get<uint32_t>()); offset, pkt->size, pkt->get<uint32_t>());
pkt.result = Success; pkt->result = Success;
return pioDelay; return pioDelay;
} }

View file

@ -215,14 +215,14 @@ class IdeController : public PciDev
* @param pkt Packet describing what is to be read * @param pkt Packet describing what is to be read
* @return The amount of time to complete this request * @return The amount of time to complete this request
*/ */
virtual Tick read(Packet &pkt); virtual Tick read(Packet *pkt);
/** /**
* Write a done field for a given target. * Write a done field for a given target.
* @param pkt Packet describing what is to be written * @param pkt Packet describing what is to be written
* @return The amount of time to complete this request * @return The amount of time to complete this request
*/ */
virtual Tick write(Packet &pkt); virtual Tick write(Packet *pkt);
/** /**
* Serialize this object to the given output stream. * Serialize this object to the given output stream.

View file

@ -36,13 +36,13 @@ PioPort::PioPort(PioDevice *dev, Platform *p)
Tick Tick
PioPort::recvAtomic(Packet &pkt) PioPort::recvAtomic(Packet *pkt)
{ {
return device->recvAtomic(pkt); return device->recvAtomic(pkt);
} }
void void
PioPort::recvFunctional(Packet &pkt) PioPort::recvFunctional(Packet *pkt)
{ {
device->recvAtomic(pkt); device->recvAtomic(pkt);
} }
@ -70,15 +70,15 @@ PioPort::SendEvent::process()
if (port->Port::sendTiming(packet) == Success) if (port->Port::sendTiming(packet) == Success)
return; return;
port->transmitList.push_back(&packet); port->transmitList.push_back(packet);
} }
bool bool
PioPort::recvTiming(Packet &pkt) PioPort::recvTiming(Packet *pkt)
{ {
device->recvAtomic(pkt); device->recvAtomic(pkt);
sendTiming(pkt, pkt.time-pkt.req->getTime()); sendTiming(pkt, pkt->time - pkt->req->getTime());
return Success; return Success;
} }
@ -110,17 +110,17 @@ DmaPort::DmaPort(DmaDevice *dev, Platform *p)
{ } { }
bool bool
DmaPort::recvTiming(Packet &pkt) DmaPort::recvTiming(Packet *pkt)
{ {
if (pkt.senderState) { if (pkt->senderState) {
DmaReqState *state; DmaReqState *state;
state = (DmaReqState*)pkt.senderState; state = (DmaReqState*)pkt->senderState;
state->completionEvent->schedule(pkt.time - pkt.req->getTime()); state->completionEvent->schedule(pkt->time - pkt->req->getTime());
delete pkt.req; delete pkt->req;
delete &pkt; delete pkt;
} else { } else {
delete pkt.req; delete pkt->req;
delete &pkt; delete pkt;
} }
return Success; return Success;
@ -136,7 +136,7 @@ DmaPort::SendEvent::process()
if (port->Port::sendTiming(packet) == Success) if (port->Port::sendTiming(packet) == Success)
return; return;
port->transmitList.push_back(&packet); port->transmitList.push_back(packet);
} }
Packet * Packet *
@ -209,7 +209,7 @@ DmaPort::sendDma(Packet *pkt)
if (sendTiming(pkt) == Failure) if (sendTiming(pkt) == Failure)
transmitList.push_back(&packet); transmitList.push_back(&packet);
} else if (state == Atomic) {*/ } else if (state == Atomic) {*/
sendAtomic(*pkt); sendAtomic(pkt);
if (pkt->senderState) { if (pkt->senderState) {
DmaReqState *state = (DmaReqState*)pkt->senderState; DmaReqState *state = (DmaReqState*)pkt->senderState;
state->completionEvent->schedule(curTick + (pkt->time - pkt->req->getTime()) +1); state->completionEvent->schedule(curTick + (pkt->time - pkt->req->getTime()) +1);
@ -222,7 +222,7 @@ DmaPort::sendDma(Packet *pkt)
/* } else if (state == Functional) { /* } else if (state == Functional) {
sendFunctional(pkt); sendFunctional(pkt);
// Is this correct??? // Is this correct???
completionEvent->schedule(pkt.req->responseTime - pkt.req->requestTime); completionEvent->schedule(pkt->req->responseTime - pkt->req->requestTime);
completionEvent == NULL; completionEvent == NULL;
} else } else
panic("Unknown memory command state."); panic("Unknown memory command state.");

View file

@ -68,11 +68,11 @@ class PioPort : public Port
/** The current status of the peer(bus) that we are connected to. */ /** The current status of the peer(bus) that we are connected to. */
Status peerStatus; Status peerStatus;
virtual bool recvTiming(Packet &pkt); virtual bool recvTiming(Packet *pkt);
virtual Tick recvAtomic(Packet &pkt); virtual Tick recvAtomic(Packet *pkt);
virtual void recvFunctional(Packet &pkt) ; virtual void recvFunctional(Packet *pkt) ;
virtual void recvStatusChange(Status status) virtual void recvStatusChange(Status status)
{ peerStatus = status; } { peerStatus = status; }
@ -87,9 +87,9 @@ class PioPort : public Port
class SendEvent : public Event class SendEvent : public Event
{ {
PioPort *port; PioPort *port;
Packet packet; Packet *packet;
SendEvent(PioPort *p, Packet &pkt, Tick t) SendEvent(PioPort *p, Packet *pkt, Tick t)
: Event(&mainEventQueue), packet(pkt) : Event(&mainEventQueue), packet(pkt)
{ schedule(curTick + t); } { schedule(curTick + t); }
@ -102,7 +102,7 @@ class PioPort : public Port
}; };
/** Schedule a sendTiming() event to be called in the future. */ /** Schedule a sendTiming() event to be called in the future. */
void sendTiming(Packet &pkt, Tick time) void sendTiming(Packet *pkt, Tick time)
{ new PioPort::SendEvent(this, pkt, time); } { new PioPort::SendEvent(this, pkt, time); }
/** This function pops the last element off the transmit list and sends it.*/ /** This function pops the last element off the transmit list and sends it.*/
@ -137,10 +137,10 @@ class DmaPort : public Port
/** Number of outstanding packets the dma port has. */ /** Number of outstanding packets the dma port has. */
int pendingCount; int pendingCount;
virtual bool recvTiming(Packet &pkt); virtual bool recvTiming(Packet *pkt);
virtual Tick recvAtomic(Packet &pkt) virtual Tick recvAtomic(Packet *pkt)
{ panic("dma port shouldn't be used for pio access."); } { panic("dma port shouldn't be used for pio access."); }
virtual void recvFunctional(Packet &pkt) virtual void recvFunctional(Packet *pkt)
{ panic("dma port shouldn't be used for pio access."); } { panic("dma port shouldn't be used for pio access."); }
virtual void recvStatusChange(Status status) virtual void recvStatusChange(Status status)
@ -154,9 +154,9 @@ class DmaPort : public Port
class SendEvent : public Event class SendEvent : public Event
{ {
DmaPort *port; DmaPort *port;
Packet packet; Packet *packet;
SendEvent(PioPort *p, Packet &pkt, Tick t) SendEvent(PioPort *p, Packet *pkt, Tick t)
: Event(&mainEventQueue), packet(pkt) : Event(&mainEventQueue), packet(pkt)
{ schedule(curTick + t); } { schedule(curTick + t); }
@ -206,22 +206,22 @@ class PioDevice : public MemObject
/** As far as the devices are concerned they only accept atomic transactions /** As far as the devices are concerned they only accept atomic transactions
* which are converted to either a write or a read. */ * which are converted to either a write or a read. */
Tick recvAtomic(Packet &pkt) Tick recvAtomic(Packet *pkt)
{ return pkt.cmd == Read ? this->read(pkt) : this->write(pkt); } { return pkt->cmd == Read ? this->read(pkt) : this->write(pkt); }
/** Pure virtual function that the device must implement. Called when a read /** Pure virtual function that the device must implement. Called when a read
* command is recieved by the port. * command is recieved by the port.
* @param pkt Packet describing this request * @param pkt Packet describing this request
* @return number of ticks it took to complete * @return number of ticks it took to complete
*/ */
virtual Tick read(Packet &pkt) = 0; virtual Tick read(Packet *pkt) = 0;
/** Pure virtual function that the device must implement. Called when a /** Pure virtual function that the device must implement. Called when a
* write command is recieved by the port. * write command is recieved by the port.
* @param pkt Packet describing this request * @param pkt Packet describing this request
* @return number of ticks it took to complete * @return number of ticks it took to complete
*/ */
virtual Tick write(Packet &pkt) = 0; virtual Tick write(Packet *pkt) = 0;
public: public:
/** Params struct which is extended through each device based on the /** Params struct which is extended through each device based on the

View file

@ -49,40 +49,40 @@ IsaFake::IsaFake(Params *p)
} }
Tick Tick
IsaFake::read(Packet &pkt) IsaFake::read(Packet *pkt)
{ {
assert(pkt.result == Unknown); assert(pkt->result == Unknown);
assert(pkt.addr >= pioAddr && pkt.addr < pioAddr + pioSize); assert(pkt->addr >= pioAddr && pkt->addr < pioAddr + pioSize);
pkt.time += pioDelay; pkt->time += pioDelay;
DPRINTF(Tsunami, "read va=%#x size=%d\n", pkt.addr, pkt.size); DPRINTF(Tsunami, "read va=%#x size=%d\n", pkt->addr, pkt->size);
switch (pkt.size) { switch (pkt->size) {
pkt.set(0xFFFFFFFFFFFFFFFFULL); pkt->set(0xFFFFFFFFFFFFFFFFULL);
break; break;
case sizeof(uint32_t): case sizeof(uint32_t):
pkt.set((uint32_t)0xFFFFFFFF); pkt->set((uint32_t)0xFFFFFFFF);
break; break;
case sizeof(uint16_t): case sizeof(uint16_t):
pkt.set((uint16_t)0xFFFF); pkt->set((uint16_t)0xFFFF);
break; break;
case sizeof(uint8_t): case sizeof(uint8_t):
pkt.set((uint8_t)0xFF); pkt->set((uint8_t)0xFF);
break; break;
default: default:
panic("invalid access size(?) for PCI configspace!\n"); panic("invalid access size(?) for PCI configspace!\n");
} }
pkt.result = Success; pkt->result = Success;
return pioDelay; return pioDelay;
} }
Tick Tick
IsaFake::write(Packet &pkt) IsaFake::write(Packet *pkt)
{ {
pkt.time += pioDelay; pkt->time += pioDelay;
DPRINTF(Tsunami, "write - va=%#x size=%d \n", pkt.addr, pkt.size); DPRINTF(Tsunami, "write - va=%#x size=%d \n", pkt->addr, pkt->size);
pkt.result = Success; pkt->result = Success;
return pioDelay; return pioDelay;
} }

View file

@ -65,14 +65,14 @@ class IsaFake : public BasicPioDevice
* @param req The memory request. * @param req The memory request.
* @param data Where to put the data. * @param data Where to put the data.
*/ */
virtual Tick read(Packet &pkt); virtual Tick read(Packet *pkt);
/** /**
* All writes are simply ignored. * All writes are simply ignored.
* @param req The memory request. * @param req The memory request.
* @param data the data to not write. * @param data the data to not write.
*/ */
virtual Tick write(Packet &pkt); virtual Tick write(Packet *pkt);
}; };
#endif // __TSUNAMI_FAKE_HH__ #endif // __TSUNAMI_FAKE_HH__

View file

@ -488,17 +488,17 @@ NSGigE::writeConfig(int offset, const uint16_t data)
* spec sheet * spec sheet
*/ */
Tick Tick
NSGigE::read(Packet &pkt) NSGigE::read(Packet *pkt)
{ {
assert(ioEnable); assert(ioEnable);
pkt.time += pioDelay; pkt->time += pioDelay;
pkt.allocate(); pkt->allocate();
//The mask is to give you only the offset into the device register file //The mask is to give you only the offset into the device register file
Addr daddr = pkt.addr & 0xfff; Addr daddr = pkt->addr & 0xfff;
DPRINTF(EthernetPIO, "read da=%#x pa=%#x size=%d\n", DPRINTF(EthernetPIO, "read da=%#x pa=%#x size=%d\n",
daddr, pkt.addr, pkt.size); daddr, pkt->addr, pkt->size);
// there are some reserved registers, you can see ns_gige_reg.h and // there are some reserved registers, you can see ns_gige_reg.h and
@ -506,26 +506,26 @@ NSGigE::read(Packet &pkt)
if (daddr > LAST && daddr <= RESERVED) { if (daddr > LAST && daddr <= RESERVED) {
panic("Accessing reserved register"); panic("Accessing reserved register");
} else if (daddr > RESERVED && daddr <= 0x3FC) { } else if (daddr > RESERVED && daddr <= 0x3FC) {
if (pkt.size == sizeof(uint8_t)) if (pkt->size == sizeof(uint8_t))
readConfig(daddr & 0xff, pkt.getPtr<uint8_t>()); readConfig(daddr & 0xff, pkt->getPtr<uint8_t>());
if (pkt.size == sizeof(uint16_t)) if (pkt->size == sizeof(uint16_t))
readConfig(daddr & 0xff, pkt.getPtr<uint16_t>()); readConfig(daddr & 0xff, pkt->getPtr<uint16_t>());
if (pkt.size == sizeof(uint32_t)) if (pkt->size == sizeof(uint32_t))
readConfig(daddr & 0xff, pkt.getPtr<uint32_t>()); readConfig(daddr & 0xff, pkt->getPtr<uint32_t>());
pkt.result = Success; pkt->result = Success;
return pioDelay; return pioDelay;
} else if (daddr >= MIB_START && daddr <= MIB_END) { } else if (daddr >= MIB_START && daddr <= MIB_END) {
// don't implement all the MIB's. hopefully the kernel // don't implement all the MIB's. hopefully the kernel
// doesn't actually DEPEND upon their values // doesn't actually DEPEND upon their values
// MIB are just hardware stats keepers // MIB are just hardware stats keepers
pkt.set<uint32_t>(0); pkt->set<uint32_t>(0);
pkt.result = Success; pkt->result = Success;
return pioDelay; return pioDelay;
} else if (daddr > 0x3FC) } else if (daddr > 0x3FC)
panic("Something is messed up!\n"); panic("Something is messed up!\n");
assert(pkt.size == sizeof(uint32_t)); assert(pkt->size == sizeof(uint32_t));
uint32_t &reg = *pkt.getPtr<uint32_t>(); uint32_t &reg = *pkt->getPtr<uint32_t>();
uint16_t rfaddr; uint16_t rfaddr;
switch (daddr) { switch (daddr) {
@ -715,37 +715,37 @@ NSGigE::read(Packet &pkt)
DPRINTF(EthernetPIO, "read from %#x: data=%d data=%#x\n", DPRINTF(EthernetPIO, "read from %#x: data=%d data=%#x\n",
daddr, reg, reg); daddr, reg, reg);
pkt.result = Success; pkt->result = Success;
return pioDelay; return pioDelay;
} }
Tick Tick
NSGigE::write(Packet &pkt) NSGigE::write(Packet *pkt)
{ {
assert(ioEnable); assert(ioEnable);
Addr daddr = pkt.addr & 0xfff; Addr daddr = pkt->addr & 0xfff;
DPRINTF(EthernetPIO, "write da=%#x pa=%#x size=%d\n", DPRINTF(EthernetPIO, "write da=%#x pa=%#x size=%d\n",
daddr, pkt.addr, pkt.size); daddr, pkt->addr, pkt->size);
pkt.time += pioDelay; pkt->time += pioDelay;
if (daddr > LAST && daddr <= RESERVED) { if (daddr > LAST && daddr <= RESERVED) {
panic("Accessing reserved register"); panic("Accessing reserved register");
} else if (daddr > RESERVED && daddr <= 0x3FC) { } else if (daddr > RESERVED && daddr <= 0x3FC) {
if (pkt.size == sizeof(uint8_t)) if (pkt->size == sizeof(uint8_t))
writeConfig(daddr & 0xff, pkt.get<uint8_t>()); writeConfig(daddr & 0xff, pkt->get<uint8_t>());
if (pkt.size == sizeof(uint16_t)) if (pkt->size == sizeof(uint16_t))
writeConfig(daddr & 0xff, pkt.get<uint16_t>()); writeConfig(daddr & 0xff, pkt->get<uint16_t>());
if (pkt.size == sizeof(uint32_t)) if (pkt->size == sizeof(uint32_t))
writeConfig(daddr & 0xff, pkt.get<uint32_t>()); writeConfig(daddr & 0xff, pkt->get<uint32_t>());
pkt.result = Success; pkt->result = Success;
return pioDelay; return pioDelay;
} else if (daddr > 0x3FC) } else if (daddr > 0x3FC)
panic("Something is messed up!\n"); panic("Something is messed up!\n");
if (pkt.size == sizeof(uint32_t)) { if (pkt->size == sizeof(uint32_t)) {
uint32_t reg = pkt.get<uint32_t>(); uint32_t reg = pkt->get<uint32_t>();
uint16_t rfaddr; uint16_t rfaddr;
DPRINTF(EthernetPIO, "write data=%d data=%#x\n", reg, reg); DPRINTF(EthernetPIO, "write data=%d data=%#x\n", reg, reg);
@ -1131,7 +1131,7 @@ NSGigE::write(Packet &pkt)
} else { } else {
panic("Invalid Request Size"); panic("Invalid Request Size");
} }
pkt.result = Success; pkt->result = Success;
return pioDelay; return pioDelay;
} }

View file

@ -375,8 +375,8 @@ class NSGigE : public PciDev
virtual void writeConfig(int offset, const uint16_t data); virtual void writeConfig(int offset, const uint16_t data);
virtual Tick read(Packet &pkt); virtual Tick read(Packet *pkt);
virtual Tick write(Packet &pkt); virtual Tick write(Packet *pkt);
bool cpuIntrPending() const; bool cpuIntrPending() const;
void cpuIntrAck() { cpuIntrClear(); } void cpuIntrAck() { cpuIntrClear(); }

View file

@ -89,58 +89,58 @@ PciConfigAll::startup()
} }
Tick Tick
PciConfigAll::read(Packet &pkt) PciConfigAll::read(Packet *pkt)
{ {
assert(pkt.result == Unknown); assert(pkt->result == Unknown);
assert(pkt.addr >= pioAddr && pkt.addr < pioAddr + pioSize); assert(pkt->addr >= pioAddr && pkt->addr < pioAddr + pioSize);
Addr daddr = pkt.addr - pioAddr; Addr daddr = pkt->addr - pioAddr;
int device = (daddr >> 11) & 0x1F; int device = (daddr >> 11) & 0x1F;
int func = (daddr >> 8) & 0x7; int func = (daddr >> 8) & 0x7;
int reg = daddr & 0xFF; int reg = daddr & 0xFF;
pkt.time += pioDelay; pkt->time += pioDelay;
pkt.allocate(); pkt->allocate();
DPRINTF(PciConfigAll, "read va=%#x da=%#x size=%d\n", pkt.addr, daddr, DPRINTF(PciConfigAll, "read va=%#x da=%#x size=%d\n", pkt->addr, daddr,
pkt.size); pkt->size);
switch (pkt.size) { switch (pkt->size) {
case sizeof(uint32_t): case sizeof(uint32_t):
if (devices[device][func] == NULL) if (devices[device][func] == NULL)
pkt.set<uint32_t>(0xFFFFFFFF); pkt->set<uint32_t>(0xFFFFFFFF);
else else
devices[device][func]->readConfig(reg, pkt.getPtr<uint32_t>()); devices[device][func]->readConfig(reg, pkt->getPtr<uint32_t>());
break; break;
case sizeof(uint16_t): case sizeof(uint16_t):
if (devices[device][func] == NULL) if (devices[device][func] == NULL)
pkt.set<uint16_t>(0xFFFF); pkt->set<uint16_t>(0xFFFF);
else else
devices[device][func]->readConfig(reg, pkt.getPtr<uint16_t>()); devices[device][func]->readConfig(reg, pkt->getPtr<uint16_t>());
break; break;
case sizeof(uint8_t): case sizeof(uint8_t):
if (devices[device][func] == NULL) if (devices[device][func] == NULL)
pkt.set<uint8_t>(0xFF); pkt->set<uint8_t>(0xFF);
else else
devices[device][func]->readConfig(reg, pkt.getPtr<uint8_t>()); devices[device][func]->readConfig(reg, pkt->getPtr<uint8_t>());
break; break;
default: default:
panic("invalid access size(?) for PCI configspace!\n"); panic("invalid access size(?) for PCI configspace!\n");
} }
pkt.result = Success; pkt->result = Success;
return pioDelay; return pioDelay;
} }
Tick Tick
PciConfigAll::write(Packet &pkt) PciConfigAll::write(Packet *pkt)
{ {
pkt.time += pioDelay; pkt->time += pioDelay;
assert(pkt.result == Unknown); assert(pkt->result == Unknown);
assert(pkt.addr >= pioAddr && pkt.addr < pioAddr + pioSize); assert(pkt->addr >= pioAddr && pkt->addr < pioAddr + pioSize);
assert(pkt.size == sizeof(uint8_t) || pkt.size == sizeof(uint16_t) || assert(pkt->size == sizeof(uint8_t) || pkt->size == sizeof(uint16_t) ||
pkt.size == sizeof(uint32_t)); pkt->size == sizeof(uint32_t));
Addr daddr = pkt.addr - pioAddr; Addr daddr = pkt->addr - pioAddr;
int device = (daddr >> 11) & 0x1F; int device = (daddr >> 11) & 0x1F;
int func = (daddr >> 8) & 0x7; int func = (daddr >> 8) & 0x7;
@ -150,22 +150,22 @@ PciConfigAll::write(Packet &pkt)
panic("Attempting to write to config space on non-existant device\n"); panic("Attempting to write to config space on non-existant device\n");
DPRINTF(PciConfigAll, "write - va=%#x size=%d data=%#x\n", DPRINTF(PciConfigAll, "write - va=%#x size=%d data=%#x\n",
pkt.addr, pkt.size, pkt.get<uint32_t>()); pkt->addr, pkt->size, pkt->get<uint32_t>());
switch (pkt.size) { switch (pkt->size) {
case sizeof(uint8_t): case sizeof(uint8_t):
devices[device][func]->writeConfig(reg, pkt.get<uint8_t>()); devices[device][func]->writeConfig(reg, pkt->get<uint8_t>());
break; break;
case sizeof(uint16_t): case sizeof(uint16_t):
devices[device][func]->writeConfig(reg, pkt.get<uint16_t>()); devices[device][func]->writeConfig(reg, pkt->get<uint16_t>());
break; break;
case sizeof(uint32_t): case sizeof(uint32_t):
devices[device][func]->writeConfig(reg, pkt.get<uint32_t>()); devices[device][func]->writeConfig(reg, pkt->get<uint32_t>());
break; break;
default: default:
panic("invalid pci config write size\n"); panic("invalid pci config write size\n");
} }
pkt.result = Success; pkt->result = Success;
return pioDelay; return pioDelay;
} }

View file

@ -92,7 +92,7 @@ class PciConfigAll : public BasicPioDevice
* @param pkt Contains the address of the field to read. * @param pkt Contains the address of the field to read.
* @return Amount of time to do the read * @return Amount of time to do the read
*/ */
virtual Tick read(Packet &pkt); virtual Tick read(Packet *pkt);
/** /**
* Write to PCI config spcae. If the device does not exit the simulator * Write to PCI config spcae. If the device does not exit the simulator
@ -103,7 +103,7 @@ class PciConfigAll : public BasicPioDevice
* @return The fault condition of the access. * @return The fault condition of the access.
*/ */
virtual Tick write(Packet &pkt); virtual Tick write(Packet *pkt);
/** /**
* Start up function to check if more than one person is using an interrupt line * Start up function to check if more than one person is using an interrupt line

View file

@ -312,51 +312,51 @@ Device::prepareWrite(int cpu, int index)
* I/O read of device register * I/O read of device register
*/ */
Tick Tick
Device::read(Packet &pkt) Device::read(Packet *pkt)
{ {
assert(config.command & PCI_CMD_MSE); assert(config.command & PCI_CMD_MSE);
assert(pkt.addr >= BARAddrs[0] && pkt.size < BARSize[0]); assert(pkt->addr >= BARAddrs[0] && pkt->size < BARSize[0]);
int cpu = pkt.req->getCpuNum(); int cpu = pkt->req->getCpuNum();
Addr daddr = pkt.addr - BARAddrs[0]; Addr daddr = pkt->addr - BARAddrs[0];
Addr index = daddr >> Regs::VirtualShift; Addr index = daddr >> Regs::VirtualShift;
Addr raddr = daddr & Regs::VirtualMask; Addr raddr = daddr & Regs::VirtualMask;
pkt.time += pioDelay; pkt->time += pioDelay;
pkt.allocate(); pkt->allocate();
if (!regValid(raddr)) if (!regValid(raddr))
panic("invalid register: cpu=%d vnic=%d da=%#x pa=%#x size=%d", panic("invalid register: cpu=%d vnic=%d da=%#x pa=%#x size=%d",
cpu, index, daddr, pkt.addr, pkt.size); cpu, index, daddr, pkt->addr, pkt->size);
const Regs::Info &info = regInfo(raddr); const Regs::Info &info = regInfo(raddr);
if (!info.read) if (!info.read)
panic("read %s (write only): " panic("read %s (write only): "
"cpu=%d vnic=%d da=%#x pa=%#x size=%d", "cpu=%d vnic=%d da=%#x pa=%#x size=%d",
info.name, cpu, index, daddr, pkt.addr, pkt.size); info.name, cpu, index, daddr, pkt->addr, pkt->size);
panic("read %s (invalid size): " panic("read %s (invalid size): "
"cpu=%d vnic=%d da=%#x pa=%#x size=%d", "cpu=%d vnic=%d da=%#x pa=%#x size=%d",
info.name, cpu, index, daddr, pkt.addr, pkt.size); info.name, cpu, index, daddr, pkt->addr, pkt->size);
prepareRead(cpu, index); prepareRead(cpu, index);
uint64_t value = 0; uint64_t value = 0;
if (pkt.size == 4) { if (pkt->size == 4) {
uint32_t reg = regData32(raddr); uint32_t reg = regData32(raddr);
pkt.set(reg); pkt->set(reg);
value = reg; value = reg;
} }
if (pkt.size == 8) { if (pkt->size == 8) {
uint64_t reg = regData64(raddr); uint64_t reg = regData64(raddr);
pkt.set(reg); pkt->set(reg);
value = reg; value = reg;
} }
DPRINTF(EthernetPIO, DPRINTF(EthernetPIO,
"read %s: cpu=%d vnic=%d da=%#x pa=%#x size=%d val=%#x\n", "read %s: cpu=%d vnic=%d da=%#x pa=%#x size=%d val=%#x\n",
info.name, cpu, index, daddr, pkt.addr, pkt.size, value); info.name, cpu, index, daddr, pkt->addr, pkt->size, value);
// reading the interrupt status register has the side effect of // reading the interrupt status register has the side effect of
// clearing it // clearing it
@ -400,57 +400,57 @@ Device::iprRead(Addr daddr, int cpu, uint64_t &result)
* I/O write of device register * I/O write of device register
*/ */
Tick Tick
Device::write(Packet &pkt) Device::write(Packet *pkt)
{ {
assert(config.command & PCI_CMD_MSE); assert(config.command & PCI_CMD_MSE);
assert(pkt.addr >= BARAddrs[0] && pkt.size < BARSize[0]); assert(pkt->addr >= BARAddrs[0] && pkt->size < BARSize[0]);
int cpu = pkt.req->getCpuNum(); int cpu = pkt->req->getCpuNum();
Addr daddr = pkt.addr - BARAddrs[0]; Addr daddr = pkt->addr - BARAddrs[0];
Addr index = daddr >> Regs::VirtualShift; Addr index = daddr >> Regs::VirtualShift;
Addr raddr = daddr & Regs::VirtualMask; Addr raddr = daddr & Regs::VirtualMask;
pkt.time += pioDelay; pkt->time += pioDelay;
if (!regValid(raddr)) if (!regValid(raddr))
panic("invalid register: cpu=%d, da=%#x pa=%#x size=%d", panic("invalid register: cpu=%d, da=%#x pa=%#x size=%d",
cpu, daddr, pkt.addr, pkt.size); cpu, daddr, pkt->addr, pkt->size);
const Regs::Info &info = regInfo(raddr); const Regs::Info &info = regInfo(raddr);
if (!info.write) if (!info.write)
panic("write %s (read only): " panic("write %s (read only): "
"cpu=%d vnic=%d da=%#x pa=%#x size=%d", "cpu=%d vnic=%d da=%#x pa=%#x size=%d",
info.name, cpu, index, daddr, pkt.addr, pkt.size); info.name, cpu, index, daddr, pkt->addr, pkt->size);
if (pkt.size != info.size) if (pkt->size != info.size)
panic("write %s (invalid size): " panic("write %s (invalid size): "
"cpu=%d vnic=%d da=%#x pa=%#x size=%d", "cpu=%d vnic=%d da=%#x pa=%#x size=%d",
info.name, cpu, index, daddr, pkt.addr, pkt.size); info.name, cpu, index, daddr, pkt->addr, pkt->size);
VirtualReg &vnic = virtualRegs[index]; VirtualReg &vnic = virtualRegs[index];
DPRINTF(EthernetPIO, DPRINTF(EthernetPIO,
"write %s vnic %d: cpu=%d val=%#x da=%#x pa=%#x size=%d\n", "write %s vnic %d: cpu=%d val=%#x da=%#x pa=%#x size=%d\n",
info.name, index, cpu, info.size == 4 ? pkt.get<uint32_t>() : info.name, index, cpu, info.size == 4 ? pkt->get<uint32_t>() :
pkt.get<uint64_t>(), daddr, pkt.addr, pkt.size); pkt->get<uint64_t>(), daddr, pkt->addr, pkt->size);
prepareWrite(cpu, index); prepareWrite(cpu, index);
switch (raddr) { switch (raddr) {
case Regs::Config: case Regs::Config:
changeConfig(pkt.get<uint32_t>()); changeConfig(pkt->get<uint32_t>());
break; break;
case Regs::Command: case Regs::Command:
command(pkt.get<uint32_t>()); command(pkt->get<uint32_t>());
break; break;
case Regs::IntrStatus: case Regs::IntrStatus:
devIntrClear(regs.IntrStatus & pkt.get<uint32_t>()); devIntrClear(regs.IntrStatus & pkt->get<uint32_t>());
break; break;
case Regs::IntrMask: case Regs::IntrMask:
devIntrChangeMask(pkt.get<uint32_t>()); devIntrChangeMask(pkt->get<uint32_t>());
break; break;
case Regs::RxData: case Regs::RxData:
@ -460,9 +460,9 @@ Device::write(Packet &pkt)
vnic.rxUnique = rxUnique++; vnic.rxUnique = rxUnique++;
vnic.RxDone = Regs::RxDone_Busy; vnic.RxDone = Regs::RxDone_Busy;
vnic.RxData = pkt.get<uint64_t>(); vnic.RxData = pkt->get<uint64_t>();
if (Regs::get_RxData_Vaddr(pkt.get<uint64_t>())) { if (Regs::get_RxData_Vaddr(pkt->get<uint64_t>())) {
panic("vtophys not implemented in newmem"); panic("vtophys not implemented in newmem");
/* Addr vaddr = Regs::get_RxData_Addr(reg64); /* Addr vaddr = Regs::get_RxData_Addr(reg64);
Addr paddr = vtophys(req->xc, vaddr); Addr paddr = vtophys(req->xc, vaddr);
@ -498,7 +498,7 @@ Device::write(Packet &pkt)
vnic.txUnique = txUnique++; vnic.txUnique = txUnique++;
vnic.TxDone = Regs::TxDone_Busy; vnic.TxDone = Regs::TxDone_Busy;
if (Regs::get_TxData_Vaddr(pkt.get<uint64_t>())) { if (Regs::get_TxData_Vaddr(pkt->get<uint64_t>())) {
panic("vtophys won't work here in newmem.\n"); panic("vtophys won't work here in newmem.\n");
/*Addr vaddr = Regs::get_TxData_Addr(reg64); /*Addr vaddr = Regs::get_TxData_Addr(reg64);
Addr paddr = vtophys(req->xc, vaddr); Addr paddr = vtophys(req->xc, vaddr);

View file

@ -262,8 +262,8 @@ class Device : public Base
* Memory Interface * Memory Interface
*/ */
public: public:
virtual Tick read(Packet &pkt); virtual Tick read(Packet *pkt);
virtual Tick write(Packet &pkt); virtual Tick write(Packet *pkt);
void prepareIO(int cpu, int index); void prepareIO(int cpu, int index);
void prepareRead(int cpu, int index); void prepareRead(int cpu, int index);

View file

@ -69,76 +69,76 @@ TsunamiCChip::TsunamiCChip(Params *p)
} }
Tick Tick
TsunamiCChip::read(Packet &pkt) TsunamiCChip::read(Packet *pkt)
{ {
DPRINTF(Tsunami, "read va=%#x size=%d\n", pkt.addr, pkt.size); DPRINTF(Tsunami, "read va=%#x size=%d\n", pkt->addr, pkt->size);
assert(pkt.result == Unknown); assert(pkt->result == Unknown);
assert(pkt.addr >= pioAddr && pkt.addr < pioAddr + pioSize); assert(pkt->addr >= pioAddr && pkt->addr < pioAddr + pioSize);
pkt.time += pioDelay; pkt->time += pioDelay;
Addr regnum = (pkt.addr - pioAddr) >> 6; Addr regnum = (pkt->addr - pioAddr) >> 6;
Addr daddr = (pkt.addr - pioAddr); Addr daddr = (pkt->addr - pioAddr);
pkt.allocate(); pkt->allocate();
switch (pkt.size) { switch (pkt->size) {
case sizeof(uint64_t): case sizeof(uint64_t):
if (daddr & TSDEV_CC_BDIMS) if (daddr & TSDEV_CC_BDIMS)
{ {
pkt.set(dim[(daddr >> 4) & 0x3F]); pkt->set(dim[(daddr >> 4) & 0x3F]);
break; break;
} }
if (daddr & TSDEV_CC_BDIRS) if (daddr & TSDEV_CC_BDIRS)
{ {
pkt.set(dir[(daddr >> 4) & 0x3F]); pkt->set(dir[(daddr >> 4) & 0x3F]);
break; break;
} }
switch(regnum) { switch(regnum) {
case TSDEV_CC_CSR: case TSDEV_CC_CSR:
pkt.set(0x0); pkt->set(0x0);
break; break;
case TSDEV_CC_MTR: case TSDEV_CC_MTR:
panic("TSDEV_CC_MTR not implemeted\n"); panic("TSDEV_CC_MTR not implemeted\n");
break; break;
case TSDEV_CC_MISC: case TSDEV_CC_MISC:
pkt.set((ipint << 8) & 0xF | (itint << 4) & 0xF | pkt->set((ipint << 8) & 0xF | (itint << 4) & 0xF |
(pkt.req->getCpuNum() & 0x3)); (pkt->req->getCpuNum() & 0x3));
break; break;
case TSDEV_CC_AAR0: case TSDEV_CC_AAR0:
case TSDEV_CC_AAR1: case TSDEV_CC_AAR1:
case TSDEV_CC_AAR2: case TSDEV_CC_AAR2:
case TSDEV_CC_AAR3: case TSDEV_CC_AAR3:
pkt.set(0); pkt->set(0);
break; break;
case TSDEV_CC_DIM0: case TSDEV_CC_DIM0:
pkt.set(dim[0]); pkt->set(dim[0]);
break; break;
case TSDEV_CC_DIM1: case TSDEV_CC_DIM1:
pkt.set(dim[1]); pkt->set(dim[1]);
break; break;
case TSDEV_CC_DIM2: case TSDEV_CC_DIM2:
pkt.set(dim[2]); pkt->set(dim[2]);
break; break;
case TSDEV_CC_DIM3: case TSDEV_CC_DIM3:
pkt.set(dim[3]); pkt->set(dim[3]);
break; break;
case TSDEV_CC_DIR0: case TSDEV_CC_DIR0:
pkt.set(dir[0]); pkt->set(dir[0]);
break; break;
case TSDEV_CC_DIR1: case TSDEV_CC_DIR1:
pkt.set(dir[1]); pkt->set(dir[1]);
break; break;
case TSDEV_CC_DIR2: case TSDEV_CC_DIR2:
pkt.set(dir[2]); pkt->set(dir[2]);
break; break;
case TSDEV_CC_DIR3: case TSDEV_CC_DIR3:
pkt.set(dir[3]); pkt->set(dir[3]);
break; break;
case TSDEV_CC_DRIR: case TSDEV_CC_DRIR:
pkt.set(drir); pkt->set(drir);
break; break;
case TSDEV_CC_PRBEN: case TSDEV_CC_PRBEN:
panic("TSDEV_CC_PRBEN not implemented\n"); panic("TSDEV_CC_PRBEN not implemented\n");
@ -156,10 +156,10 @@ TsunamiCChip::read(Packet &pkt)
panic("TSDEV_CC_MPRx not implemented\n"); panic("TSDEV_CC_MPRx not implemented\n");
break; break;
case TSDEV_CC_IPIR: case TSDEV_CC_IPIR:
pkt.set(ipint); pkt->set(ipint);
break; break;
case TSDEV_CC_ITIR: case TSDEV_CC_ITIR:
pkt.set(itint); pkt->set(itint);
break; break;
default: default:
panic("default in cchip read reached, accessing 0x%x\n"); panic("default in cchip read reached, accessing 0x%x\n");
@ -173,26 +173,26 @@ TsunamiCChip::read(Packet &pkt)
panic("invalid access size(?) for tsunami register!\n"); panic("invalid access size(?) for tsunami register!\n");
} }
DPRINTF(Tsunami, "Tsunami CChip: read regnum=%#x size=%d data=%lld\n", DPRINTF(Tsunami, "Tsunami CChip: read regnum=%#x size=%d data=%lld\n",
regnum, pkt.size, pkt.get<uint64_t>()); regnum, pkt->size, pkt->get<uint64_t>());
pkt.result = Success; pkt->result = Success;
return pioDelay; return pioDelay;
} }
Tick Tick
TsunamiCChip::write(Packet &pkt) TsunamiCChip::write(Packet *pkt)
{ {
pkt.time += pioDelay; pkt->time += pioDelay;
assert(pkt.addr >= pioAddr && pkt.addr < pioAddr + pioSize); assert(pkt->addr >= pioAddr && pkt->addr < pioAddr + pioSize);
Addr daddr = pkt.addr - pioAddr; Addr daddr = pkt->addr - pioAddr;
Addr regnum = (pkt.addr - pioAddr) >> 6 ; Addr regnum = (pkt->addr - pioAddr) >> 6 ;
assert(pkt.size == sizeof(uint64_t)); assert(pkt->size == sizeof(uint64_t));
DPRINTF(Tsunami, "write - addr=%#x value=%#x\n", pkt.addr, pkt.get<uint64_t>()); DPRINTF(Tsunami, "write - addr=%#x value=%#x\n", pkt->addr, pkt->get<uint64_t>());
bool supportedWrite = false; bool supportedWrite = false;
@ -207,7 +207,7 @@ TsunamiCChip::write(Packet &pkt)
olddim = dim[number]; olddim = dim[number];
olddir = dir[number]; olddir = dir[number];
dim[number] = pkt.get<uint64_t>(); dim[number] = pkt->get<uint64_t>();
dir[number] = dim[number] & drir; dir[number] = dim[number] & drir;
for(int x = 0; x < Tsunami::Max_CPUs; x++) for(int x = 0; x < Tsunami::Max_CPUs; x++)
{ {
@ -244,7 +244,7 @@ TsunamiCChip::write(Packet &pkt)
panic("TSDEV_CC_MTR write not implemented\n"); panic("TSDEV_CC_MTR write not implemented\n");
case TSDEV_CC_MISC: case TSDEV_CC_MISC:
uint64_t ipreq; uint64_t ipreq;
ipreq = (pkt.get<uint64_t>() >> 12) & 0xF; ipreq = (pkt->get<uint64_t>() >> 12) & 0xF;
//If it is bit 12-15, this is an IPI post //If it is bit 12-15, this is an IPI post
if (ipreq) { if (ipreq) {
reqIPI(ipreq); reqIPI(ipreq);
@ -253,7 +253,7 @@ TsunamiCChip::write(Packet &pkt)
//If it is bit 8-11, this is an IPI clear //If it is bit 8-11, this is an IPI clear
uint64_t ipintr; uint64_t ipintr;
ipintr = (pkt.get<uint64_t>() >> 8) & 0xF; ipintr = (pkt->get<uint64_t>() >> 8) & 0xF;
if (ipintr) { if (ipintr) {
clearIPI(ipintr); clearIPI(ipintr);
supportedWrite = true; supportedWrite = true;
@ -261,14 +261,14 @@ TsunamiCChip::write(Packet &pkt)
//If it is the 4-7th bit, clear the RTC interrupt //If it is the 4-7th bit, clear the RTC interrupt
uint64_t itintr; uint64_t itintr;
itintr = (pkt.get<uint64_t>() >> 4) & 0xF; itintr = (pkt->get<uint64_t>() >> 4) & 0xF;
if (itintr) { if (itintr) {
clearITI(itintr); clearITI(itintr);
supportedWrite = true; supportedWrite = true;
} }
// ignore NXMs // ignore NXMs
if (pkt.get<uint64_t>() & 0x10000000) if (pkt->get<uint64_t>() & 0x10000000)
supportedWrite = true; supportedWrite = true;
if(!supportedWrite) if(!supportedWrite)
@ -300,7 +300,7 @@ TsunamiCChip::write(Packet &pkt)
olddim = dim[number]; olddim = dim[number];
olddir = dir[number]; olddir = dir[number];
dim[number] = pkt.get<uint64_t>(); dim[number] = pkt->get<uint64_t>();
dir[number] = dim[number] & drir; dir[number] = dim[number] & drir;
for(int x = 0; x < 64; x++) for(int x = 0; x < 64; x++)
{ {
@ -350,19 +350,19 @@ TsunamiCChip::write(Packet &pkt)
case TSDEV_CC_MPR3: case TSDEV_CC_MPR3:
panic("TSDEV_CC_MPRx write not implemented\n"); panic("TSDEV_CC_MPRx write not implemented\n");
case TSDEV_CC_IPIR: case TSDEV_CC_IPIR:
clearIPI(pkt.get<uint64_t>()); clearIPI(pkt->get<uint64_t>());
break; break;
case TSDEV_CC_ITIR: case TSDEV_CC_ITIR:
clearITI(pkt.get<uint64_t>()); clearITI(pkt->get<uint64_t>());
break; break;
case TSDEV_CC_IPIQ: case TSDEV_CC_IPIQ:
reqIPI(pkt.get<uint64_t>()); reqIPI(pkt->get<uint64_t>());
break; break;
default: default:
panic("default in cchip read reached, accessing 0x%x\n"); panic("default in cchip read reached, accessing 0x%x\n");
} // swtich(regnum) } // swtich(regnum)
} // not BIG_TSUNAMI write } // not BIG_TSUNAMI write
pkt.result = Success; pkt->result = Success;
return pioDelay; return pioDelay;
} }

View file

@ -92,9 +92,9 @@ class TsunamiCChip : public BasicPioDevice
*/ */
TsunamiCChip(Params *p); TsunamiCChip(Params *p);
virtual Tick read(Packet &pkt); virtual Tick read(Packet *pkt);
virtual Tick write(Packet &pkt); virtual Tick write(Packet *pkt);
/** /**
* post an RTC interrupt to the CPU * post an RTC interrupt to the CPU

View file

@ -436,89 +436,89 @@ TsunamiIO::frequency() const
} }
Tick Tick
TsunamiIO::read(Packet &pkt) TsunamiIO::read(Packet *pkt)
{ {
assert(pkt.result == Unknown); assert(pkt->result == Unknown);
assert(pkt.addr >= pioAddr && pkt.addr < pioAddr + pioSize); assert(pkt->addr >= pioAddr && pkt->addr < pioAddr + pioSize);
pkt.time += pioDelay; pkt->time += pioDelay;
Addr daddr = pkt.addr - pioAddr; Addr daddr = pkt->addr - pioAddr;
DPRINTF(Tsunami, "io read va=%#x size=%d IOPorrt=%#x\n", pkt.addr, DPRINTF(Tsunami, "io read va=%#x size=%d IOPorrt=%#x\n", pkt->addr,
pkt.size, daddr); pkt->size, daddr);
pkt.allocate(); pkt->allocate();
if (pkt.size == sizeof(uint8_t)) { if (pkt->size == sizeof(uint8_t)) {
switch(daddr) { switch(daddr) {
// PIC1 mask read // PIC1 mask read
case TSDEV_PIC1_MASK: case TSDEV_PIC1_MASK:
pkt.set(~mask1); pkt->set(~mask1);
break; break;
case TSDEV_PIC2_MASK: case TSDEV_PIC2_MASK:
pkt.set(~mask2); pkt->set(~mask2);
break; break;
case TSDEV_PIC1_ISR: case TSDEV_PIC1_ISR:
// !!! If this is modified 64bit case needs to be too // !!! If this is modified 64bit case needs to be too
// Pal code has to do a 64 bit physical read because there is // Pal code has to do a 64 bit physical read because there is
// no load physical byte instruction // no load physical byte instruction
pkt.set(picr); pkt->set(picr);
break; break;
case TSDEV_PIC2_ISR: case TSDEV_PIC2_ISR:
// PIC2 not implemnted... just return 0 // PIC2 not implemnted... just return 0
pkt.set(0x00); pkt->set(0x00);
break; break;
case TSDEV_TMR0_DATA: case TSDEV_TMR0_DATA:
pitimer.counter0.read(pkt.getPtr<uint8_t>()); pitimer.counter0.read(pkt->getPtr<uint8_t>());
break; break;
case TSDEV_TMR1_DATA: case TSDEV_TMR1_DATA:
pitimer.counter1.read(pkt.getPtr<uint8_t>()); pitimer.counter1.read(pkt->getPtr<uint8_t>());
break; break;
case TSDEV_TMR2_DATA: case TSDEV_TMR2_DATA:
pitimer.counter2.read(pkt.getPtr<uint8_t>()); pitimer.counter2.read(pkt->getPtr<uint8_t>());
break; break;
case TSDEV_RTC_DATA: case TSDEV_RTC_DATA:
rtc.readData(pkt.getPtr<uint8_t>()); rtc.readData(pkt->getPtr<uint8_t>());
break; break;
case TSDEV_CTRL_PORTB: case TSDEV_CTRL_PORTB:
if (pitimer.counter2.outputHigh()) if (pitimer.counter2.outputHigh())
pkt.set(PORTB_SPKR_HIGH); pkt->set(PORTB_SPKR_HIGH);
else else
pkt.set(0x00); pkt->set(0x00);
break; break;
default: default:
panic("I/O Read - va%#x size %d\n", pkt.addr, pkt.size); panic("I/O Read - va%#x size %d\n", pkt->addr, pkt->size);
} }
} else if (pkt.size == sizeof(uint64_t)) { } else if (pkt->size == sizeof(uint64_t)) {
if (daddr == TSDEV_PIC1_ISR) if (daddr == TSDEV_PIC1_ISR)
pkt.set<uint64_t>(picr); pkt->set<uint64_t>(picr);
else else
panic("I/O Read - invalid addr - va %#x size %d\n", panic("I/O Read - invalid addr - va %#x size %d\n",
pkt.addr, pkt.size); pkt->addr, pkt->size);
} else { } else {
panic("I/O Read - invalid size - va %#x size %d\n", pkt.addr, pkt.size); panic("I/O Read - invalid size - va %#x size %d\n", pkt->addr, pkt->size);
} }
pkt.result = Success; pkt->result = Success;
return pioDelay; return pioDelay;
} }
Tick Tick
TsunamiIO::write(Packet &pkt) TsunamiIO::write(Packet *pkt)
{ {
pkt.time += pioDelay; pkt->time += pioDelay;
assert(pkt.result == Unknown); assert(pkt->result == Unknown);
assert(pkt.addr >= pioAddr && pkt.addr < pioAddr + pioSize); assert(pkt->addr >= pioAddr && pkt->addr < pioAddr + pioSize);
Addr daddr = pkt.addr - pioAddr; Addr daddr = pkt->addr - pioAddr;
DPRINTF(Tsunami, "io write - va=%#x size=%d IOPort=%#x Data=%#x\n", DPRINTF(Tsunami, "io write - va=%#x size=%d IOPort=%#x Data=%#x\n",
pkt.addr, pkt.size, pkt.addr & 0xfff, (uint32_t)pkt.get<uint8_t>()); pkt->addr, pkt->size, pkt->addr & 0xfff, (uint32_t)pkt->get<uint8_t>());
assert(pkt.size == sizeof(uint8_t)); assert(pkt->size == sizeof(uint8_t));
switch(daddr) { switch(daddr) {
case TSDEV_PIC1_MASK: case TSDEV_PIC1_MASK:
mask1 = ~(pkt.get<uint8_t>()); mask1 = ~(pkt->get<uint8_t>());
if ((picr & mask1) && !picInterrupting) { if ((picr & mask1) && !picInterrupting) {
picInterrupting = true; picInterrupting = true;
tsunami->cchip->postDRIR(55); tsunami->cchip->postDRIR(55);
@ -531,38 +531,38 @@ TsunamiIO::write(Packet &pkt)
} }
break; break;
case TSDEV_PIC2_MASK: case TSDEV_PIC2_MASK:
mask2 = pkt.get<uint8_t>(); mask2 = pkt->get<uint8_t>();
//PIC2 Not implemented to interrupt //PIC2 Not implemented to interrupt
break; break;
case TSDEV_PIC1_ACK: case TSDEV_PIC1_ACK:
// clear the interrupt on the PIC // clear the interrupt on the PIC
picr &= ~(1 << (pkt.get<uint8_t>() & 0xF)); picr &= ~(1 << (pkt->get<uint8_t>() & 0xF));
if (!(picr & mask1)) if (!(picr & mask1))
tsunami->cchip->clearDRIR(55); tsunami->cchip->clearDRIR(55);
break; break;
case TSDEV_DMA1_MODE: case TSDEV_DMA1_MODE:
mode1 = pkt.get<uint8_t>(); mode1 = pkt->get<uint8_t>();
break; break;
case TSDEV_DMA2_MODE: case TSDEV_DMA2_MODE:
mode2 = pkt.get<uint8_t>(); mode2 = pkt->get<uint8_t>();
break; break;
case TSDEV_TMR0_DATA: case TSDEV_TMR0_DATA:
pitimer.counter0.write(pkt.get<uint8_t>()); pitimer.counter0.write(pkt->get<uint8_t>());
break; break;
case TSDEV_TMR1_DATA: case TSDEV_TMR1_DATA:
pitimer.counter1.write(pkt.get<uint8_t>()); pitimer.counter1.write(pkt->get<uint8_t>());
break; break;
case TSDEV_TMR2_DATA: case TSDEV_TMR2_DATA:
pitimer.counter2.write(pkt.get<uint8_t>()); pitimer.counter2.write(pkt->get<uint8_t>());
break; break;
case TSDEV_TMR_CTRL: case TSDEV_TMR_CTRL:
pitimer.writeControl(pkt.get<uint8_t>()); pitimer.writeControl(pkt->get<uint8_t>());
break; break;
case TSDEV_RTC_ADDR: case TSDEV_RTC_ADDR:
rtc.writeAddr(pkt.get<uint8_t>()); rtc.writeAddr(pkt->get<uint8_t>());
break; break;
case TSDEV_RTC_DATA: case TSDEV_RTC_DATA:
rtc.writeData(pkt.get<uint8_t>()); rtc.writeData(pkt->get<uint8_t>());
break; break;
case TSDEV_KBD: case TSDEV_KBD:
case TSDEV_DMA1_CMND: case TSDEV_DMA1_CMND:
@ -577,10 +577,10 @@ TsunamiIO::write(Packet &pkt)
case TSDEV_CTRL_PORTB: case TSDEV_CTRL_PORTB:
break; break;
default: default:
panic("I/O Write - va%#x size %d data %#x\n", pkt.addr, pkt.size, pkt.get<uint8_t>()); panic("I/O Write - va%#x size %d data %#x\n", pkt->addr, pkt->size, pkt->get<uint8_t>());
} }
pkt.result = Success; pkt->result = Success;
return pioDelay; return pioDelay;
} }

View file

@ -318,8 +318,8 @@ class TsunamiIO : public BasicPioDevice
*/ */
TsunamiIO(Params *p); TsunamiIO(Params *p);
virtual Tick read(Packet &pkt); virtual Tick read(Packet *pkt);
virtual Tick write(Packet &pkt); virtual Tick write(Packet *pkt);
/** /**
* Post an PIC interrupt to the CPU via the CChip * Post an PIC interrupt to the CPU via the CChip

View file

@ -65,76 +65,76 @@ TsunamiPChip::TsunamiPChip(Params *p)
} }
Tick Tick
TsunamiPChip::read(Packet &pkt) TsunamiPChip::read(Packet *pkt)
{ {
assert(pkt.result == Unknown); assert(pkt->result == Unknown);
assert(pkt.addr >= pioAddr && pkt.addr < pioAddr + pioSize); assert(pkt->addr >= pioAddr && pkt->addr < pioAddr + pioSize);
pkt.time += pioDelay; pkt->time += pioDelay;
pkt.allocate(); pkt->allocate();
Addr daddr = (pkt.addr - pioAddr) >> 6;; Addr daddr = (pkt->addr - pioAddr) >> 6;;
assert(pkt.size == sizeof(uint64_t)); assert(pkt->size == sizeof(uint64_t));
DPRINTF(Tsunami, "read va=%#x size=%d\n", pkt.addr, pkt.size); DPRINTF(Tsunami, "read va=%#x size=%d\n", pkt->addr, pkt->size);
switch(daddr) { switch(daddr) {
case TSDEV_PC_WSBA0: case TSDEV_PC_WSBA0:
pkt.set(wsba[0]); pkt->set(wsba[0]);
break; break;
case TSDEV_PC_WSBA1: case TSDEV_PC_WSBA1:
pkt.set(wsba[1]); pkt->set(wsba[1]);
break; break;
case TSDEV_PC_WSBA2: case TSDEV_PC_WSBA2:
pkt.set(wsba[2]); pkt->set(wsba[2]);
break; break;
case TSDEV_PC_WSBA3: case TSDEV_PC_WSBA3:
pkt.set(wsba[3]); pkt->set(wsba[3]);
break; break;
case TSDEV_PC_WSM0: case TSDEV_PC_WSM0:
pkt.set(wsm[0]); pkt->set(wsm[0]);
break; break;
case TSDEV_PC_WSM1: case TSDEV_PC_WSM1:
pkt.set(wsm[1]); pkt->set(wsm[1]);
break; break;
case TSDEV_PC_WSM2: case TSDEV_PC_WSM2:
pkt.set(wsm[2]); pkt->set(wsm[2]);
break; break;
case TSDEV_PC_WSM3: case TSDEV_PC_WSM3:
pkt.set(wsm[3]); pkt->set(wsm[3]);
break; break;
case TSDEV_PC_TBA0: case TSDEV_PC_TBA0:
pkt.set(tba[0]); pkt->set(tba[0]);
break; break;
case TSDEV_PC_TBA1: case TSDEV_PC_TBA1:
pkt.set(tba[1]); pkt->set(tba[1]);
break; break;
case TSDEV_PC_TBA2: case TSDEV_PC_TBA2:
pkt.set(tba[2]); pkt->set(tba[2]);
break; break;
case TSDEV_PC_TBA3: case TSDEV_PC_TBA3:
pkt.set(tba[3]); pkt->set(tba[3]);
break; break;
case TSDEV_PC_PCTL: case TSDEV_PC_PCTL:
pkt.set(pctl); pkt->set(pctl);
break; break;
case TSDEV_PC_PLAT: case TSDEV_PC_PLAT:
panic("PC_PLAT not implemented\n"); panic("PC_PLAT not implemented\n");
case TSDEV_PC_RES: case TSDEV_PC_RES:
panic("PC_RES not implemented\n"); panic("PC_RES not implemented\n");
case TSDEV_PC_PERROR: case TSDEV_PC_PERROR:
pkt.set((uint64_t)0x00); pkt->set((uint64_t)0x00);
break; break;
case TSDEV_PC_PERRMASK: case TSDEV_PC_PERRMASK:
pkt.set((uint64_t)0x00); pkt->set((uint64_t)0x00);
break; break;
case TSDEV_PC_PERRSET: case TSDEV_PC_PERRSET:
panic("PC_PERRSET not implemented\n"); panic("PC_PERRSET not implemented\n");
case TSDEV_PC_TLBIV: case TSDEV_PC_TLBIV:
panic("PC_TLBIV not implemented\n"); panic("PC_TLBIV not implemented\n");
case TSDEV_PC_TLBIA: case TSDEV_PC_TLBIA:
pkt.set((uint64_t)0x00); // shouldn't be readable, but linux pkt->set((uint64_t)0x00); // shouldn't be readable, but linux
break; break;
case TSDEV_PC_PMONCTL: case TSDEV_PC_PMONCTL:
panic("PC_PMONCTL not implemented\n"); panic("PC_PMONCTL not implemented\n");
@ -143,63 +143,63 @@ TsunamiPChip::read(Packet &pkt)
default: default:
panic("Default in PChip Read reached reading 0x%x\n", daddr); panic("Default in PChip Read reached reading 0x%x\n", daddr);
} }
pkt.result = Success; pkt->result = Success;
return pioDelay; return pioDelay;
} }
Tick Tick
TsunamiPChip::write(Packet &pkt) TsunamiPChip::write(Packet *pkt)
{ {
pkt.time += pioDelay; pkt->time += pioDelay;
assert(pkt.result == Unknown); assert(pkt->result == Unknown);
assert(pkt.addr >= pioAddr && pkt.addr < pioAddr + pioSize); assert(pkt->addr >= pioAddr && pkt->addr < pioAddr + pioSize);
Addr daddr = (pkt.addr - pioAddr) >> 6; Addr daddr = (pkt->addr - pioAddr) >> 6;
assert(pkt.size == sizeof(uint64_t)); assert(pkt->size == sizeof(uint64_t));
DPRINTF(Tsunami, "write - va=%#x size=%d \n", pkt.addr, pkt.size); DPRINTF(Tsunami, "write - va=%#x size=%d \n", pkt->addr, pkt->size);
switch(daddr) { switch(daddr) {
case TSDEV_PC_WSBA0: case TSDEV_PC_WSBA0:
wsba[0] = pkt.get<uint64_t>(); wsba[0] = pkt->get<uint64_t>();
break; break;
case TSDEV_PC_WSBA1: case TSDEV_PC_WSBA1:
wsba[1] = pkt.get<uint64_t>(); wsba[1] = pkt->get<uint64_t>();
break; break;
case TSDEV_PC_WSBA2: case TSDEV_PC_WSBA2:
wsba[2] = pkt.get<uint64_t>(); wsba[2] = pkt->get<uint64_t>();
break; break;
case TSDEV_PC_WSBA3: case TSDEV_PC_WSBA3:
wsba[3] = pkt.get<uint64_t>(); wsba[3] = pkt->get<uint64_t>();
break; break;
case TSDEV_PC_WSM0: case TSDEV_PC_WSM0:
wsm[0] = pkt.get<uint64_t>(); wsm[0] = pkt->get<uint64_t>();
break; break;
case TSDEV_PC_WSM1: case TSDEV_PC_WSM1:
wsm[1] = pkt.get<uint64_t>(); wsm[1] = pkt->get<uint64_t>();
break; break;
case TSDEV_PC_WSM2: case TSDEV_PC_WSM2:
wsm[2] = pkt.get<uint64_t>(); wsm[2] = pkt->get<uint64_t>();
break; break;
case TSDEV_PC_WSM3: case TSDEV_PC_WSM3:
wsm[3] = pkt.get<uint64_t>(); wsm[3] = pkt->get<uint64_t>();
break; break;
case TSDEV_PC_TBA0: case TSDEV_PC_TBA0:
tba[0] = pkt.get<uint64_t>(); tba[0] = pkt->get<uint64_t>();
break; break;
case TSDEV_PC_TBA1: case TSDEV_PC_TBA1:
tba[1] = pkt.get<uint64_t>(); tba[1] = pkt->get<uint64_t>();
break; break;
case TSDEV_PC_TBA2: case TSDEV_PC_TBA2:
tba[2] = pkt.get<uint64_t>(); tba[2] = pkt->get<uint64_t>();
break; break;
case TSDEV_PC_TBA3: case TSDEV_PC_TBA3:
tba[3] = pkt.get<uint64_t>(); tba[3] = pkt->get<uint64_t>();
break; break;
case TSDEV_PC_PCTL: case TSDEV_PC_PCTL:
pctl = pkt.get<uint64_t>(); pctl = pkt->get<uint64_t>();
break; break;
case TSDEV_PC_PLAT: case TSDEV_PC_PLAT:
panic("PC_PLAT not implemented\n"); panic("PC_PLAT not implemented\n");
@ -224,7 +224,7 @@ TsunamiPChip::write(Packet &pkt)
} // uint64_t } // uint64_t
pkt.result = Success; pkt->result = Success;
return pioDelay; return pioDelay;
} }

View file

@ -78,8 +78,8 @@ class TsunamiPChip : public BasicPioDevice
*/ */
Addr translatePciToDma(Addr busAddr); Addr translatePciToDma(Addr busAddr);
virtual Tick read(Packet &pkt); virtual Tick read(Packet *pkt);
virtual Tick write(Packet &pkt); virtual Tick write(Packet *pkt);
/** /**
* Serialize this object to the given output stream. * Serialize this object to the given output stream.

View file

@ -108,15 +108,15 @@ Uart8250::Uart8250(Params *p)
} }
Tick Tick
Uart8250::read(Packet &pkt) Uart8250::read(Packet *pkt)
{ {
assert(pkt.result == Unknown); assert(pkt->result == Unknown);
assert(pkt.addr >= pioAddr && pkt.addr < pioAddr + pioSize); assert(pkt->addr >= pioAddr && pkt->addr < pioAddr + pioSize);
assert(pkt.size == 1); assert(pkt->size == 1);
pkt.time += pioDelay; pkt->time += pioDelay;
Addr daddr = pkt.addr - pioAddr; Addr daddr = pkt->addr - pioAddr;
pkt.allocate(); pkt->allocate();
DPRINTF(Uart, " read register %#x\n", daddr); DPRINTF(Uart, " read register %#x\n", daddr);
@ -124,9 +124,9 @@ Uart8250::read(Packet &pkt)
case 0x0: case 0x0:
if (!(LCR & 0x80)) { // read byte if (!(LCR & 0x80)) { // read byte
if (cons->dataAvailable()) if (cons->dataAvailable())
cons->in(*pkt.getPtr<uint8_t>()); cons->in(*pkt->getPtr<uint8_t>());
else { else {
pkt.set((uint8_t)0); pkt->set((uint8_t)0);
// A limited amount of these are ok. // A limited amount of these are ok.
DPRINTF(Uart, "empty read of RX register\n"); DPRINTF(Uart, "empty read of RX register\n");
} }
@ -141,7 +141,7 @@ Uart8250::read(Packet &pkt)
break; break;
case 0x1: case 0x1:
if (!(LCR & 0x80)) { // Intr Enable Register(IER) if (!(LCR & 0x80)) { // Intr Enable Register(IER)
pkt.set(IER); pkt->set(IER);
} else { // DLM divisor latch MSB } else { // DLM divisor latch MSB
; ;
} }
@ -150,17 +150,17 @@ Uart8250::read(Packet &pkt)
DPRINTF(Uart, "IIR Read, status = %#x\n", (uint32_t)status); DPRINTF(Uart, "IIR Read, status = %#x\n", (uint32_t)status);
if (status & RX_INT) /* Rx data interrupt has a higher priority */ if (status & RX_INT) /* Rx data interrupt has a higher priority */
pkt.set(IIR_RXID); pkt->set(IIR_RXID);
else if (status & TX_INT) else if (status & TX_INT)
pkt.set(IIR_TXID); pkt->set(IIR_TXID);
else else
pkt.set(IIR_NOPEND); pkt->set(IIR_NOPEND);
//Tx interrupts are cleared on IIR reads //Tx interrupts are cleared on IIR reads
status &= ~TX_INT; status &= ~TX_INT;
break; break;
case 0x3: // Line Control Register (LCR) case 0x3: // Line Control Register (LCR)
pkt.set(LCR); pkt->set(LCR);
break; break;
case 0x4: // Modem Control Register (MCR) case 0x4: // Modem Control Register (MCR)
break; break;
@ -171,13 +171,13 @@ Uart8250::read(Packet &pkt)
if (cons->dataAvailable()) if (cons->dataAvailable())
lsr = UART_LSR_DR; lsr = UART_LSR_DR;
lsr |= UART_LSR_TEMT | UART_LSR_THRE; lsr |= UART_LSR_TEMT | UART_LSR_THRE;
pkt.set(lsr); pkt->set(lsr);
break; break;
case 0x6: // Modem Status Register (MSR) case 0x6: // Modem Status Register (MSR)
pkt.set((uint8_t)0); pkt->set((uint8_t)0);
break; break;
case 0x7: // Scratch Register (SCR) case 0x7: // Scratch Register (SCR)
pkt.set((uint8_t)0); // doesn't exist with at 8250. pkt->set((uint8_t)0); // doesn't exist with at 8250.
break; break;
default: default:
panic("Tried to access a UART port that doesn't exist\n"); panic("Tried to access a UART port that doesn't exist\n");
@ -186,27 +186,27 @@ Uart8250::read(Packet &pkt)
/* uint32_t d32 = *data; /* uint32_t d32 = *data;
DPRINTF(Uart, "Register read to register %#x returned %#x\n", daddr, d32); DPRINTF(Uart, "Register read to register %#x returned %#x\n", daddr, d32);
*/ */
pkt.result = Success; pkt->result = Success;
return pioDelay; return pioDelay;
} }
Tick Tick
Uart8250::write(Packet &pkt) Uart8250::write(Packet *pkt)
{ {
assert(pkt.result == Unknown); assert(pkt->result == Unknown);
assert(pkt.addr >= pioAddr && pkt.addr < pioAddr + pioSize); assert(pkt->addr >= pioAddr && pkt->addr < pioAddr + pioSize);
assert(pkt.size == 1); assert(pkt->size == 1);
pkt.time += pioDelay; pkt->time += pioDelay;
Addr daddr = pkt.addr - pioAddr; Addr daddr = pkt->addr - pioAddr;
DPRINTF(Uart, " write register %#x value %#x\n", daddr, pkt.get<uint8_t>()); DPRINTF(Uart, " write register %#x value %#x\n", daddr, pkt->get<uint8_t>());
switch (daddr) { switch (daddr) {
case 0x0: case 0x0:
if (!(LCR & 0x80)) { // write byte if (!(LCR & 0x80)) { // write byte
cons->out(pkt.get<uint8_t>()); cons->out(pkt->get<uint8_t>());
platform->clearConsoleInt(); platform->clearConsoleInt();
status &= ~TX_INT; status &= ~TX_INT;
if (UART_IER_THRI & IER) if (UART_IER_THRI & IER)
@ -217,7 +217,7 @@ Uart8250::write(Packet &pkt)
break; break;
case 0x1: case 0x1:
if (!(LCR & 0x80)) { // Intr Enable Register(IER) if (!(LCR & 0x80)) { // Intr Enable Register(IER)
IER = pkt.get<uint8_t>(); IER = pkt->get<uint8_t>();
if (UART_IER_THRI & IER) if (UART_IER_THRI & IER)
{ {
DPRINTF(Uart, "IER: IER_THRI set, scheduling TX intrrupt\n"); DPRINTF(Uart, "IER: IER_THRI set, scheduling TX intrrupt\n");
@ -251,10 +251,10 @@ Uart8250::write(Packet &pkt)
case 0x2: // FIFO Control Register (FCR) case 0x2: // FIFO Control Register (FCR)
break; break;
case 0x3: // Line Control Register (LCR) case 0x3: // Line Control Register (LCR)
LCR = pkt.get<uint8_t>(); LCR = pkt->get<uint8_t>();
break; break;
case 0x4: // Modem Control Register (MCR) case 0x4: // Modem Control Register (MCR)
if (pkt.get<uint8_t>() == (UART_MCR_LOOP | 0x0A)) if (pkt->get<uint8_t>() == (UART_MCR_LOOP | 0x0A))
MCR = 0x9A; MCR = 0x9A;
break; break;
case 0x7: // Scratch Register (SCR) case 0x7: // Scratch Register (SCR)
@ -264,7 +264,7 @@ Uart8250::write(Packet &pkt)
panic("Tried to access a UART port that doesn't exist\n"); panic("Tried to access a UART port that doesn't exist\n");
break; break;
} }
pkt.result = Success; pkt->result = Success;
return pioDelay; return pioDelay;
} }

View file

@ -80,8 +80,8 @@ class Uart8250 : public Uart
public: public:
Uart8250(Params *p); Uart8250(Params *p);
virtual Tick read(Packet &pkt); virtual Tick read(Packet *pkt);
virtual Tick write(Packet &pkt); virtual Tick write(Packet *pkt);
virtual void addressRanges(AddrRangeList &range_list); virtual void addressRanges(AddrRangeList &range_list);

View file

@ -48,7 +48,7 @@ Bridge::init()
/** Function called by the port when the bus is recieving a Timing /** Function called by the port when the bus is recieving a Timing
* transaction.*/ * transaction.*/
bool bool
Bridge::recvTiming(Packet &pkt, Side id) Bridge::recvTiming(Packet *pkt, Side id)
{ {
if (blockedA && id == SideA) if (blockedA && id == SideA)
return false; return false;
@ -59,10 +59,10 @@ Bridge::recvTiming(Packet &pkt, Side id)
if (!sendEvent.scheduled()) if (!sendEvent.scheduled())
sendEvent.schedule(curTick + delay); sendEvent.schedule(curTick + delay);
if (id == SideA) { if (id == SideA) {
inboundA.push_back(std::make_pair<Packet*, Tick>(&pkt, curTick)); inboundA.push_back(std::make_pair<Packet*, Tick>(pkt, curTick));
blockCheck(SideA); blockCheck(SideA);
} else { } else {
inboundB.push_back(std::make_pair<Packet*, Tick>(&pkt, curTick)); inboundB.push_back(std::make_pair<Packet*, Tick>(pkt, curTick));
blockCheck(SideB); blockCheck(SideB);
} }
} else { } else {
@ -134,16 +134,16 @@ void Bridge::timerEvent()
void void
Bridge::BridgePort::sendPkt(Packet &pkt) Bridge::BridgePort::sendPkt(Packet *pkt)
{ {
if (!sendTiming(pkt)) if (!sendTiming(pkt))
outbound.push_back(std::make_pair<Packet*,Tick>(&pkt, curTick)); outbound.push_back(std::make_pair<Packet*,Tick>(pkt, curTick));
} }
void void
Bridge::BridgePort::sendPkt(std::pair<Packet*, Tick> p) Bridge::BridgePort::sendPkt(std::pair<Packet*, Tick> p)
{ {
if (!sendTiming(*p.first)) if (!sendTiming(p.first))
outbound.push_back(p); outbound.push_back(p);
} }
@ -163,9 +163,9 @@ Bridge::BridgePort::recvRetry()
/** Function called by the port when the bus is recieving a Atomic /** Function called by the port when the bus is recieving a Atomic
* transaction.*/ * transaction.*/
Tick Tick
Bridge::recvAtomic(Packet &pkt, Side id) Bridge::recvAtomic(Packet *pkt, Side id)
{ {
pkt.time += delay; pkt->time += delay;
if (id == SideA) if (id == SideA)
return sideB->sendAtomic(pkt); return sideB->sendAtomic(pkt);
@ -176,33 +176,33 @@ Bridge::recvAtomic(Packet &pkt, Side id)
/** Function called by the port when the bus is recieving a Functional /** Function called by the port when the bus is recieving a Functional
* transaction.*/ * transaction.*/
void void
Bridge::recvFunctional(Packet &pkt, Side id) Bridge::recvFunctional(Packet *pkt, Side id)
{ {
pkt.time += delay; pkt->time += delay;
std::list<std::pair<Packet*, Tick> >::iterator i; std::list<std::pair<Packet*, Tick> >::iterator i;
bool pktContinue = true; bool pktContinue = true;
for(i = inboundA.begin(); i != inboundA.end(); ++i) { for(i = inboundA.begin(); i != inboundA.end(); ++i) {
if (pkt.intersect(i->first)) { if (pkt->intersect(i->first)) {
pktContinue &= fixPacket(pkt, *i->first); pktContinue &= fixPacket(pkt, i->first);
} }
} }
for(i = inboundB.begin(); i != inboundB.end(); ++i) { for(i = inboundB.begin(); i != inboundB.end(); ++i) {
if (pkt.intersect(i->first)) { if (pkt->intersect(i->first)) {
pktContinue &= fixPacket(pkt, *i->first); pktContinue &= fixPacket(pkt, i->first);
} }
} }
for(i = sideA->outbound.begin(); i != sideA->outbound.end(); ++i) { for(i = sideA->outbound.begin(); i != sideA->outbound.end(); ++i) {
if (pkt.intersect(i->first)) { if (pkt->intersect(i->first)) {
pktContinue &= fixPacket(pkt, *i->first); pktContinue &= fixPacket(pkt, i->first);
} }
} }
for(i = sideB->outbound.begin(); i != sideB->outbound.end(); ++i) { for(i = sideB->outbound.begin(); i != sideB->outbound.end(); ++i) {
if (pkt.intersect(i->first)) { if (pkt->intersect(i->first)) {
pktContinue &= fixPacket(pkt, *i->first); pktContinue &= fixPacket(pkt, i->first);
} }
} }

View file

@ -56,15 +56,15 @@ class Bridge : public MemObject
protected: protected:
/** Function called by the port when the bus is recieving a Timing /** Function called by the port when the bus is recieving a Timing
transaction.*/ transaction.*/
bool recvTiming(Packet &pkt, Side id); bool recvTiming(Packet *pkt, Side id);
/** Function called by the port when the bus is recieving a Atomic /** Function called by the port when the bus is recieving a Atomic
transaction.*/ transaction.*/
Tick recvAtomic(Packet &pkt, Side id); Tick recvAtomic(Packet *pkt, Side id);
/** Function called by the port when the bus is recieving a Functional /** Function called by the port when the bus is recieving a Functional
transaction.*/ transaction.*/
void recvFunctional(Packet &pkt, Side id); void recvFunctional(Packet *pkt, Side id);
/** Function called by the port when the bus is recieving a status change.*/ /** Function called by the port when the bus is recieving a status change.*/
void recvStatusChange(Port::Status status, Side id); void recvStatusChange(Port::Status status, Side id);
@ -104,12 +104,12 @@ class Bridge : public MemObject
/** Data this is waiting to be transmitted. */ /** Data this is waiting to be transmitted. */
std::list<std::pair<Packet*, Tick> > outbound; std::list<std::pair<Packet*, Tick> > outbound;
void sendPkt(Packet &pkt); void sendPkt(Packet *pkt);
void sendPkt(std::pair<Packet*, Tick> p); void sendPkt(std::pair<Packet*, Tick> p);
/** When reciving a timing request from the peer port, /** When reciving a timing request from the peer port,
pass it to the bridge. */ pass it to the bridge. */
virtual bool recvTiming(Packet &pkt) virtual bool recvTiming(Packet *pkt)
{ return bridge->recvTiming(pkt, side); } { return bridge->recvTiming(pkt, side); }
/** When reciving a retry request from the peer port, /** When reciving a retry request from the peer port,
@ -118,12 +118,12 @@ class Bridge : public MemObject
/** When reciving a Atomic requestfrom the peer port, /** When reciving a Atomic requestfrom the peer port,
pass it to the bridge. */ pass it to the bridge. */
virtual Tick recvAtomic(Packet &pkt) virtual Tick recvAtomic(Packet *pkt)
{ return bridge->recvAtomic(pkt, side); } { return bridge->recvAtomic(pkt, side); }
/** When reciving a Functional request from the peer port, /** When reciving a Functional request from the peer port,
pass it to the bridge. */ pass it to the bridge. */
virtual void recvFunctional(Packet &pkt) virtual void recvFunctional(Packet *pkt)
{ bridge->recvFunctional(pkt, side); } { bridge->recvFunctional(pkt, side); }
/** When reciving a status changefrom the peer port, /** When reciving a status changefrom the peer port,

View file

@ -48,14 +48,14 @@ Bus::init()
/** Function called by the port when the bus is recieving a Timing /** Function called by the port when the bus is recieving a Timing
* transaction.*/ * transaction.*/
bool bool
Bus::recvTiming(Packet &pkt) Bus::recvTiming(Packet *pkt)
{ {
Port *port; Port *port;
if (pkt.dest == Packet::Broadcast) { if (pkt->dest == Packet::Broadcast) {
port = findPort(pkt.addr, pkt.src); port = findPort(pkt->addr, pkt->src);
} else { } else {
assert(pkt.dest > 0 && pkt.dest < interfaces.size()); assert(pkt->dest > 0 && pkt->dest < interfaces.size());
port = interfaces[pkt.dest]; port = interfaces[pkt->dest];
} }
return port->sendTiming(pkt); return port->sendTiming(pkt);
} }
@ -89,19 +89,19 @@ Bus::findPort(Addr addr, int id)
/** Function called by the port when the bus is recieving a Atomic /** Function called by the port when the bus is recieving a Atomic
* transaction.*/ * transaction.*/
Tick Tick
Bus::recvAtomic(Packet &pkt) Bus::recvAtomic(Packet *pkt)
{ {
assert(pkt.dest == Packet::Broadcast); assert(pkt->dest == Packet::Broadcast);
return findPort(pkt.addr, pkt.src)->sendAtomic(pkt); return findPort(pkt->addr, pkt->src)->sendAtomic(pkt);
} }
/** Function called by the port when the bus is recieving a Functional /** Function called by the port when the bus is recieving a Functional
* transaction.*/ * transaction.*/
void void
Bus::recvFunctional(Packet &pkt) Bus::recvFunctional(Packet *pkt)
{ {
assert(pkt.dest == Packet::Broadcast); assert(pkt->dest == Packet::Broadcast);
findPort(pkt.addr, pkt.src)->sendFunctional(pkt); findPort(pkt->addr, pkt->src)->sendFunctional(pkt);
} }
/** Function called by the port when the bus is recieving a status change.*/ /** Function called by the port when the bus is recieving a status change.*/

View file

@ -57,15 +57,15 @@ class Bus : public MemObject
/** Function called by the port when the bus is recieving a Timing /** Function called by the port when the bus is recieving a Timing
transaction.*/ transaction.*/
bool recvTiming(Packet &pkt); bool recvTiming(Packet *pkt);
/** Function called by the port when the bus is recieving a Atomic /** Function called by the port when the bus is recieving a Atomic
transaction.*/ transaction.*/
Tick recvAtomic(Packet &pkt); Tick recvAtomic(Packet *pkt);
/** Function called by the port when the bus is recieving a Functional /** Function called by the port when the bus is recieving a Functional
transaction.*/ transaction.*/
void recvFunctional(Packet &pkt); void recvFunctional(Packet *pkt);
/** Function called by the port when the bus is recieving a status change.*/ /** Function called by the port when the bus is recieving a status change.*/
void recvStatusChange(Port::Status status, int id); void recvStatusChange(Port::Status status, int id);
@ -108,18 +108,18 @@ class Bus : public MemObject
/** When reciving a timing request from the peer port (at id), /** When reciving a timing request from the peer port (at id),
pass it to the bus. */ pass it to the bus. */
virtual bool recvTiming(Packet &pkt) virtual bool recvTiming(Packet *pkt)
{ pkt.src = id; return bus->recvTiming(pkt); } { pkt->src = id; return bus->recvTiming(pkt); }
/** When reciving a Atomic requestfrom the peer port (at id), /** When reciving a Atomic requestfrom the peer port (at id),
pass it to the bus. */ pass it to the bus. */
virtual Tick recvAtomic(Packet &pkt) virtual Tick recvAtomic(Packet *pkt)
{ pkt.src = id; return bus->recvAtomic(pkt); } { pkt->src = id; return bus->recvAtomic(pkt); }
/** When reciving a Functional requestfrom the peer port (at id), /** When reciving a Functional requestfrom the peer port (at id),
pass it to the bus. */ pass it to the bus. */
virtual void recvFunctional(Packet &pkt) virtual void recvFunctional(Packet *pkt)
{ pkt.src = id; bus->recvFunctional(pkt); } { pkt->src = id; bus->recvFunctional(pkt); }
/** When reciving a status changefrom the peer port (at id), /** When reciving a status changefrom the peer port (at id),
pass it to the bus. */ pass it to the bus. */

View file

@ -90,5 +90,5 @@ Packet::reset() {
bool fixPacket(Packet &func, Packet &timing) bool fixPacket(Packet *func, Packet *timing)
{ panic("Need to implement!"); } { panic("Need to implement!"); }

View file

@ -190,5 +190,5 @@ struct Packet
bool intersect(Packet *p); bool intersect(Packet *p);
}; };
bool fixPacket(Packet &func, Packet &timing); bool fixPacket(Packet *func, Packet *timing);
#endif //__MEM_PACKET_HH #endif //__MEM_PACKET_HH

View file

@ -50,7 +50,7 @@
using namespace std; using namespace std;
using namespace TheISA; using namespace TheISA;
PhysicalMemory::MemResponseEvent::MemResponseEvent(Packet &pkt, MemoryPort* _m) PhysicalMemory::MemResponseEvent::MemResponseEvent(Packet *pkt, MemoryPort* _m)
: Event(&mainEventQueue, CPU_Tick_Pri), pkt(pkt), memoryPort(_m) : Event(&mainEventQueue, CPU_Tick_Pri), pkt(pkt), memoryPort(_m)
{ {
@ -123,11 +123,11 @@ PhysicalMemory::deviceBlockSize()
} }
bool bool
PhysicalMemory::doTimingAccess (Packet &pkt, MemoryPort* memoryPort) PhysicalMemory::doTimingAccess (Packet *pkt, MemoryPort* memoryPort)
{ {
doFunctionalAccess(pkt); doFunctionalAccess(pkt);
pkt.dest = pkt.src; pkt->dest = pkt->src;
MemResponseEvent* response = new MemResponseEvent(pkt, memoryPort); MemResponseEvent* response = new MemResponseEvent(pkt, memoryPort);
response->schedule(curTick + lat); response->schedule(curTick + lat);
@ -135,32 +135,32 @@ PhysicalMemory::doTimingAccess (Packet &pkt, MemoryPort* memoryPort)
} }
Tick Tick
PhysicalMemory::doAtomicAccess(Packet &pkt) PhysicalMemory::doAtomicAccess(Packet *pkt)
{ {
doFunctionalAccess(pkt); doFunctionalAccess(pkt);
pkt.time = curTick + lat; pkt->time = curTick + lat;
return curTick + lat; return curTick + lat;
} }
void void
PhysicalMemory::doFunctionalAccess(Packet &pkt) PhysicalMemory::doFunctionalAccess(Packet *pkt)
{ {
assert(pkt.addr + pkt.size < pmem_size); assert(pkt->addr + pkt->size < pmem_size);
switch (pkt.cmd) { switch (pkt->cmd) {
case Read: case Read:
memcpy(pkt.getPtr<uint8_t>(), pmem_addr + pkt.addr - base_addr, memcpy(pkt->getPtr<uint8_t>(), pmem_addr + pkt->addr - base_addr,
pkt.size); pkt->size);
break; break;
case Write: case Write:
memcpy(pmem_addr + pkt.addr - base_addr, pkt.getPtr<uint8_t>(), memcpy(pmem_addr + pkt->addr - base_addr, pkt->getPtr<uint8_t>(),
pkt.size); pkt->size);
break; break;
default: default:
panic("unimplemented"); panic("unimplemented");
} }
pkt.result = Success; pkt->result = Success;
} }
Port * Port *
@ -216,19 +216,19 @@ PhysicalMemory::MemoryPort::deviceBlockSize()
} }
bool bool
PhysicalMemory::MemoryPort::recvTiming(Packet &pkt) PhysicalMemory::MemoryPort::recvTiming(Packet *pkt)
{ {
return memory->doTimingAccess(pkt, this); return memory->doTimingAccess(pkt, this);
} }
Tick Tick
PhysicalMemory::MemoryPort::recvAtomic(Packet &pkt) PhysicalMemory::MemoryPort::recvAtomic(Packet *pkt)
{ {
return memory->doAtomicAccess(pkt); return memory->doAtomicAccess(pkt);
} }
void void
PhysicalMemory::MemoryPort::recvFunctional(Packet &pkt) PhysicalMemory::MemoryPort::recvFunctional(Packet *pkt)
{ {
memory->doFunctionalAccess(pkt); memory->doFunctionalAccess(pkt);
} }

View file

@ -55,11 +55,11 @@ class PhysicalMemory : public MemObject
protected: protected:
virtual bool recvTiming(Packet &pkt); virtual bool recvTiming(Packet *pkt);
virtual Tick recvAtomic(Packet &pkt); virtual Tick recvAtomic(Packet *pkt);
virtual void recvFunctional(Packet &pkt); virtual void recvFunctional(Packet *pkt);
virtual void recvStatusChange(Status status); virtual void recvStatusChange(Status status);
@ -74,10 +74,10 @@ class PhysicalMemory : public MemObject
struct MemResponseEvent : public Event struct MemResponseEvent : public Event
{ {
Packet &pkt; Packet *pkt;
MemoryPort *memoryPort; MemoryPort *memoryPort;
MemResponseEvent(Packet &pkt, MemoryPort *memoryPort); MemResponseEvent(Packet *pkt, MemoryPort *memoryPort);
void process(); void process();
const char *description(); const char *description();
}; };
@ -112,9 +112,9 @@ class PhysicalMemory : public MemObject
// fast back-door memory access for vtophys(), remote gdb, etc. // fast back-door memory access for vtophys(), remote gdb, etc.
// uint64_t phys_read_qword(Addr addr) const; // uint64_t phys_read_qword(Addr addr) const;
private: private:
bool doTimingAccess(Packet &pkt, MemoryPort *memoryPort); bool doTimingAccess(Packet *pkt, MemoryPort *memoryPort);
Tick doAtomicAccess(Packet &pkt); Tick doAtomicAccess(Packet *pkt);
void doFunctionalAccess(Packet &pkt); void doFunctionalAccess(Packet *pkt);
void recvStatusChange(Port::Status status); void recvStatusChange(Port::Status status);

View file

@ -48,7 +48,7 @@ Port::blobHelper(Addr addr, uint8_t *p, int size, Command cmd)
req.setPaddr(pkt.addr = gen.addr()); req.setPaddr(pkt.addr = gen.addr());
req.setSize(pkt.size = gen.size()); req.setSize(pkt.size = gen.size());
pkt.dataStatic(p); pkt.dataStatic(p);
sendFunctional(pkt); sendFunctional(&pkt);
p += gen.size(); p += gen.size();
} }
} }

View file

@ -106,13 +106,13 @@ class Port
* called by a peer port, never directly by any outside object. */ * called by a peer port, never directly by any outside object. */
/** Called to recive a timing call from the peer port. */ /** Called to recive a timing call from the peer port. */
virtual bool recvTiming(Packet &pkt) = 0; virtual bool recvTiming(Packet *pkt) = 0;
/** Called to recive a atomic call from the peer port. */ /** Called to recive a atomic call from the peer port. */
virtual Tick recvAtomic(Packet &pkt) = 0; virtual Tick recvAtomic(Packet *pkt) = 0;
/** Called to recive a functional call from the peer port. */ /** Called to recive a functional call from the peer port. */
virtual void recvFunctional(Packet &pkt) = 0; virtual void recvFunctional(Packet *pkt) = 0;
/** Called to recieve a status change from the peer port. */ /** Called to recieve a status change from the peer port. */
virtual void recvStatusChange(Status status) = 0; virtual void recvStatusChange(Status status) = 0;
@ -150,13 +150,13 @@ class Port
case a cache has a higher priority request come in while waiting for case a cache has a higher priority request come in while waiting for
the bus to arbitrate. the bus to arbitrate.
*/ */
bool sendTiming(Packet &pkt) { return peer->recvTiming(pkt); } bool sendTiming(Packet *pkt) { return peer->recvTiming(pkt); }
/** Function called by the associated device to send an atomic access, /** Function called by the associated device to send an atomic access,
an access in which the data is moved and the state is updated in one an access in which the data is moved and the state is updated in one
cycle, without interleaving with other memory accesses. cycle, without interleaving with other memory accesses.
*/ */
Tick sendAtomic(Packet &pkt) Tick sendAtomic(Packet *pkt)
{ return peer->recvAtomic(pkt); } { return peer->recvAtomic(pkt); }
/** Function called by the associated device to send a functional access, /** Function called by the associated device to send a functional access,
@ -164,7 +164,7 @@ class Port
memory system, without affecting the current state of any block or memory system, without affecting the current state of any block or
moving the block. moving the block.
*/ */
void sendFunctional(Packet &pkt) void sendFunctional(Packet *pkt)
{ return peer->recvFunctional(pkt); } { return peer->recvFunctional(pkt); }
/** Called by the associated device to send a status change to the device /** Called by the associated device to send a status change to the device
@ -224,9 +224,9 @@ class Port
class FunctionalPort : public Port class FunctionalPort : public Port
{ {
public: public:
virtual bool recvTiming(Packet &pkt) { panic("FuncPort is UniDir"); } virtual bool recvTiming(Packet *pkt) { panic("FuncPort is UniDir"); }
virtual Tick recvAtomic(Packet &pkt) { panic("FuncPort is UniDir"); } virtual Tick recvAtomic(Packet *pkt) { panic("FuncPort is UniDir"); }
virtual void recvFunctional(Packet &pkt) { panic("FuncPort is UniDir"); } virtual void recvFunctional(Packet *pkt) { panic("FuncPort is UniDir"); }
virtual void recvStatusChange(Status status) {} virtual void recvStatusChange(Status status) {}
template <typename T> template <typename T>