From 8ec5fc66321549ebda555e7c16ddaf158b021d2b Mon Sep 17 00:00:00 2001 From: Andreas Sandberg Date: Thu, 10 Dec 2015 10:35:23 +0000 Subject: [PATCH] dev: Move storage devices to src/dev/storage/ Move the IDE controller and the disk implementations to src/dev/storage. --HG-- rename : src/dev/DiskImage.py => src/dev/storage/DiskImage.py rename : src/dev/Ide.py => src/dev/storage/Ide.py rename : src/dev/SimpleDisk.py => src/dev/storage/SimpleDisk.py rename : src/dev/disk_image.cc => src/dev/storage/disk_image.cc rename : src/dev/disk_image.hh => src/dev/storage/disk_image.hh rename : src/dev/ide_atareg.h => src/dev/storage/ide_atareg.h rename : src/dev/ide_ctrl.cc => src/dev/storage/ide_ctrl.cc rename : src/dev/ide_ctrl.hh => src/dev/storage/ide_ctrl.hh rename : src/dev/ide_disk.cc => src/dev/storage/ide_disk.cc rename : src/dev/ide_disk.hh => src/dev/storage/ide_disk.hh rename : src/dev/ide_wdcreg.h => src/dev/storage/ide_wdcreg.h rename : src/dev/simple_disk.cc => src/dev/storage/simple_disk.cc rename : src/dev/simple_disk.hh => src/dev/storage/simple_disk.hh --- src/dev/SConscript | 16 ------ src/dev/alpha/backdoor.cc | 2 +- src/dev/arm/ufs_device.hh | 2 +- src/dev/sparc/iob.hh | 1 - src/dev/sparc/mm_disk.hh | 2 +- src/dev/{ => storage}/DiskImage.py | 6 +-- src/dev/{ => storage}/Ide.py | 4 +- src/dev/storage/SConscript | 73 ++++++++++++++++++++++++++++ src/dev/{ => storage}/SimpleDisk.py | 3 +- src/dev/{ => storage}/disk_image.cc | 3 +- src/dev/{ => storage}/disk_image.hh | 6 +-- src/dev/{ => storage}/ide_atareg.h | 3 ++ src/dev/{ => storage}/ide_ctrl.cc | 5 +- src/dev/{ => storage}/ide_ctrl.hh | 6 +-- src/dev/{ => storage}/ide_disk.cc | 7 +-- src/dev/{ => storage}/ide_disk.hh | 14 +++--- src/dev/{ => storage}/ide_wdcreg.h | 0 src/dev/{ => storage}/simple_disk.cc | 7 +-- src/dev/{ => storage}/simple_disk.hh | 6 +-- src/dev/virtio/block.hh | 2 +- 20 files changed, 116 insertions(+), 52 deletions(-) rename src/dev/{ => storage}/DiskImage.py (93%) rename src/dev/{ => storage}/Ide.py (96%) create mode 100644 src/dev/storage/SConscript rename src/dev/{ => storage}/SimpleDisk.py (97%) rename src/dev/{ => storage}/disk_image.cc (99%) rename src/dev/{ => storage}/disk_image.hh (97%) rename src/dev/{ => storage}/ide_atareg.h (99%) rename src/dev/{ => storage}/ide_ctrl.cc (99%) rename src/dev/{ => storage}/ide_ctrl.hh (97%) rename src/dev/{ => storage}/ide_disk.cc (99%) rename src/dev/{ => storage}/ide_disk.hh (97%) rename src/dev/{ => storage}/ide_wdcreg.h (100%) rename src/dev/{ => storage}/simple_disk.cc (97%) rename src/dev/{ => storage}/simple_disk.hh (94%) diff --git a/src/dev/SConscript b/src/dev/SConscript index 85bf839ec..2f3ec5d17 100644 --- a/src/dev/SConscript +++ b/src/dev/SConscript @@ -40,40 +40,24 @@ if env['TARGET_ISA'] == 'null': Return() SimObject('BadDevice.py') -SimObject('DiskImage.py') -SimObject('Ide.py') SimObject('Platform.py') -SimObject('SimpleDisk.py') SimObject('Terminal.py') SimObject('Uart.py') Source('baddev.cc') -Source('disk_image.cc') Source('dma_device.cc') -Source('ide_ctrl.cc') -Source('ide_disk.cc') Source('intel_8254_timer.cc') Source('mc146818.cc') Source('pixelpump.cc') Source('platform.cc') Source('ps2.cc') -Source('simple_disk.cc') Source('terminal.cc') Source('uart.cc') Source('uart8250.cc') -DebugFlag('DiskImageRead') -DebugFlag('DiskImageWrite') DebugFlag('DMA') -DebugFlag('IdeCtrl') -DebugFlag('IdeDisk') DebugFlag('Intel8254Timer') DebugFlag('MC146818') -DebugFlag('SimpleDisk') -DebugFlag('SimpleDiskData') DebugFlag('Terminal') DebugFlag('TerminalVerbose') DebugFlag('Uart') - -CompoundFlag('DiskImageAll', [ 'DiskImageRead', 'DiskImageWrite' ]) -CompoundFlag('IdeAll', [ 'IdeCtrl', 'IdeDisk' ]) diff --git a/src/dev/alpha/backdoor.cc b/src/dev/alpha/backdoor.cc index ec5765673..93bfedf9d 100644 --- a/src/dev/alpha/backdoor.cc +++ b/src/dev/alpha/backdoor.cc @@ -50,7 +50,7 @@ #include "dev/alpha/tsunami_cchip.hh" #include "dev/alpha/tsunami_io.hh" #include "dev/platform.hh" -#include "dev/simple_disk.hh" +#include "dev/storage/simple_disk.hh" #include "dev/terminal.hh" #include "mem/packet.hh" #include "mem/packet_access.hh" diff --git a/src/dev/arm/ufs_device.hh b/src/dev/arm/ufs_device.hh index b0be55777..435d5f59f 100644 --- a/src/dev/arm/ufs_device.hh +++ b/src/dev/arm/ufs_device.hh @@ -152,7 +152,7 @@ #include "debug/UFSHostDevice.hh" #include "dev/arm/abstract_nvm.hh" #include "dev/arm/base_gic.hh" -#include "dev/disk_image.hh" +#include "dev/storage/disk_image.hh" #include "dev/dma_device.hh" #include "dev/io_device.hh" #include "mem/packet.hh" diff --git a/src/dev/sparc/iob.hh b/src/dev/sparc/iob.hh index 4772e8654..1de625eba 100644 --- a/src/dev/sparc/iob.hh +++ b/src/dev/sparc/iob.hh @@ -36,7 +36,6 @@ #ifndef __DEV_SPARC_IOB_HH__ #define __DEV_SPARC_IOB_HH__ -#include "dev/disk_image.hh" #include "dev/io_device.hh" #include "params/Iob.hh" diff --git a/src/dev/sparc/mm_disk.hh b/src/dev/sparc/mm_disk.hh index 6242ed943..2d551fe3f 100644 --- a/src/dev/sparc/mm_disk.hh +++ b/src/dev/sparc/mm_disk.hh @@ -36,8 +36,8 @@ #ifndef __DEV_SPARC_MM_DISK_HH__ #define __DEV_SPARC_MM_DISK_HH__ -#include "dev/disk_image.hh" #include "dev/io_device.hh" +#include "dev/storage/disk_image.hh" #include "params/MmDisk.hh" class MmDisk : public BasicPioDevice diff --git a/src/dev/DiskImage.py b/src/dev/storage/DiskImage.py similarity index 93% rename from src/dev/DiskImage.py rename to src/dev/storage/DiskImage.py index 38cc6e75d..5a3bc54e1 100644 --- a/src/dev/DiskImage.py +++ b/src/dev/storage/DiskImage.py @@ -31,17 +31,17 @@ from m5.params import * class DiskImage(SimObject): type = 'DiskImage' abstract = True - cxx_header = "dev/disk_image.hh" + cxx_header = "dev/storage/disk_image.hh" image_file = Param.String("disk image file") read_only = Param.Bool(False, "read only image") class RawDiskImage(DiskImage): type = 'RawDiskImage' - cxx_header = "dev/disk_image.hh" + cxx_header = "dev/storage/disk_image.hh" class CowDiskImage(DiskImage): type = 'CowDiskImage' - cxx_header = "dev/disk_image.hh" + cxx_header = "dev/storage/disk_image.hh" child = Param.DiskImage(RawDiskImage(read_only=True), "child image") table_size = Param.Int(65536, "initial table size") diff --git a/src/dev/Ide.py b/src/dev/storage/Ide.py similarity index 96% rename from src/dev/Ide.py rename to src/dev/storage/Ide.py index 4d3da1971..fc3f356f0 100644 --- a/src/dev/Ide.py +++ b/src/dev/storage/Ide.py @@ -34,14 +34,14 @@ class IdeID(Enum): vals = ['master', 'slave'] class IdeDisk(SimObject): type = 'IdeDisk' - cxx_header = "dev/ide_disk.hh" + cxx_header = "dev/storage/ide_disk.hh" delay = Param.Latency('1us', "Fixed disk delay in microseconds") driveID = Param.IdeID('master', "Drive ID") image = Param.DiskImage("Disk image") class IdeController(PciDevice): type = 'IdeController' - cxx_header = "dev/ide_ctrl.hh" + cxx_header = "dev/storage/ide_ctrl.hh" disks = VectorParam.IdeDisk("IDE disks attached to this controller") VendorID = 0x8086 diff --git a/src/dev/storage/SConscript b/src/dev/storage/SConscript new file mode 100644 index 000000000..b5ddece04 --- /dev/null +++ b/src/dev/storage/SConscript @@ -0,0 +1,73 @@ +# -*- mode:python -*- + +# Copyright (c) 2015 ARM Limited +# All rights reserved. +# +# The license below extends only to copyright in the software and shall +# not be construed as granting a license to any other intellectual +# property including but not limited to intellectual property relating +# to a hardware implementation of the functionality of the software +# licensed hereunder. You may use the software subject to the license +# terms below provided that you ensure that this notice is replicated +# 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 +# notice, this list of conditions and the following disclaimer; +# redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution; +# neither the name of the copyright holders nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (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: Steve Reinhardt +# Gabe Black +# Andreas Sandberg + +Import('*') + +if env['TARGET_ISA'] == 'null': + Return() + +# Controllers +SimObject('Ide.py') + +Source('ide_ctrl.cc') +Source('ide_disk.cc') + +DebugFlag('IdeCtrl') +DebugFlag('IdeDisk') + +# Disk models +SimObject('DiskImage.py') +SimObject('SimpleDisk.py') + +Source('disk_image.cc') +Source('simple_disk.cc') + +DebugFlag('DiskImageRead') +DebugFlag('DiskImageWrite') +DebugFlag('SimpleDisk') +DebugFlag('SimpleDiskData') + + +CompoundFlag('DiskImageAll', [ 'DiskImageRead', 'DiskImageWrite' ]) +CompoundFlag('IdeAll', [ 'IdeCtrl', 'IdeDisk' ]) diff --git a/src/dev/SimpleDisk.py b/src/dev/storage/SimpleDisk.py similarity index 97% rename from src/dev/SimpleDisk.py rename to src/dev/storage/SimpleDisk.py index 88bf5dbfb..01b41ee0e 100644 --- a/src/dev/SimpleDisk.py +++ b/src/dev/storage/SimpleDisk.py @@ -29,8 +29,9 @@ from m5.SimObject import SimObject from m5.params import * from m5.proxy import * + class SimpleDisk(SimObject): type = 'SimpleDisk' - cxx_header = "dev/simple_disk.hh" + cxx_header = "dev/storage/simple_disk.hh" disk = Param.DiskImage("Disk Image") system = Param.System(Parent.any, "System Pointer") diff --git a/src/dev/disk_image.cc b/src/dev/storage/disk_image.cc similarity index 99% rename from src/dev/disk_image.cc rename to src/dev/storage/disk_image.cc index e4907853f..24688f55a 100644 --- a/src/dev/disk_image.cc +++ b/src/dev/storage/disk_image.cc @@ -32,6 +32,8 @@ * Disk Image Definitions */ +#include "dev/storage/disk_image.hh" + #include #include #include @@ -46,7 +48,6 @@ #include "base/trace.hh" #include "debug/DiskImageRead.hh" #include "debug/DiskImageWrite.hh" -#include "dev/disk_image.hh" #include "sim/byteswap.hh" #include "sim/sim_exit.hh" diff --git a/src/dev/disk_image.hh b/src/dev/storage/disk_image.hh similarity index 97% rename from src/dev/disk_image.hh rename to src/dev/storage/disk_image.hh index fa25fc770..43e6adf5e 100644 --- a/src/dev/disk_image.hh +++ b/src/dev/storage/disk_image.hh @@ -32,8 +32,8 @@ * Disk Image Interfaces */ -#ifndef __DISK_IMAGE_HH__ -#define __DISK_IMAGE_HH__ +#ifndef __DEV_STORAGE_DISK_IMAGE_HH__ +#define __DEV_STORAGE_DISK_IMAGE_HH__ #include #include @@ -154,4 +154,4 @@ void SafeWrite(std::ofstream &stream, const T &data); template void SafeWriteSwap(std::ofstream &stream, const T &data); -#endif // __DISK_IMAGE_HH__ +#endif // __DEV_STORAGE_DISK_IMAGE_HH__ diff --git a/src/dev/ide_atareg.h b/src/dev/storage/ide_atareg.h similarity index 99% rename from src/dev/ide_atareg.h rename to src/dev/storage/ide_atareg.h index d19a75462..51c8aeccf 100644 --- a/src/dev/ide_atareg.h +++ b/src/dev/storage/ide_atareg.h @@ -35,10 +35,13 @@ #if defined(__linux__) #include + #elif defined(__sun) #include + #else #include + #endif #ifdef LITTLE_ENDIAN diff --git a/src/dev/ide_ctrl.cc b/src/dev/storage/ide_ctrl.cc similarity index 99% rename from src/dev/ide_ctrl.cc rename to src/dev/storage/ide_ctrl.cc index 3e6086265..feed9cfd2 100644 --- a/src/dev/ide_ctrl.cc +++ b/src/dev/storage/ide_ctrl.cc @@ -42,12 +42,13 @@ * Miguel Serrano */ +#include "dev/storage/ide_ctrl.hh" + #include #include "cpu/intr_control.hh" #include "debug/IdeCtrl.hh" -#include "dev/ide_ctrl.hh" -#include "dev/ide_disk.hh" +#include "dev/storage/ide_disk.hh" #include "mem/packet.hh" #include "mem/packet_access.hh" #include "params/IdeController.hh" diff --git a/src/dev/ide_ctrl.hh b/src/dev/storage/ide_ctrl.hh similarity index 97% rename from src/dev/ide_ctrl.hh rename to src/dev/storage/ide_ctrl.hh index c6c4beecc..94a9c65e5 100644 --- a/src/dev/ide_ctrl.hh +++ b/src/dev/storage/ide_ctrl.hh @@ -34,8 +34,8 @@ * modeled after controller in the Intel PIIX4 chip */ -#ifndef __IDE_CTRL_HH__ -#define __IDE_CTRL_HH__ +#ifndef __DEV_STORAGE_IDE_CTRL_HH__ +#define __DEV_STORAGE_IDE_CTRL_HH__ #include "base/bitunion.hh" #include "dev/io_device.hh" @@ -156,4 +156,4 @@ class IdeController : public PciDevice void serialize(CheckpointOut &cp) const override; void unserialize(CheckpointIn &cp) override; }; -#endif // __IDE_CTRL_HH_ +#endif // __DEV_STORAGE_IDE_CTRL_HH_ diff --git a/src/dev/ide_disk.cc b/src/dev/storage/ide_disk.cc similarity index 99% rename from src/dev/ide_disk.cc rename to src/dev/storage/ide_disk.cc index 2c8dfceb1..4eefdbbd7 100644 --- a/src/dev/ide_disk.cc +++ b/src/dev/storage/ide_disk.cc @@ -45,6 +45,8 @@ * Device model implementation for an IDE disk */ +#include "dev/storage/ide_disk.hh" + #include #include #include @@ -56,9 +58,8 @@ #include "base/trace.hh" #include "config/the_isa.hh" #include "debug/IdeDisk.hh" -#include "dev/disk_image.hh" -#include "dev/ide_ctrl.hh" -#include "dev/ide_disk.hh" +#include "dev/storage/disk_image.hh" +#include "dev/storage/ide_ctrl.hh" #include "sim/core.hh" #include "sim/sim_object.hh" diff --git a/src/dev/ide_disk.hh b/src/dev/storage/ide_disk.hh similarity index 97% rename from src/dev/ide_disk.hh rename to src/dev/storage/ide_disk.hh index 45b0dd149..9214599e9 100644 --- a/src/dev/ide_disk.hh +++ b/src/dev/storage/ide_disk.hh @@ -44,15 +44,15 @@ * Device model for an IDE disk */ -#ifndef __IDE_DISK_HH__ -#define __IDE_DISK_HH__ +#ifndef __DEV_STORAGE_IDE_DISK_HH__ +#define __DEV_STORAGE_IDE_DISK_HH__ #include "base/statistics.hh" -#include "dev/disk_image.hh" -#include "dev/ide_atareg.h" -#include "dev/ide_ctrl.hh" -#include "dev/ide_wdcreg.h" #include "dev/io_device.hh" +#include "dev/storage/disk_image.hh" +#include "dev/storage/ide_atareg.h" +#include "dev/storage/ide_ctrl.hh" +#include "dev/storage/ide_wdcreg.h" #include "params/IdeDisk.hh" #include "sim/eventq.hh" @@ -370,4 +370,4 @@ class IdeDisk : public SimObject }; -#endif // __IDE_DISK_HH__ +#endif // __DEV_STORAGE_IDE_DISK_HH__ diff --git a/src/dev/ide_wdcreg.h b/src/dev/storage/ide_wdcreg.h similarity index 100% rename from src/dev/ide_wdcreg.h rename to src/dev/storage/ide_wdcreg.h diff --git a/src/dev/simple_disk.cc b/src/dev/storage/simple_disk.cc similarity index 97% rename from src/dev/simple_disk.cc rename to src/dev/storage/simple_disk.cc index 26e8239bb..49c001a00 100644 --- a/src/dev/simple_disk.cc +++ b/src/dev/storage/simple_disk.cc @@ -32,9 +32,11 @@ * Simple disk interface for the system console */ +#include "dev/storage/simple_disk.hh" + +#include #include #include -#include #include #include @@ -44,8 +46,7 @@ #include "base/trace.hh" #include "debug/SimpleDisk.hh" #include "debug/SimpleDiskData.hh" -#include "dev/disk_image.hh" -#include "dev/simple_disk.hh" +#include "dev/storage/disk_image.hh" #include "mem/port_proxy.hh" #include "sim/system.hh" diff --git a/src/dev/simple_disk.hh b/src/dev/storage/simple_disk.hh similarity index 94% rename from src/dev/simple_disk.hh rename to src/dev/storage/simple_disk.hh index 1a95bd59f..2a3ff4986 100644 --- a/src/dev/simple_disk.hh +++ b/src/dev/storage/simple_disk.hh @@ -32,8 +32,8 @@ * Simple disk interface for the system console */ -#ifndef __DEV_SIMPLE_DISK_HH__ -#define __DEV_SIMPLE_DISK_HH__ +#ifndef __DEV_STORAGE_SIMPLE_DISK_HH__ +#define __DEV_STORAGE_SIMPLE_DISK_HH__ #include "params/SimpleDisk.hh" #include "sim/sim_object.hh" @@ -62,4 +62,4 @@ class SimpleDisk : public SimObject void write(Addr addr, baddr_t block, int count); }; -#endif // __DEV_SIMPLE_DISK_HH__ +#endif // __DEV_STORAGE_SIMPLE_DISK_HH__ diff --git a/src/dev/virtio/block.hh b/src/dev/virtio/block.hh index bef29580b..fbbb51854 100644 --- a/src/dev/virtio/block.hh +++ b/src/dev/virtio/block.hh @@ -41,7 +41,7 @@ #define __DEV_VIRTIO_BLOCK_HH__ #include "dev/virtio/base.hh" -#include "dev/disk_image.hh" +#include "dev/storage/disk_image.hh" #include "dev/terminal.hh" struct VirtIOBlockParams;