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.
This commit is contained in:
parent
324bc9771d
commit
c62fe43ba9
4 changed files with 16 additions and 16 deletions
|
@ -445,14 +445,14 @@ CopyEngine::CopyEngineChannel::fetchDescriptor(Addr address)
|
||||||
anDq();
|
anDq();
|
||||||
anBegin("FetchDescriptor");
|
anBegin("FetchDescriptor");
|
||||||
DPRINTF(DMACopyEngine, "Reading descriptor from at memory location %#x(%#x)\n",
|
DPRINTF(DMACopyEngine, "Reading descriptor from at memory location %#x(%#x)\n",
|
||||||
address, ce->platform->pciToDma(address));
|
address, ce->pciToDma(address));
|
||||||
assert(address);
|
assert(address);
|
||||||
busy = true;
|
busy = true;
|
||||||
|
|
||||||
DPRINTF(DMACopyEngine, "dmaAction: %#x, %d bytes, to addr %#x\n",
|
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,
|
sizeof(DmaDesc), &fetchCompleteEvent,
|
||||||
(uint8_t*)curDmaDesc, latBeforeBegin);
|
(uint8_t*)curDmaDesc, latBeforeBegin);
|
||||||
lastDescriptorAddr = address;
|
lastDescriptorAddr = address;
|
||||||
|
@ -495,8 +495,8 @@ CopyEngine::CopyEngineChannel::readCopyBytes()
|
||||||
anBegin("ReadCopyBytes");
|
anBegin("ReadCopyBytes");
|
||||||
DPRINTF(DMACopyEngine, "Reading %d bytes from buffer to memory location %#x(%#x)\n",
|
DPRINTF(DMACopyEngine, "Reading %d bytes from buffer to memory location %#x(%#x)\n",
|
||||||
curDmaDesc->len, curDmaDesc->dest,
|
curDmaDesc->len, curDmaDesc->dest,
|
||||||
ce->platform->pciToDma(curDmaDesc->src));
|
ce->pciToDma(curDmaDesc->src));
|
||||||
cePort.dmaAction(MemCmd::ReadReq, ce->platform->pciToDma(curDmaDesc->src),
|
cePort.dmaAction(MemCmd::ReadReq, ce->pciToDma(curDmaDesc->src),
|
||||||
curDmaDesc->len, &readCompleteEvent, copyBuffer, 0);
|
curDmaDesc->len, &readCompleteEvent, copyBuffer, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -516,9 +516,9 @@ CopyEngine::CopyEngineChannel::writeCopyBytes()
|
||||||
anBegin("WriteCopyBytes");
|
anBegin("WriteCopyBytes");
|
||||||
DPRINTF(DMACopyEngine, "Writing %d bytes from buffer to memory location %#x(%#x)\n",
|
DPRINTF(DMACopyEngine, "Writing %d bytes from buffer to memory location %#x(%#x)\n",
|
||||||
curDmaDesc->len, curDmaDesc->dest,
|
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);
|
curDmaDesc->len, &writeCompleteEvent, copyBuffer, 0);
|
||||||
|
|
||||||
ce->bytesCopied[channelId] += curDmaDesc->len;
|
ce->bytesCopied[channelId] += curDmaDesc->len;
|
||||||
|
@ -585,10 +585,10 @@ CopyEngine::CopyEngineChannel::writeCompletionStatus()
|
||||||
anBegin("WriteCompletionStatus");
|
anBegin("WriteCompletionStatus");
|
||||||
DPRINTF(DMACopyEngine, "Writing completion status %#x to address %#x(%#x)\n",
|
DPRINTF(DMACopyEngine, "Writing completion status %#x to address %#x(%#x)\n",
|
||||||
completionDataReg, cr.completionAddr,
|
completionDataReg, cr.completionAddr,
|
||||||
ce->platform->pciToDma(cr.completionAddr));
|
ce->pciToDma(cr.completionAddr));
|
||||||
|
|
||||||
cePort.dmaAction(MemCmd::WriteReq,
|
cePort.dmaAction(MemCmd::WriteReq,
|
||||||
ce->platform->pciToDma(cr.completionAddr),
|
ce->pciToDma(cr.completionAddr),
|
||||||
sizeof(completionDataReg), &statusCompleteEvent,
|
sizeof(completionDataReg), &statusCompleteEvent,
|
||||||
(uint8_t*)&completionDataReg, latAfterCompletion);
|
(uint8_t*)&completionDataReg, latAfterCompletion);
|
||||||
}
|
}
|
||||||
|
@ -607,7 +607,7 @@ CopyEngine::CopyEngineChannel::fetchNextAddr(Addr address)
|
||||||
DPRINTF(DMACopyEngine, "Fetching next address...\n");
|
DPRINTF(DMACopyEngine, "Fetching next address...\n");
|
||||||
busy = true;
|
busy = true;
|
||||||
cePort.dmaAction(MemCmd::ReadReq,
|
cePort.dmaAction(MemCmd::ReadReq,
|
||||||
ce->platform->pciToDma(address + offsetof(DmaDesc, next)),
|
ce->pciToDma(address + offsetof(DmaDesc, next)),
|
||||||
sizeof(Addr), &addrCompleteEvent,
|
sizeof(Addr), &addrCompleteEvent,
|
||||||
(uint8_t*)curDmaDesc + offsetof(DmaDesc, next), 0);
|
(uint8_t*)curDmaDesc + offsetof(DmaDesc, next), 0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -263,7 +263,7 @@ class IGbE : public EtherDevice
|
||||||
EthPacketPtr pktPtr;
|
EthPacketPtr pktPtr;
|
||||||
|
|
||||||
/** Shortcut for DMA address translation */
|
/** Shortcut for DMA address translation */
|
||||||
Addr pciToDma(Addr a) { return igbe->platform->pciToDma(a); }
|
Addr pciToDma(Addr a) { return igbe->pciToDma(a); }
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/** Annotate sm*/
|
/** Annotate sm*/
|
||||||
|
|
|
@ -190,8 +190,10 @@ class PciDevice : public DmaDevice
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
private:
|
||||||
Platform *platform;
|
Platform *platform;
|
||||||
|
|
||||||
|
protected:
|
||||||
Tick pioDelay;
|
Tick pioDelay;
|
||||||
Tick configDelay;
|
Tick configDelay;
|
||||||
PciConfigPort configPort;
|
PciConfigPort configPort;
|
||||||
|
|
|
@ -871,8 +871,7 @@ Device::rxKick()
|
||||||
if (dmaPending() || drainState() != DrainState::Running)
|
if (dmaPending() || drainState() != DrainState::Running)
|
||||||
goto exit;
|
goto exit;
|
||||||
|
|
||||||
rxDmaAddr = params()->platform->pciToDma(
|
rxDmaAddr = pciToDma(Regs::get_RxData_Addr(vnic->RxData));
|
||||||
Regs::get_RxData_Addr(vnic->RxData));
|
|
||||||
rxDmaLen = min<unsigned>(Regs::get_RxData_Len(vnic->RxData),
|
rxDmaLen = min<unsigned>(Regs::get_RxData_Len(vnic->RxData),
|
||||||
vnic->rxPacketBytes);
|
vnic->rxPacketBytes);
|
||||||
|
|
||||||
|
@ -1071,8 +1070,7 @@ Device::txKick()
|
||||||
if (dmaPending() || drainState() != DrainState::Running)
|
if (dmaPending() || drainState() != DrainState::Running)
|
||||||
goto exit;
|
goto exit;
|
||||||
|
|
||||||
txDmaAddr = params()->platform->pciToDma(
|
txDmaAddr = pciToDma(Regs::get_TxData_Addr(vnic->TxData));
|
||||||
Regs::get_TxData_Addr(vnic->TxData));
|
|
||||||
txDmaLen = Regs::get_TxData_Len(vnic->TxData);
|
txDmaLen = Regs::get_TxData_Len(vnic->TxData);
|
||||||
txDmaData = txPacket->data + txPacketOffset;
|
txDmaData = txPacket->data + txPacketOffset;
|
||||||
txState = txCopy;
|
txState = txCopy;
|
||||||
|
|
Loading…
Reference in a new issue