simple_disk.hh revision 2107
19651SAndreas.Sandberg@ARM.com/* 210605Sgabeblack@google.com * Copyright (c) 2001-2005 The Regents of The University of Michigan 310859Sandreas.sandberg@arm.com * All rights reserved. 49651SAndreas.Sandberg@ARM.com * 59651SAndreas.Sandberg@ARM.com * Redistribution and use in source and binary forms, with or without 69651SAndreas.Sandberg@ARM.com * modification, are permitted provided that the following conditions are 79651SAndreas.Sandberg@ARM.com * met: redistributions of source code must retain the above copyright 89651SAndreas.Sandberg@ARM.com * notice, this list of conditions and the following disclaimer; 99651SAndreas.Sandberg@ARM.com * redistributions in binary form must reproduce the above copyright 109651SAndreas.Sandberg@ARM.com * notice, this list of conditions and the following disclaimer in the 119651SAndreas.Sandberg@ARM.com * documentation and/or other materials provided with the distribution; 129651SAndreas.Sandberg@ARM.com * neither the name of the copyright holders nor the names of its 139651SAndreas.Sandberg@ARM.com * contributors may be used to endorse or promote products derived from 149651SAndreas.Sandberg@ARM.com * this software without specific prior written permission. 159651SAndreas.Sandberg@ARM.com * 169651SAndreas.Sandberg@ARM.com * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 179651SAndreas.Sandberg@ARM.com * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 189651SAndreas.Sandberg@ARM.com * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 199651SAndreas.Sandberg@ARM.com * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 209651SAndreas.Sandberg@ARM.com * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 219651SAndreas.Sandberg@ARM.com * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 229651SAndreas.Sandberg@ARM.com * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 239651SAndreas.Sandberg@ARM.com * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 249651SAndreas.Sandberg@ARM.com * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 259651SAndreas.Sandberg@ARM.com * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 269651SAndreas.Sandberg@ARM.com * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 279651SAndreas.Sandberg@ARM.com */ 289651SAndreas.Sandberg@ARM.com 299651SAndreas.Sandberg@ARM.com/* @file 309651SAndreas.Sandberg@ARM.com * Simple disk interface for the system console 319651SAndreas.Sandberg@ARM.com */ 329651SAndreas.Sandberg@ARM.com 339651SAndreas.Sandberg@ARM.com#ifndef __DEV_SIMPLE_DISK_HH__ 349651SAndreas.Sandberg@ARM.com#define __DEV_SIMPLE_DISK_HH__ 359651SAndreas.Sandberg@ARM.com 369651SAndreas.Sandberg@ARM.com#include "sim/sim_object.hh" 379651SAndreas.Sandberg@ARM.com#include "arch/isa_traits.hh" 389651SAndreas.Sandberg@ARM.com 399651SAndreas.Sandberg@ARM.comclass DiskImage; 409651SAndreas.Sandberg@ARM.comclass PhysicalMemory; 4111793Sbrandon.potter@amd.com 4211793Sbrandon.potter@amd.com/* 4311793Sbrandon.potter@amd.com * Trivial interface to a disk image used by the System Console 449651SAndreas.Sandberg@ARM.com */ 459651SAndreas.Sandberg@ARM.comclass SimpleDisk : public SimObject 469651SAndreas.Sandberg@ARM.com{ 479651SAndreas.Sandberg@ARM.com protected: 489651SAndreas.Sandberg@ARM.com typedef TheISA::Addr Addr; 499651SAndreas.Sandberg@ARM.com public: 509651SAndreas.Sandberg@ARM.com typedef uint64_t baddr_t; 519883Sandreas@sandberg.pp.se 529651SAndreas.Sandberg@ARM.com protected: 5311943SCurtis.Dunham@arm.com PhysicalMemory *physmem; 549651SAndreas.Sandberg@ARM.com DiskImage *image; 559651SAndreas.Sandberg@ARM.com 569651SAndreas.Sandberg@ARM.com public: 579651SAndreas.Sandberg@ARM.com SimpleDisk(const std::string &name, PhysicalMemory *pmem, DiskImage *img); 589651SAndreas.Sandberg@ARM.com ~SimpleDisk(); 599651SAndreas.Sandberg@ARM.com 609651SAndreas.Sandberg@ARM.com void read(Addr addr, baddr_t block, int count) const; 619651SAndreas.Sandberg@ARM.com void write(Addr addr, baddr_t block, int count); 629651SAndreas.Sandberg@ARM.com}; 639651SAndreas.Sandberg@ARM.com 649651SAndreas.Sandberg@ARM.com#endif // __DEV_SIMPLE_DISK_HH__ 659651SAndreas.Sandberg@ARM.com