changeset fa129bdae71d in /z/repo/gem5
details: http://repo.gem5.org/gem5?cmd=changeset;node=fa129bdae71d
description:
dev: Don't access the platform directly in PCI devices
Cleanup PCI devices to avoid using the PciDevice::platform pointer
directly. The PCI-specific functionality provided by the Platform
should be accessed through the wrappers in PciDevice.
diffstat:
src/dev/copy_engine.cc | 20 ++++++++++----------
src/dev/i8254xGBe.hh | 2 +-
src/dev/pcidev.hh | 4 +++-
src/dev/sinic.cc | 6 ++----
4 files changed, 16 insertions(+), 16 deletions(-)
diffs (116 lines):
diff -r b1bd4afb6b16 -r fa129bdae71d src/dev/copy_engine.cc
--- a/src/dev/copy_engine.cc Fri Nov 06 03:26:50 2015 -0500
+++ b/src/dev/copy_engine.cc Mon Nov 09 13:44:04 2015 +0000
@@ -445,14 +445,14 @@
anDq();
anBegin("FetchDescriptor");
DPRINTF(DMACopyEngine, "Reading descriptor from at memory location
%#x(%#x)\n",
- address, ce->platform->pciToDma(address));
+ address, ce->pciToDma(address));
assert(address);
busy = true;
DPRINTF(DMACopyEngine, "dmaAction: %#x, %d bytes, to addr %#x\n",
- ce->platform->pciToDma(address), sizeof(DmaDesc), curDmaDesc);
+ ce->pciToDma(address), sizeof(DmaDesc), curDmaDesc);
- cePort.dmaAction(MemCmd::ReadReq, ce->platform->pciToDma(address),
+ cePort.dmaAction(MemCmd::ReadReq, ce->pciToDma(address),
sizeof(DmaDesc), &fetchCompleteEvent,
(uint8_t*)curDmaDesc, latBeforeBegin);
lastDescriptorAddr = address;
@@ -495,8 +495,8 @@
anBegin("ReadCopyBytes");
DPRINTF(DMACopyEngine, "Reading %d bytes from buffer to memory location
%#x(%#x)\n",
curDmaDesc->len, curDmaDesc->dest,
- ce->platform->pciToDma(curDmaDesc->src));
- cePort.dmaAction(MemCmd::ReadReq, ce->platform->pciToDma(curDmaDesc->src),
+ ce->pciToDma(curDmaDesc->src));
+ cePort.dmaAction(MemCmd::ReadReq, ce->pciToDma(curDmaDesc->src),
curDmaDesc->len, &readCompleteEvent, copyBuffer, 0);
}
@@ -516,9 +516,9 @@
anBegin("WriteCopyBytes");
DPRINTF(DMACopyEngine, "Writing %d bytes from buffer to memory location
%#x(%#x)\n",
curDmaDesc->len, curDmaDesc->dest,
- ce->platform->pciToDma(curDmaDesc->dest));
+ ce->pciToDma(curDmaDesc->dest));
- cePort.dmaAction(MemCmd::WriteReq,
ce->platform->pciToDma(curDmaDesc->dest),
+ cePort.dmaAction(MemCmd::WriteReq, ce->pciToDma(curDmaDesc->dest),
curDmaDesc->len, &writeCompleteEvent, copyBuffer, 0);
ce->bytesCopied[channelId] += curDmaDesc->len;
@@ -585,10 +585,10 @@
anBegin("WriteCompletionStatus");
DPRINTF(DMACopyEngine, "Writing completion status %#x to address
%#x(%#x)\n",
completionDataReg, cr.completionAddr,
- ce->platform->pciToDma(cr.completionAddr));
+ ce->pciToDma(cr.completionAddr));
cePort.dmaAction(MemCmd::WriteReq,
- ce->platform->pciToDma(cr.completionAddr),
+ ce->pciToDma(cr.completionAddr),
sizeof(completionDataReg), &statusCompleteEvent,
(uint8_t*)&completionDataReg, latAfterCompletion);
}
@@ -607,7 +607,7 @@
DPRINTF(DMACopyEngine, "Fetching next address...\n");
busy = true;
cePort.dmaAction(MemCmd::ReadReq,
- ce->platform->pciToDma(address + offsetof(DmaDesc, next)),
+ ce->pciToDma(address + offsetof(DmaDesc, next)),
sizeof(Addr), &addrCompleteEvent,
(uint8_t*)curDmaDesc + offsetof(DmaDesc, next), 0);
}
diff -r b1bd4afb6b16 -r fa129bdae71d src/dev/i8254xGBe.hh
--- a/src/dev/i8254xGBe.hh Fri Nov 06 03:26:50 2015 -0500
+++ b/src/dev/i8254xGBe.hh Mon Nov 09 13:44:04 2015 +0000
@@ -263,7 +263,7 @@
EthPacketPtr pktPtr;
/** Shortcut for DMA address translation */
- Addr pciToDma(Addr a) { return igbe->platform->pciToDma(a); }
+ Addr pciToDma(Addr a) { return igbe->pciToDma(a); }
public:
/** Annotate sm*/
diff -r b1bd4afb6b16 -r fa129bdae71d src/dev/pcidev.hh
--- a/src/dev/pcidev.hh Fri Nov 06 03:26:50 2015 -0500
+++ b/src/dev/pcidev.hh Mon Nov 09 13:44:04 2015 +0000
@@ -190,8 +190,10 @@
return true;
}
+ private:
+ Platform *platform;
+
protected:
- Platform *platform;
Tick pioDelay;
Tick configDelay;
PciConfigPort configPort;
diff -r b1bd4afb6b16 -r fa129bdae71d src/dev/sinic.cc
--- a/src/dev/sinic.cc Fri Nov 06 03:26:50 2015 -0500
+++ b/src/dev/sinic.cc Mon Nov 09 13:44:04 2015 +0000
@@ -871,8 +871,7 @@
if (dmaPending() || drainState() != DrainState::Running)
goto exit;
- rxDmaAddr = params()->platform->pciToDma(
- Regs::get_RxData_Addr(vnic->RxData));
+ rxDmaAddr = pciToDma(Regs::get_RxData_Addr(vnic->RxData));
rxDmaLen = min<unsigned>(Regs::get_RxData_Len(vnic->RxData),
vnic->rxPacketBytes);
@@ -1071,8 +1070,7 @@
if (dmaPending() || drainState() != DrainState::Running)
goto exit;
- txDmaAddr = params()->platform->pciToDma(
- Regs::get_TxData_Addr(vnic->TxData));
+ txDmaAddr = pciToDma(Regs::get_TxData_Addr(vnic->TxData));
txDmaLen = Regs::get_TxData_Len(vnic->TxData);
txDmaData = txPacket->data + txPacketOffset;
txState = txCopy;
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev