diff options
author | Ali Saidi <Ali.Saidi@ARM.com> | 2010-11-15 14:04:03 -0600 |
---|---|---|
committer | Ali Saidi <Ali.Saidi@ARM.com> | 2010-11-15 14:04:03 -0600 |
commit | d7b8efa0df98db9a41038ce4588c006ff4a56d38 (patch) | |
tree | e74e7121b5c73415e80fdb44a92030e6c8f8223b | |
parent | 13931b9b827abd8a9fba5cb4448b69066746637c (diff) | |
download | gem5-d7b8efa0df98db9a41038ce4588c006ff4a56d38.tar.xz |
ARM: Add support for a dumb IDE controller
-rw-r--r-- | configs/common/FSConfig.py | 10 | ||||
-rw-r--r-- | src/dev/Ide.py | 2 | ||||
-rw-r--r-- | src/dev/arm/realview.cc | 6 | ||||
-rw-r--r-- | src/dev/ide_ctrl.cc | 16 | ||||
-rw-r--r-- | src/dev/ide_ctrl.hh | 2 | ||||
-rw-r--r-- | src/dev/pcidev.cc | 3 |
6 files changed, 33 insertions, 6 deletions
diff --git a/configs/common/FSConfig.py b/configs/common/FSConfig.py index fe57b5cab..53ab06813 100644 --- a/configs/common/FSConfig.py +++ b/configs/common/FSConfig.py @@ -209,6 +209,16 @@ def makeLinuxArmSystem(mem_mode, mdesc = None, bare_metal=False, self.mem_mode = mem_mode + #self.cf0 = CowIdeDisk(driveID='master') + #self.cf0.childImage(mdesc.disk()) + #self.cf_ctrl = IdeController(disks=[self.cf0], + # pci_func = 0, pci_dev = 0, pci_bus = 0, + # io_shift = 1, ctrl_offset = 2, Command = 0x1, + # BAR0 = 0x18000000, BAR0Size = '16B', + # BAR1 = 0x18000100, BAR1Size = '1B', + # BAR0LegacyIO = True, BAR1LegacyIO = True,) + #self.cf_ctrl.pio = self.iobus.port + if machine_type == "RealView_PBX": self.realview = RealViewPBX() elif machine_type == "RealView_EB": 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)); } |