mm_disk.hh revision 11168:f98eb2da15a4
111988Sandreas.sandberg@arm.com/* 28840Sandreas.hansson@arm.com * Copyright (c) 2006 The Regents of The University of Michigan 38840Sandreas.hansson@arm.com * All rights reserved. 48840Sandreas.hansson@arm.com * 58840Sandreas.hansson@arm.com * Redistribution and use in source and binary forms, with or without 68840Sandreas.hansson@arm.com * modification, are permitted provided that the following conditions are 78840Sandreas.hansson@arm.com * met: redistributions of source code must retain the above copyright 88840Sandreas.hansson@arm.com * notice, this list of conditions and the following disclaimer; 98840Sandreas.hansson@arm.com * redistributions in binary form must reproduce the above copyright 108840Sandreas.hansson@arm.com * notice, this list of conditions and the following disclaimer in the 118840Sandreas.hansson@arm.com * documentation and/or other materials provided with the distribution; 128840Sandreas.hansson@arm.com * neither the name of the copyright holders nor the names of its 132740SN/A * contributors may be used to endorse or promote products derived from 149983Sstever@gmail.com * this software without specific prior written permission. 159983Sstever@gmail.com * 161046SN/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 171046SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 181046SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 191046SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 201046SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 211046SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 221046SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 231046SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 241046SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 251046SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 261046SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 271046SN/A * 281046SN/A * Authors: Ali Saidi 291046SN/A */ 301046SN/A 311046SN/A/** @file 321046SN/A * This device acts as a disk similar to the memory mapped disk device 331046SN/A * in legion. Any access is translated to an offset in the disk image. 341046SN/A */ 351046SN/A 361046SN/A#ifndef __DEV_SPARC_MM_DISK_HH__ 371046SN/A#define __DEV_SPARC_MM_DISK_HH__ 381046SN/A 391046SN/A#include "dev/disk_image.hh" 402665SN/A#include "dev/io_device.hh" 412665SN/A#include "params/MmDisk.hh" 422665SN/A 438840Sandreas.hansson@arm.comclass MmDisk : public BasicPioDevice 4411988Sandreas.sandberg@arm.com{ 451046SN/A private: 4612563Sgabeblack@google.com DiskImage *image; 4712563Sgabeblack@google.com off_t curSector; 485766Snate@binkert.org bool dirty; 498331Ssteve.reinhardt@amd.com uint8_t diskData[SectorSize]; 5011988Sandreas.sandberg@arm.com 5111988Sandreas.sandberg@arm.com public: 521438SN/A typedef MmDiskParams Params; 534762Snate@binkert.org MmDisk(const Params *p); 546654Snate@binkert.org 5511988Sandreas.sandberg@arm.com const Params * 5612469Sglenn.bergmans@arm.com params() const 5712469Sglenn.bergmans@arm.com { 5812469Sglenn.bergmans@arm.com return dynamic_cast<const Params *>(_params); 593102Sstever@eecs.umich.edu } 603102Sstever@eecs.umich.edu 613102Sstever@eecs.umich.edu virtual Tick read(PacketPtr pkt); 623102Sstever@eecs.umich.edu virtual Tick write(PacketPtr pkt); 636654Snate@binkert.org 643102Sstever@eecs.umich.edu void serialize(CheckpointOut &cp) const override; 653102Sstever@eecs.umich.edu}; 667528Ssteve.reinhardt@amd.com 678839Sandreas.hansson@arm.com#endif //__DEV_SPARC_MM_DISK_HH__ 683102Sstever@eecs.umich.edu 696654Snate@binkert.org