summaryrefslogtreecommitdiff
path: root/src/dev/pcidev.hh
diff options
context:
space:
mode:
authorSteve Reinhardt <stever@eecs.umich.edu>2006-08-28 10:28:31 -0700
committerSteve Reinhardt <stever@eecs.umich.edu>2006-08-28 10:28:31 -0700
commitacfa88f7321241c3053d884843d3f4c56ef2c84f (patch)
treef52967650046a75b0592063d7b5e2d008d2b9701 /src/dev/pcidev.hh
parent55bde23071c0bf78b6e5c5a1a5adc0d41dabe4e7 (diff)
downloadgem5-acfa88f7321241c3053d884843d3f4c56ef2c84f.tar.xz
Cleanup: formatting, comments, DPRINTFs.
--HG-- extra : convert_revision : 565ab099f1c0744a13959e721c19dd03b7630f04
Diffstat (limited to 'src/dev/pcidev.hh')
-rw-r--r--src/dev/pcidev.hh30
1 files changed, 24 insertions, 6 deletions
diff --git a/src/dev/pcidev.hh b/src/dev/pcidev.hh
index 847fb07d0..ccc875d32 100644
--- a/src/dev/pcidev.hh
+++ b/src/dev/pcidev.hh
@@ -78,7 +78,7 @@ class PciConfigData : public SimObject
/**
- * PCI device, base implemnation is only config space.
+ * PCI device, base implementation is only config space.
*/
class PciDev : public DmaDevice
{
@@ -93,7 +93,8 @@ class PciDev : public DmaDevice
virtual void recvFunctional(Packet *pkt) ;
- virtual void getDeviceAddressRanges(AddrRangeList &resp, AddrRangeList &snoop);
+ virtual void getDeviceAddressRanges(AddrRangeList &resp,
+ AddrRangeList &snoop);
Platform *platform;
@@ -107,7 +108,7 @@ class PciDev : public DmaDevice
PciConfigPort(PciDev *dev, int busid, int devid, int funcid,
Platform *p);
- friend class PioPort::SendEvent;
+ friend class PioPort::SendEvent;
};
public:
@@ -151,6 +152,10 @@ class PciDev : public DmaDevice
/** The current address mapping of the BARs */
Addr BARAddrs[6];
+ /**
+ * Does the given address lie within the space mapped by the given
+ * base address register?
+ */
bool
isBAR(Addr addr, int bar) const
{
@@ -158,6 +163,10 @@ class PciDev : public DmaDevice
return BARAddrs[bar] <= addr && addr < BARAddrs[bar] + BARSize[bar];
}
+ /**
+ * Which base address register (if any) maps the given address?
+ * @return The BAR number (0-5 inclusive), or -1 if none.
+ */
int
getBAR(Addr addr)
{
@@ -168,14 +177,23 @@ class PciDev : public DmaDevice
return -1;
}
+ /**
+ * Which base address register (if any) maps the given address?
+ * @param addr The address to check.
+ * @retval bar The BAR number (0-5 inclusive),
+ * only valid if return value is true.
+ * @retval offs The offset from the base address,
+ * only valid if return value is true.
+ * @return True iff address maps to a base address register's region.
+ */
bool
- getBAR(Addr paddr, Addr &daddr, int &bar)
+ getBAR(Addr addr, int &bar, Addr &offs)
{
- int b = getBAR(paddr);
+ int b = getBAR(addr);
if (b < 0)
return false;
- daddr = paddr - BARAddrs[b];
+ offs = addr - BARAddrs[b];
bar = b;
return true;
}