system.hh revision 3853
12567SN/A/*
22567SN/A * Copyright (c) 2002-2005 The Regents of The University of Michigan
32567SN/A * All rights reserved.
42567SN/A *
52567SN/A * Redistribution and use in source and binary forms, with or without
62567SN/A * modification, are permitted provided that the following conditions are
72567SN/A * met: redistributions of source code must retain the above copyright
82567SN/A * notice, this list of conditions and the following disclaimer;
92567SN/A * redistributions in binary form must reproduce the above copyright
102567SN/A * notice, this list of conditions and the following disclaimer in the
112567SN/A * documentation and/or other materials provided with the distribution;
122567SN/A * neither the name of the copyright holders nor the names of its
132567SN/A * contributors may be used to endorse or promote products derived from
142567SN/A * this software without specific prior written permission.
152567SN/A *
162567SN/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
172567SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
182567SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
192567SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
202567SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
212567SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
222567SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
232567SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
242567SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
252567SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
262567SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
272665Ssaidi@eecs.umich.edu *
282665Ssaidi@eecs.umich.edu * Authors: Ali Saidi
292567SN/A */
302567SN/A
312567SN/A#ifndef __ARCH_SPARC_SYSTEM_HH__
322567SN/A#define __ARCH_SPARC_SYSTEM_HH__
332567SN/A
342567SN/A#include <string>
352567SN/A#include <vector>
362567SN/A
372567SN/A#include "base/loader/symtab.hh"
382567SN/A#include "cpu/pc_event.hh"
392567SN/A#include "kern/system_events.hh"
402567SN/A#include "sim/sim_object.hh"
412567SN/A#include "sim/system.hh"
422567SN/A
432567SN/Aclass SparcSystem : public System
442567SN/A{
452567SN/A  public:
462567SN/A    struct Params : public System::Params
472567SN/A    {
483584Ssaidi@eecs.umich.edu        PhysicalMemory *rom;
493745Sgblack@eecs.umich.edu        PhysicalMemory *nvram;
503745Sgblack@eecs.umich.edu        PhysicalMemory *hypervisor_desc;
513745Sgblack@eecs.umich.edu        PhysicalMemory *partition_desc;
523584Ssaidi@eecs.umich.edu        Addr reset_addr;
533584Ssaidi@eecs.umich.edu        Addr hypervisor_addr;
543584Ssaidi@eecs.umich.edu        Addr openboot_addr;
553745Sgblack@eecs.umich.edu        Addr nvram_addr;
563745Sgblack@eecs.umich.edu        Addr hypervisor_desc_addr;
573745Sgblack@eecs.umich.edu        Addr partition_desc_addr;
582567SN/A        std::string reset_bin;
593527Sgblack@eecs.umich.edu        std::string hypervisor_bin;
602567SN/A        std::string openboot_bin;
613745Sgblack@eecs.umich.edu        std::string nvram_bin;
623745Sgblack@eecs.umich.edu        std::string hypervisor_desc_bin;
633745Sgblack@eecs.umich.edu        std::string partition_desc_bin;
642567SN/A        std::string boot_osflags;
652567SN/A    };
662567SN/A
672567SN/A    SparcSystem(Params *p);
682567SN/A
692650Ssaidi@eecs.umich.edu    ~SparcSystem();
702567SN/A
712567SN/A    virtual bool breakpoint();
722567SN/A
732567SN/A/**
742567SN/A * Serialization stuff
752567SN/A */
762567SN/A  public:
772567SN/A    virtual void serialize(std::ostream &os);
782567SN/A    virtual void unserialize(Checkpoint *cp, const std::string &section);
792567SN/A
802567SN/A    /** reset binary symbol table */
812567SN/A    SymbolTable *resetSymtab;
822567SN/A
832567SN/A    /** hypervison binary symbol table */
842567SN/A    SymbolTable *hypervisorSymtab;
852567SN/A
862567SN/A    /** openboot symbol table */
872567SN/A    SymbolTable *openbootSymtab;
882567SN/A
893745Sgblack@eecs.umich.edu    /** nvram symbol table? */
903745Sgblack@eecs.umich.edu    SymbolTable *nvramSymtab;
913745Sgblack@eecs.umich.edu
923745Sgblack@eecs.umich.edu    /** hypervisor desc symbol table? */
933745Sgblack@eecs.umich.edu    SymbolTable *hypervisorDescSymtab;
943745Sgblack@eecs.umich.edu
953745Sgblack@eecs.umich.edu    /** partition desc symbol table? */
963745Sgblack@eecs.umich.edu    SymbolTable *partitionDescSymtab;
973745Sgblack@eecs.umich.edu
982567SN/A    /** Object pointer for the reset binary */
992567SN/A    ObjectFile *reset;
1002567SN/A
1012567SN/A    /** Object pointer for the hypervisor code */
1022567SN/A    ObjectFile *hypervisor;
1032567SN/A
1042567SN/A    /** Object pointer for the openboot code */
1052567SN/A    ObjectFile *openboot;
1062567SN/A
1073745Sgblack@eecs.umich.edu    /** Object pointer for the nvram image */
1083745Sgblack@eecs.umich.edu    ObjectFile *nvram;
1093745Sgblack@eecs.umich.edu
1103745Sgblack@eecs.umich.edu    /** Object pointer for the hypervisor description image */
1113745Sgblack@eecs.umich.edu    ObjectFile *hypervisor_desc;
1123745Sgblack@eecs.umich.edu
1133745Sgblack@eecs.umich.edu    /** Object pointer for the partition description image */
1143745Sgblack@eecs.umich.edu    ObjectFile *partition_desc;
1153745Sgblack@eecs.umich.edu
1162650Ssaidi@eecs.umich.edu    /** System Tick for syncronized tick across all cpus. */
1172650Ssaidi@eecs.umich.edu    Tick sysTick;
1182650Ssaidi@eecs.umich.edu
1193584Ssaidi@eecs.umich.edu    /** functional port to ROM */
1203584Ssaidi@eecs.umich.edu    FunctionalPort funcRomPort;
1213584Ssaidi@eecs.umich.edu
1223745Sgblack@eecs.umich.edu    /** functional port to nvram */
1233745Sgblack@eecs.umich.edu    FunctionalPort funcNvramPort;
1243745Sgblack@eecs.umich.edu
1253745Sgblack@eecs.umich.edu    /** functional port to hypervisor description */
1263745Sgblack@eecs.umich.edu    FunctionalPort funcHypDescPort;
1273745Sgblack@eecs.umich.edu
1283745Sgblack@eecs.umich.edu    /** functional port to partition description */
1293745Sgblack@eecs.umich.edu    FunctionalPort funcPartDescPort;
1303745Sgblack@eecs.umich.edu
1312567SN/A  protected:
1322567SN/A    const Params *params() const { return (const Params *)_params; }
1332567SN/A
1342567SN/A    /** Add a function-based event to reset binary. */
1352567SN/A    template <class T>
1363853Sgblack@eecs.umich.edu    T *addResetFuncEvent(const char *lbl)
1372567SN/A    {
1382567SN/A        return addFuncEvent<T>(resetSymtab, lbl);
1392567SN/A    }
1402567SN/A
1412567SN/A    /** Add a function-based event to the hypervisor. */
1422567SN/A    template <class T>
1433853Sgblack@eecs.umich.edu    T *addHypervisorFuncEvent(const char *lbl)
1442567SN/A    {
1452567SN/A        return addFuncEvent<T>(hypervisorSymtab, lbl);
1462567SN/A    }
1472567SN/A
1482567SN/A    /** Add a function-based event to the openboot. */
1492567SN/A    template <class T>
1503853Sgblack@eecs.umich.edu    T *addOpenbootFuncEvent(const char *lbl)
1512567SN/A    {
1522567SN/A        return addFuncEvent<T>(openbootSymtab, lbl);
1532567SN/A    }
1542567SN/A
1553553Sgblack@eecs.umich.edu    virtual Addr fixFuncEventAddr(Addr addr)
1563553Sgblack@eecs.umich.edu    {
1573553Sgblack@eecs.umich.edu        //XXX This may eventually have to do something useful.
1583553Sgblack@eecs.umich.edu        return addr;
1593553Sgblack@eecs.umich.edu    }
1602567SN/A};
1612567SN/A
1622567SN/A#endif
1632567SN/A
164