backdoor.hh revision 11169
12SN/A/* 21762SN/A * Copyright (c) 2001-2005 The Regents of The University of Michigan 32SN/A * All rights reserved. 42SN/A * 52SN/A * Redistribution and use in source and binary forms, with or without 62SN/A * modification, are permitted provided that the following conditions are 72SN/A * met: redistributions of source code must retain the above copyright 82SN/A * notice, this list of conditions and the following disclaimer; 92SN/A * redistributions in binary form must reproduce the above copyright 102SN/A * notice, this list of conditions and the following disclaimer in the 112SN/A * documentation and/or other materials provided with the distribution; 122SN/A * neither the name of the copyright holders nor the names of its 132SN/A * contributors may be used to endorse or promote products derived from 142SN/A * this software without specific prior written permission. 152SN/A * 162SN/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 172SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 182SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 192SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 202SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 212SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 222SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 232SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 242SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 252SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 262SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 272665SN/A * 282665SN/A * Authors: Nathan Binkert 292SN/A */ 302SN/A 311722SN/A/** @file 325480Snate@binkert.org * System Console Backdoor Interface 332SN/A */ 342SN/A 355480Snate@binkert.org#ifndef __DEV_ALPHA_BACKDOOR_HH__ 365480Snate@binkert.org#define __DEV_ALPHA_BACKDOOR_HH__ 372SN/A 386216Snate@binkert.org#include "base/types.hh" 393534SN/A#include "dev/alpha/access.h" 40545SN/A#include "dev/io_device.hh" 415480Snate@binkert.org#include "params/AlphaBackdoor.hh" 42843SN/A#include "sim/sim_object.hh" 432SN/A 442SN/Aclass BaseCPU; 455478SN/Aclass Terminal; 462158SN/Aclass AlphaSystem; 472SN/Aclass SimpleDisk; 482SN/A 491722SN/A/** 502SN/A * Memory mapped interface to the system console. This device 512SN/A * represents a shared data region between the OS Kernel and the 525480Snate@binkert.org * System Console Backdoor. 532SN/A * 542SN/A * The system console is a small standalone program that is initially 552SN/A * run when the system boots. It contains the necessary code to 562SN/A * access the boot disk, to read/write from the console, and to pass 572SN/A * boot parameters to the kernel. 582SN/A * 592SN/A * This version of the system console is very different from the one 602SN/A * that would be found in a real system. Many of the functions use 612SN/A * some sort of backdoor to get their job done. For example, reading 622SN/A * from the boot device on a real system would require a minimal 632SN/A * device driver to access the disk controller, but since we have a 642SN/A * simulator here, we are able to bypass the disk controller and 652SN/A * access the disk image directly. There are also some things like 662SN/A * reading the kernel off the disk image into memory that are normally 672SN/A * taken care of by the console that are now taken care of by the 682SN/A * simulator. 692SN/A * 702SN/A * These shortcuts are acceptable since the system console is 712SN/A * primarily used doing boot before the kernel has loaded its device 722SN/A * drivers. 732SN/A */ 745480Snate@binkert.orgclass AlphaBackdoor : public BasicPioDevice 752SN/A{ 762SN/A protected: 7710905Sandreas.sandberg@arm.com struct Access : public AlphaAccess, public Serializable 781804SN/A { 7911168Sandreas.hansson@arm.com void serialize(CheckpointOut &cp) const override; 8011168Sandreas.hansson@arm.com void unserialize(CheckpointIn &cp) override; 811804SN/A }; 821804SN/A 83934SN/A union { 841804SN/A Access *alphaAccess; 851310SN/A uint8_t *consoleData; 86934SN/A }; 872SN/A 882SN/A /** the disk must be accessed from the console */ 892SN/A SimpleDisk *disk; 902SN/A 912SN/A /** the system console (the terminal) is accessable from the console */ 925478SN/A Terminal *terminal; 932SN/A 941634SN/A /** a pointer to the system we are running in */ 952158SN/A AlphaSystem *system; 961634SN/A 971634SN/A /** a pointer to the CPU boot cpu */ 981634SN/A BaseCPU *cpu; 991634SN/A 1002512SN/A public: 1015480Snate@binkert.org typedef AlphaBackdoorParams Params; 1025480Snate@binkert.org AlphaBackdoor(const Params *p); 1034762SN/A 1044762SN/A const Params * 1054762SN/A params() const 1062512SN/A { 1074762SN/A return dynamic_cast<const Params *>(_params); 1084762SN/A } 1092SN/A 11011169Sandreas.hansson@arm.com void startup() override; 1111634SN/A 1122SN/A /** 1132SN/A * memory mapped reads and writes 1142SN/A */ 11511169Sandreas.hansson@arm.com Tick read(PacketPtr pkt) override; 11611169Sandreas.hansson@arm.com Tick write(PacketPtr pkt) override; 1172SN/A 1182SN/A /** 1192SN/A * standard serialization routines for checkpointing 1202SN/A */ 12111168Sandreas.hansson@arm.com void serialize(CheckpointOut &cp) const override; 12211168Sandreas.hansson@arm.com void unserialize(CheckpointIn &cp) override; 1232SN/A}; 1242SN/A 1255480Snate@binkert.org#endif // __DEV_ALPHA_BACKDOOR_HH__ 126