summaryrefslogtreecommitdiff
path: root/src/dev
diff options
context:
space:
mode:
authorSteve Reinhardt <stever@eecs.umich.edu>2006-08-30 16:24:26 -0700
committerSteve Reinhardt <stever@eecs.umich.edu>2006-08-30 16:24:26 -0700
commitf9ae0dcf1065454ca3d08512cd36a2dad9f08b2d (patch)
tree37e20bde0e0098eca99969f975c055d50cb65914 /src/dev
parenta8a7ce2b886ca2571f9470a48a4f12302f9cc830 (diff)
downloadgem5-f9ae0dcf1065454ca3d08512cd36a2dad9f08b2d.tar.xz
Move more common functionality into SimpleTimingPort,
allowing derived classes to be simplified. --HG-- extra : convert_revision : c980d3aec5e6c044d8f41e96252726fe9a256605
Diffstat (limited to 'src/dev')
-rw-r--r--src/dev/io_device.cc24
-rw-r--r--src/dev/io_device.hh22
-rw-r--r--src/dev/pcidev.cc32
-rw-r--r--src/dev/pcidev.hh14
4 files changed, 8 insertions, 84 deletions
diff --git a/src/dev/io_device.cc b/src/dev/io_device.cc
index b06e8b85d..408d8de3e 100644
--- a/src/dev/io_device.cc
+++ b/src/dev/io_device.cc
@@ -37,20 +37,14 @@
PioPort::PioPort(PioDevice *dev, System *s, std::string pname)
- : SimpleTimingPort(dev->name() + pname), device(dev), sys(s)
+ : SimpleTimingPort(dev->name() + pname), device(dev)
{ }
Tick
PioPort::recvAtomic(Packet *pkt)
{
- return device->recvAtomic(pkt);
-}
-
-void
-PioPort::recvFunctional(Packet *pkt)
-{
- device->recvAtomic(pkt);
+ return pkt->isRead() ? device->read(pkt) : device->write(pkt);
}
void
@@ -61,20 +55,6 @@ PioPort::getDeviceAddressRanges(AddrRangeList &resp, AddrRangeList &snoop)
}
-bool
-PioPort::recvTiming(Packet *pkt)
-{
- if (pkt->result == Packet::Nacked) {
- resendNacked(pkt);
- } else {
- Tick latency = device->recvAtomic(pkt);
- // turn packet around to go back to requester
- pkt->makeTimingResponse();
- sendTiming(pkt, latency);
- }
- return true;
-}
-
PioDevice::~PioDevice()
{
if (pioPort)
diff --git a/src/dev/io_device.hh b/src/dev/io_device.hh
index d91304301..df4f494cb 100644
--- a/src/dev/io_device.hh
+++ b/src/dev/io_device.hh
@@ -56,28 +56,14 @@ class PioPort : public SimpleTimingPort
/** The device that this port serves. */
PioDevice *device;
- /** The system that device/port are in. This is used to select which mode
- * we are currently operating in. */
- System *sys;
-
- /** The current status of the peer(bus) that we are connected to. */
- Status peerStatus;
-
- virtual bool recvTiming(Packet *pkt);
-
virtual Tick recvAtomic(Packet *pkt);
- virtual void recvFunctional(Packet *pkt) ;
-
- virtual void recvStatusChange(Status status)
- { peerStatus = status; }
-
virtual void getDeviceAddressRanges(AddrRangeList &resp,
AddrRangeList &snoop);
public:
- PioPort(PioDevice *dev, System *s, std::string pname = "-pioport");
+ PioPort(PioDevice *dev, System *s, std::string pname = "-pioport");
};
@@ -172,12 +158,6 @@ class PioDevice : public MemObject
virtual void addressRanges(AddrRangeList &range_list) = 0;
- /** As far as the devices are concerned they only accept atomic
- * transactions which are converted to either a write or a
- * read. */
- Tick recvAtomic(Packet *pkt)
- { return pkt->isRead() ? this->read(pkt) : this->write(pkt); }
-
/** Pure virtual function that the device must implement. Called
* when a read command is recieved by the port.
* @param pkt Packet describing this request
diff --git a/src/dev/pcidev.cc b/src/dev/pcidev.cc
index a8fb44c39..8ea22cb24 100644
--- a/src/dev/pcidev.cc
+++ b/src/dev/pcidev.cc
@@ -57,8 +57,8 @@ using namespace std;
PciDev::PciConfigPort::PciConfigPort(PciDev *dev, int busid, int devid,
int funcid, Platform *p)
- : PioPort(dev,p->system,"-pciconf"), device(dev), platform(p),
- busId(busid), deviceId(devid), functionId(funcid)
+ : SimpleTimingPort(dev->name() + "-pciconf"), device(dev), platform(p),
+ busId(busid), deviceId(devid), functionId(funcid)
{
configAddr = platform->calcConfigAddr(busId, deviceId, functionId);
}
@@ -70,16 +70,7 @@ PciDev::PciConfigPort::recvAtomic(Packet *pkt)
assert(pkt->result == Packet::Unknown);
assert(pkt->getAddr() >= configAddr &&
pkt->getAddr() < configAddr + PCI_CONFIG_SIZE);
- return device->recvConfig(pkt);
-}
-
-void
-PciDev::PciConfigPort::recvFunctional(Packet *pkt)
-{
- assert(pkt->result == Packet::Unknown);
- assert(pkt->getAddr() >= configAddr &&
- pkt->getAddr() < configAddr + PCI_CONFIG_SIZE);
- device->recvConfig(pkt);
+ return pkt->isRead() ? device->readConfig(pkt) : device->writeConfig(pkt);
}
void
@@ -91,23 +82,6 @@ PciDev::PciConfigPort::getDeviceAddressRanges(AddrRangeList &resp,
}
-bool
-PciDev::PciConfigPort::recvTiming(Packet *pkt)
-{
- if (pkt->result == Packet::Nacked) {
- resendNacked(pkt);
- } else {
- assert(pkt->result == Packet::Unknown);
- assert(pkt->getAddr() >= configAddr &&
- pkt->getAddr() < configAddr + PCI_CONFIG_SIZE);
- Tick latency = device->recvConfig(pkt);
- // turn packet around to go back to requester
- pkt->makeTimingResponse();
- sendTiming(pkt, latency);
- }
- return true;
-}
-
PciDev::PciDev(Params *p)
: DmaDevice(p), plat(p->platform), configData(p->configData),
pioDelay(p->pio_delay), configDelay(p->config_delay),
diff --git a/src/dev/pcidev.hh b/src/dev/pcidev.hh
index 8e4f003b0..22dd6296e 100644
--- a/src/dev/pcidev.hh
+++ b/src/dev/pcidev.hh
@@ -78,17 +78,13 @@ class PciConfigData : public SimObject
*/
class PciDev : public DmaDevice
{
- class PciConfigPort : public PioPort
+ class PciConfigPort : public SimpleTimingPort
{
protected:
PciDev *device;
- virtual bool recvTiming(Packet *pkt);
-
virtual Tick recvAtomic(Packet *pkt);
- virtual void recvFunctional(Packet *pkt) ;
-
virtual void getDeviceAddressRanges(AddrRangeList &resp,
AddrRangeList &snoop);
@@ -102,9 +98,7 @@ class PciDev : public DmaDevice
public:
PciConfigPort(PciDev *dev, int busid, int devid, int funcid,
- Platform *p);
-
- friend class PioPort::SendEvent;
+ Platform *p);
};
public:
@@ -239,10 +233,6 @@ class PciDev : public DmaDevice
*/
void addressRanges(AddrRangeList &range_list);
- /** Do a PCI Configspace memory access. */
- Tick recvConfig(Packet *pkt)
- { return pkt->isRead() ? readConfig(pkt) : writeConfig(pkt); }
-
/**
* Constructor for PCI Dev. This function copies data from the
* config file object PCIConfigData and registers the device with