From 139c97c9772be38577eaa52af5d1ef3607da4bcb Mon Sep 17 00:00:00 2001 From: Andreas Sandberg Date: Thu, 10 Dec 2015 10:35:15 +0000 Subject: [PATCH] dev: Move existing PCI device functionality to src/dev/pci Move pcidev.(hh|cc) to src/dev/pci/device.(hh|cc) and update existing devices to use the new header location. This also renames the PCIDEV debug flag to have a capitalization that is consistent with the PCI host and other devices. --HG-- rename : src/dev/Pci.py => src/dev/pci/PciDevice.py rename : src/dev/pcidev.cc => src/dev/pci/device.cc rename : src/dev/pcidev.hh => src/dev/pci/device.hh rename : src/dev/pcireg.h => src/dev/pci/pcireg.h --- src/dev/CopyEngine.py | 2 +- src/dev/Ethernet.py | 2 +- src/dev/Ide.py | 2 +- src/dev/SConscript | 3 --- src/dev/alpha/tsunami_pchip.cc | 2 +- src/dev/copy_engine.hh | 2 +- src/dev/etherdevice.hh | 2 +- src/dev/i8254xGBe.hh | 2 +- src/dev/ide_ctrl.hh | 3 +-- src/dev/{Pci.py => pci/PciDevice.py} | 2 +- src/dev/pci/SConscript | 13 +++++++++++-- src/dev/{pcidev.cc => pci/device.cc} | 19 ++++++++++--------- src/dev/{pcidev.hh => pci/device.hh} | 8 ++++---- src/dev/pci/host.cc | 2 +- src/dev/{ => pci}/pcireg.h | 0 src/dev/sinic.hh | 2 +- src/dev/virtio/VirtIO.py | 2 +- src/dev/virtio/pci.hh | 2 +- 18 files changed, 38 insertions(+), 32 deletions(-) rename src/dev/{Pci.py => pci/PciDevice.py} (99%) rename src/dev/{pcidev.cc => pci/device.cc} (98%) rename src/dev/{pcidev.hh => pci/device.hh} (98%) rename src/dev/{ => pci}/pcireg.h (100%) diff --git a/src/dev/CopyEngine.py b/src/dev/CopyEngine.py index d56294d66..2db9746d1 100644 --- a/src/dev/CopyEngine.py +++ b/src/dev/CopyEngine.py @@ -29,7 +29,7 @@ from m5.SimObject import SimObject from m5.params import * from m5.proxy import * -from Pci import PciDevice +from PciDevice import PciDevice class CopyEngine(PciDevice): type = 'CopyEngine' diff --git a/src/dev/Ethernet.py b/src/dev/Ethernet.py index 84fa0ae00..89d1bad89 100644 --- a/src/dev/Ethernet.py +++ b/src/dev/Ethernet.py @@ -41,7 +41,7 @@ from m5.SimObject import SimObject from m5.params import * from m5.proxy import * -from Pci import PciDevice +from PciDevice import PciDevice class EtherObject(SimObject): type = 'EtherObject' diff --git a/src/dev/Ide.py b/src/dev/Ide.py index c5eef9f54..4d3da1971 100644 --- a/src/dev/Ide.py +++ b/src/dev/Ide.py @@ -28,7 +28,7 @@ from m5.SimObject import SimObject from m5.params import * -from Pci import PciDevice +from PciDevice import PciDevice class IdeID(Enum): vals = ['master', 'slave'] diff --git a/src/dev/SConscript b/src/dev/SConscript index f2a172287..923417078 100644 --- a/src/dev/SConscript +++ b/src/dev/SConscript @@ -45,7 +45,6 @@ SimObject('DiskImage.py') SimObject('Ethernet.py') SimObject('I2C.py') SimObject('Ide.py') -SimObject('Pci.py') SimObject('Platform.py') SimObject('SimpleDisk.py') SimObject('Terminal.py') @@ -73,7 +72,6 @@ Source('ide_disk.cc') Source('intel_8254_timer.cc') Source('mc146818.cc') Source('ns_gige.cc') -Source('pcidev.cc') Source('pixelpump.cc') Source('pktfifo.cc') Source('platform.cc') @@ -103,7 +101,6 @@ DebugFlag('IdeCtrl') DebugFlag('IdeDisk') DebugFlag('Intel8254Timer') DebugFlag('MC146818') -DebugFlag('PCIDEV') DebugFlag('SimpleDisk') DebugFlag('SimpleDiskData') DebugFlag('Terminal') diff --git a/src/dev/alpha/tsunami_pchip.cc b/src/dev/alpha/tsunami_pchip.cc index fa3d9d395..3edb1e71b 100644 --- a/src/dev/alpha/tsunami_pchip.cc +++ b/src/dev/alpha/tsunami_pchip.cc @@ -44,7 +44,7 @@ #include "dev/alpha/tsunami.hh" #include "dev/alpha/tsunami_cchip.hh" #include "dev/alpha/tsunamireg.h" -#include "dev/pcidev.hh" +#include "dev/pci/device.hh" #include "mem/packet.hh" #include "mem/packet_access.hh" #include "sim/system.hh" diff --git a/src/dev/copy_engine.hh b/src/dev/copy_engine.hh index 797311be5..754ea5e15 100644 --- a/src/dev/copy_engine.hh +++ b/src/dev/copy_engine.hh @@ -53,7 +53,7 @@ #include "base/cp_annotate.hh" #include "base/statistics.hh" #include "dev/copy_engine_defs.hh" -#include "dev/pcidev.hh" +#include "dev/pci/device.hh" #include "params/CopyEngine.hh" #include "sim/drain.hh" #include "sim/eventq.hh" diff --git a/src/dev/etherdevice.hh b/src/dev/etherdevice.hh index ace600a4e..45df2a2df 100644 --- a/src/dev/etherdevice.hh +++ b/src/dev/etherdevice.hh @@ -37,7 +37,7 @@ #define __DEV_ETHERDEVICE_HH__ #include "base/statistics.hh" -#include "dev/pcidev.hh" +#include "dev/pci/device.hh" #include "params/EtherDevice.hh" #include "params/EtherDevBase.hh" #include "sim/sim_object.hh" diff --git a/src/dev/i8254xGBe.hh b/src/dev/i8254xGBe.hh index f46bf51d3..700f49fbf 100644 --- a/src/dev/i8254xGBe.hh +++ b/src/dev/i8254xGBe.hh @@ -46,7 +46,7 @@ #include "dev/etherint.hh" #include "dev/etherpkt.hh" #include "dev/i8254xGBe_defs.hh" -#include "dev/pcidev.hh" +#include "dev/pci/device.hh" #include "dev/pktfifo.hh" #include "params/IGbE.hh" #include "sim/eventq.hh" diff --git a/src/dev/ide_ctrl.hh b/src/dev/ide_ctrl.hh index 0afa60e4a..c6c4beecc 100644 --- a/src/dev/ide_ctrl.hh +++ b/src/dev/ide_ctrl.hh @@ -39,8 +39,7 @@ #include "base/bitunion.hh" #include "dev/io_device.hh" -#include "dev/pcidev.hh" -#include "dev/pcireg.h" +#include "dev/pci/device.hh" #include "params/IdeController.hh" class IdeDisk; diff --git a/src/dev/Pci.py b/src/dev/pci/PciDevice.py similarity index 99% rename from src/dev/Pci.py rename to src/dev/pci/PciDevice.py index 4fbe56fd0..21e6edf62 100644 --- a/src/dev/Pci.py +++ b/src/dev/pci/PciDevice.py @@ -47,7 +47,7 @@ from PciHost import PciHost class PciDevice(DmaDevice): type = 'PciDevice' cxx_class = 'PciDevice' - cxx_header = "dev/pcidev.hh" + cxx_header = "dev/pci/device.hh" abstract = True host = Param.PciHost(Parent.any, "PCI host") diff --git a/src/dev/pci/SConscript b/src/dev/pci/SConscript index b892a2905..14214424b 100644 --- a/src/dev/pci/SConscript +++ b/src/dev/pci/SConscript @@ -12,6 +12,9 @@ # unmodified and in its entirety in all distributions of the software, # modified or unmodified, in source code or in binary form. # +# Copyright (c) 2006 The Regents of The University of Michigan +# All rights reserved. +# # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: redistributions of source code must retain the above copyright @@ -35,14 +38,20 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # -# Authors: Andreas Sandberg +# Authors: Steve Reinhardt +# Gabe Black +# Andreas Sandberg Import('*') if env['TARGET_ISA'] == 'null': Return() +SimObject('PciDevice.py') +Source('device.cc') +DebugFlag('PciDevice') + SimObject('PciHost.py') Source('host.cc') - DebugFlag('PciHost') + diff --git a/src/dev/pcidev.cc b/src/dev/pci/device.cc similarity index 98% rename from src/dev/pcidev.cc rename to src/dev/pci/device.cc index 5e7c09415..916cd8422 100644 --- a/src/dev/pcidev.cc +++ b/src/dev/pci/device.cc @@ -46,6 +46,8 @@ * A single PCI device configuration space entry. */ +#include "dev/pci/device.hh" + #include #include #include @@ -55,8 +57,7 @@ #include "base/misc.hh" #include "base/str.hh" #include "base/trace.hh" -#include "debug/PCIDEV.hh" -#include "dev/pcidev.hh" +#include "debug/PciDevice.hh" #include "mem/packet.hh" #include "mem/packet_access.hh" #include "sim/byteswap.hh" @@ -246,21 +247,21 @@ PciDevice::readConfig(PacketPtr pkt) switch (pkt->getSize()) { case sizeof(uint8_t): pkt->set(config.data[offset]); - DPRINTF(PCIDEV, + DPRINTF(PciDevice, "readConfig: dev %#x func %#x reg %#x 1 bytes: data = %#x\n", _busAddr.dev, _busAddr.func, offset, (uint32_t)pkt->get()); break; case sizeof(uint16_t): pkt->set(*(uint16_t*)&config.data[offset]); - DPRINTF(PCIDEV, + DPRINTF(PciDevice, "readConfig: dev %#x func %#x reg %#x 2 bytes: data = %#x\n", _busAddr.dev, _busAddr.func, offset, (uint32_t)pkt->get()); break; case sizeof(uint32_t): pkt->set(*(uint32_t*)&config.data[offset]); - DPRINTF(PCIDEV, + DPRINTF(PciDevice, "readConfig: dev %#x func %#x reg %#x 4 bytes: data = %#x\n", _busAddr.dev, _busAddr.func, offset, (uint32_t)pkt->get()); @@ -328,7 +329,7 @@ PciDevice::writeConfig(PacketPtr pkt) default: panic("writing to a read only register"); } - DPRINTF(PCIDEV, + DPRINTF(PciDevice, "writeConfig: dev %#x func %#x reg %#x 1 bytes: data = %#x\n", _busAddr.dev, _busAddr.func, offset, (uint32_t)pkt->get()); @@ -347,7 +348,7 @@ PciDevice::writeConfig(PacketPtr pkt) default: panic("writing to a read only register"); } - DPRINTF(PCIDEV, + DPRINTF(PciDevice, "writeConfig: dev %#x func %#x reg %#x 2 bytes: data = %#x\n", _busAddr.dev, _busAddr.func, offset, (uint32_t)pkt->get()); @@ -407,9 +408,9 @@ PciDevice::writeConfig(PacketPtr pkt) break; default: - DPRINTF(PCIDEV, "Writing to a read only register"); + DPRINTF(PciDevice, "Writing to a read only register"); } - DPRINTF(PCIDEV, + DPRINTF(PciDevice, "writeConfig: dev %#x func %#x reg %#x 4 bytes: data = %#x\n", _busAddr.dev, _busAddr.func, offset, (uint32_t)pkt->get()); diff --git a/src/dev/pcidev.hh b/src/dev/pci/device.hh similarity index 98% rename from src/dev/pcidev.hh rename to src/dev/pci/device.hh index a7a2137b0..ba783a6b1 100644 --- a/src/dev/pcidev.hh +++ b/src/dev/pci/device.hh @@ -46,15 +46,15 @@ * Interface for devices using PCI configuration */ -#ifndef __DEV_PCIDEV_HH__ -#define __DEV_PCIDEV_HH__ +#ifndef __DEV_PCI_DEVICE_HH__ +#define __DEV_PCI_DEVICE_HH__ #include #include #include "dev/dma_device.hh" -#include "dev/pcireg.h" #include "dev/pci/host.hh" +#include "dev/pci/pcireg.h" #include "params/PciDevice.hh" #include "sim/byteswap.hh" @@ -224,4 +224,4 @@ class PciDevice : public DmaDevice const PciBusAddr &busAddr() const { return _busAddr; } }; -#endif // __DEV_PCIDEV_HH__ +#endif // __DEV_PCI_DEVICE_HH__ diff --git a/src/dev/pci/host.cc b/src/dev/pci/host.cc index bcf49df86..3b572f7f4 100644 --- a/src/dev/pci/host.cc +++ b/src/dev/pci/host.cc @@ -42,7 +42,7 @@ #include #include "debug/PciHost.hh" -#include "dev/pcidev.hh" +#include "dev/pci/device.hh" #include "dev/platform.hh" #include "params/GenericPciHost.hh" #include "params/PciHost.hh" diff --git a/src/dev/pcireg.h b/src/dev/pci/pcireg.h similarity index 100% rename from src/dev/pcireg.h rename to src/dev/pci/pcireg.h diff --git a/src/dev/sinic.hh b/src/dev/sinic.hh index 7dfc8b204..dc1947f03 100644 --- a/src/dev/sinic.hh +++ b/src/dev/sinic.hh @@ -37,7 +37,7 @@ #include "dev/etherint.hh" #include "dev/etherpkt.hh" #include "dev/io_device.hh" -#include "dev/pcidev.hh" +#include "dev/pci/device.hh" #include "dev/pktfifo.hh" #include "dev/sinicreg.hh" #include "params/Sinic.hh" diff --git a/src/dev/virtio/VirtIO.py b/src/dev/virtio/VirtIO.py index 13479a383..81bf6e3b8 100644 --- a/src/dev/virtio/VirtIO.py +++ b/src/dev/virtio/VirtIO.py @@ -41,7 +41,7 @@ from m5.SimObject import SimObject from m5.params import * from m5.proxy import * from Device import PioDevice -from Pci import PciDevice +from PciDevice import PciDevice class VirtIODeviceBase(SimObject): diff --git a/src/dev/virtio/pci.hh b/src/dev/virtio/pci.hh index be5a140e2..dcac7c592 100644 --- a/src/dev/virtio/pci.hh +++ b/src/dev/virtio/pci.hh @@ -42,7 +42,7 @@ #include "base/statistics.hh" #include "dev/virtio/base.hh" -#include "dev/pcidev.hh" +#include "dev/pci/device.hh" struct PciVirtIOParams;