summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/dev/Ide.py2
-rw-r--r--src/dev/arm/realview.cc6
-rw-r--r--src/dev/ide_ctrl.cc16
-rw-r--r--src/dev/ide_ctrl.hh2
-rw-r--r--src/dev/pcidev.cc3
5 files changed, 23 insertions, 6 deletions
diff --git a/src/dev/Ide.py b/src/dev/Ide.py
index a396c9690..7d97c42b6 100644
--- a/src/dev/Ide.py
+++ b/src/dev/Ide.py
@@ -64,3 +64,5 @@ class IdeController(PciDevice):
BAR3Size = '4B'
BAR4Size = '16B'
+ io_shift = Param.UInt32(0x0, "IO port shift");
+ ctrl_offset = Param.UInt32(0x0, "IDE disk control offset")
diff --git a/src/dev/arm/realview.cc b/src/dev/arm/realview.cc
index 303c40912..b27c3e58d 100644
--- a/src/dev/arm/realview.cc
+++ b/src/dev/arm/realview.cc
@@ -108,15 +108,13 @@ RealView::pciToDma(Addr pciAddr) const
Addr
RealView::calcPciConfigAddr(int bus, int dev, int func)
{
- panic("Need implementation\n");
- M5_DUMMY_RETURN
+ return ULL(-1);
}
Addr
RealView::calcPciIOAddr(Addr addr)
{
- panic("Need implementation\n");
- M5_DUMMY_RETURN
+ return addr;
}
Addr
diff --git a/src/dev/ide_ctrl.cc b/src/dev/ide_ctrl.cc
index 87dc0b2aa..4bbad883d 100644
--- a/src/dev/ide_ctrl.cc
+++ b/src/dev/ide_ctrl.cc
@@ -84,7 +84,8 @@ IdeController::IdeController(Params *p)
primaryTiming(htole(timeRegWithDecodeEn)),
secondaryTiming(htole(timeRegWithDecodeEn)),
deviceTiming(0), udmaControl(0), udmaTiming(0), ideConfig(0),
- ioEnabled(false), bmEnabled(false)
+ ioEnabled(false), bmEnabled(false),
+ ioShift(p->io_shift), ctrlOffset(p->ctrl_offset)
{
if (params()->disks.size() > 3)
panic("IDE controllers support a maximum of 4 devices attached!\n");
@@ -106,6 +107,15 @@ IdeController::IdeController(Params *p)
primary.select(false);
secondary.select(false);
+ if ((BARAddrs[0] & ~BAR_IO_MASK) != 0){
+ primary.cmdAddr = BARAddrs[0]; primary.cmdSize = BARSize[0];
+ primary.ctrlAddr = BARAddrs[1]; primary.ctrlSize = BARAddrs[1];
+ }
+ if ((BARAddrs[2] & ~BAR_IO_MASK) != 0){
+ secondary.cmdAddr = BARAddrs[2]; secondary.cmdSize = BARSize[2];
+ secondary.ctrlAddr = BARAddrs[3]; secondary.ctrlSize = BARAddrs[3];
+ }
+
ioEnabled = (config.command & htole(PCI_CMD_IOSE));
bmEnabled = (config.command & htole(PCI_CMD_BME));
}
@@ -441,10 +451,14 @@ IdeController::dispatchAccess(PacketPtr pkt, bool read)
if (addr >= primary.cmdAddr &&
addr < (primary.cmdAddr + primary.cmdSize)) {
addr -= primary.cmdAddr;
+ // linux may have shifted the address by ioShift,
+ // here we shift it back, similarly for ctrlOffset.
+ addr >>= ioShift;
primary.accessCommand(addr, size, dataPtr, read);
} else if (addr >= primary.ctrlAddr &&
addr < (primary.ctrlAddr + primary.ctrlSize)) {
addr -= primary.ctrlAddr;
+ addr += ctrlOffset;
primary.accessControl(addr, size, dataPtr, read);
} else if (addr >= secondary.cmdAddr &&
addr < (secondary.cmdAddr + secondary.cmdSize)) {
diff --git a/src/dev/ide_ctrl.hh b/src/dev/ide_ctrl.hh
index 89dc1ee9d..430b3fc1b 100644
--- a/src/dev/ide_ctrl.hh
+++ b/src/dev/ide_ctrl.hh
@@ -133,6 +133,8 @@ class IdeController : public PciDev
bool ioEnabled;
bool bmEnabled;
+ uint32_t ioShift, ctrlOffset;
+
void dispatchAccess(PacketPtr pkt, bool read);
public:
diff --git a/src/dev/pcidev.cc b/src/dev/pcidev.cc
index 26286c208..db68a3799 100644
--- a/src/dev/pcidev.cc
+++ b/src/dev/pcidev.cc
@@ -76,7 +76,8 @@ PciDev::PciConfigPort::getDeviceAddressRanges(AddrRangeList &resp,
bool &snoop)
{
snoop = false;;
- resp.push_back(RangeSize(configAddr, PCI_CONFIG_SIZE+1));
+ if (configAddr != ULL(-1))
+ resp.push_back(RangeSize(configAddr, PCI_CONFIG_SIZE+1));
}