self.t1000.hvuart.pio_addr + uart_pio_size - 1)
]
- workload = SparcFsWorkload(
- reset_bin=binary('reset_new.bin'),
- hypervisor_bin=binary('q_new.bin'),
- openboot_bin=binary('openboot_new.bin'),
- nvram_bin=binary('nvram1'),
- hypervisor_desc_bin=binary('1up-hv.bin'),
- partition_desc_bin=binary('1up-md.bin'),
- )
+ workload = SparcFsWorkload()
# ROM for OBP/Reset/Hypervisor
- self.rom = SimpleMemory(range=AddrRange(workload._rom_base, size='8MB'))
+ self.rom = SimpleMemory(image_file=binary('t1000_rom.bin'),
+ range=AddrRange(0xfff0000000, size='8MB'))
# nvram
- self.nvram = SimpleMemory(
- range=AddrRange(workload._nvram_base, size='8kB'))
+ self.nvram = SimpleMemory(image_file=binary('nvram1'),
+ range=AddrRange(0x1f11000000, size='8kB'))
# hypervisor description
- self.hypervisor_desc = SimpleMemory(
- range=AddrRange(workload._hypervisor_desc_base, size='8kB'))
+ self.hypervisor_desc = SimpleMemory(image_file=binary('1up-hv.bin'),
+ range=AddrRange(0x1f12080000, size='8kB'))
# partition description
- self.partition_desc = SimpleMemory(
- range=AddrRange(workload._partition_desc_base, size='8kB'))
+ self.partition_desc = SimpleMemory(image_file=binary('1up-md.bin'),
+ range=AddrRange(0x1f12000000, size='8kB'))
self.rom.port = self.membus.master
self.nvram.port = self.membus.master
from m5.params import *
-from m5.objects.SimpleMemory import SimpleMemory
from m5.objects.OsKernel import OsKernel
class SparcFsWorkload(OsKernel):
cxx_class = 'SparcISA::FsWorkload'
load_addr_mask = 0xffffffffff
-
- _rom_base = 0xfff0000000
- _nvram_base = 0x1f11000000
- _hypervisor_desc_base = 0x1f12080000
- _partition_desc_base = 0x1f12000000
-
- reset_addr = Param.Addr(_rom_base, "Address to load ROM at")
- hypervisor_addr = Param.Addr(Addr('64kB') + _rom_base,
- "Address to load hypervisor at")
- openboot_addr = Param.Addr(Addr('512kB') + _rom_base,
- "Address to load openboot at")
- nvram_addr = Param.Addr(_nvram_base, "Address to put the nvram")
- hypervisor_desc_addr = Param.Addr(_hypervisor_desc_base,
- "Address for the hypervisor description")
- partition_desc_addr = Param.Addr(_partition_desc_base,
- "Address for the partition description")
-
- reset_bin = Param.String("file that contains the reset code")
- hypervisor_bin = Param.String("file that contains the hypervisor code")
- openboot_bin = Param.String("file that contains the openboot code")
- nvram_bin = Param.String("file that contains the contents of nvram")
- hypervisor_desc_bin = Param.String(
- "file that contains the hypervisor description")
- partition_desc_bin = Param.String(
- "file that contains the partition description")
#include "arch/sparc/fs_workload.hh"
#include "arch/sparc/faults.hh"
-#include "base/loader/object_file.hh"
-#include "base/loader/symtab.hh"
-#include "base/trace.hh"
-#include "mem/physical.hh"
#include "params/SparcFsWorkload.hh"
-#include "sim/byteswap.hh"
#include "sim/system.hh"
-namespace
-{
-
-ObjectFile *
-loadFirmwareImage(const std::string &fname, const std::string &name)
-{
- ObjectFile *obj = createObjectFile(fname, true);
- fatal_if(!obj, "Could not load %s %s.", name, fname);
- return obj;
-}
-
-void
-writeFirmwareImage(ObjectFile *obj, Addr addr, const PortProxy &proxy)
-{
- MemoryImage image = obj->buildImage();
-
- // If the entry point isn't somewhere in the image, we assume we need to
- // move where it's loaded so that it is.
- if (addr < image.minAddr() || addr >= image.maxAddr()) {
- // Move the image by the difference between the expected entry address,
- // and the entry point in the object file.
- image.offset(addr - obj->entryPoint());
- }
-
- image.write(proxy);
-}
-
-} // anonymous namespace
-
namespace SparcISA
{
-FsWorkload::FsWorkload(Params *p) : OsKernel(*p)
-{
- resetSymtab = new SymbolTable;
- hypervisorSymtab = new SymbolTable;
- openbootSymtab = new SymbolTable;
- nvramSymtab = new SymbolTable;
- hypervisorDescSymtab = new SymbolTable;
- partitionDescSymtab = new SymbolTable;
-
- reset = loadFirmwareImage(params()->reset_bin, "reset binary");
- openboot = loadFirmwareImage(params()->openboot_bin, "openboot binary");
- hypervisor = loadFirmwareImage(
- params()->hypervisor_bin, "hypervisor binary");
- nvram = loadFirmwareImage(params()->nvram_bin, "nvram image");
- hypervisor_desc = loadFirmwareImage(
- params()->hypervisor_desc_bin, "hypervisor description image");
- partition_desc = loadFirmwareImage(
- params()->partition_desc_bin, "partition description image");
-
- // load symbols
- panic_if(!reset->loadGlobalSymbols(resetSymtab),
- "could not load reset symbols");
-
- panic_if(!openboot->loadGlobalSymbols(openbootSymtab),
- "could not load openboot symbols");
-
- panic_if(!hypervisor->loadLocalSymbols(hypervisorSymtab),
- "could not load hypervisor symbols");
-
- panic_if(!nvram->loadLocalSymbols(nvramSymtab),
- "could not load nvram symbols");
-
- panic_if(!hypervisor_desc->loadLocalSymbols(hypervisorDescSymtab),
- "could not load hypervisor description symbols");
-
- panic_if(!partition_desc->loadLocalSymbols(partitionDescSymtab),
- "could not load partition description symbols");
-
- // load symbols into debug table
- panic_if(!reset->loadGlobalSymbols(debugSymbolTable),
- "could not load reset symbols");
-
- panic_if(!openboot->loadGlobalSymbols(debugSymbolTable),
- "could not load openboot symbols");
-
- panic_if(!hypervisor->loadLocalSymbols(debugSymbolTable),
- "could not load hypervisor symbols");
-
- // Strip off the rom address so when the hypervisor is copied into memory
- // we have symbols still
- panic_if(!hypervisor->loadLocalSymbols(debugSymbolTable, 0, 0, 0xFFFFFF),
- "could not load hypervisor symbols");
-
- panic_if(!nvram->loadGlobalSymbols(debugSymbolTable),
- "could not load reset symbols");
-
- panic_if(!hypervisor_desc->loadGlobalSymbols(debugSymbolTable),
- "could not load hypervisor description symbols");
-
- panic_if(!partition_desc->loadLocalSymbols(debugSymbolTable),
- "could not load partition description symbols");
-
-}
-
void
FsWorkload::initState()
{
auto *tc = system->threadContexts[0];
SparcISA::PowerOnReset().invoke(tc);
tc->activate();
-
- auto phys_proxy = system->physProxy;
-
- writeFirmwareImage(reset, params()->reset_addr, phys_proxy);
- writeFirmwareImage(openboot, params()->openboot_addr, phys_proxy);
- writeFirmwareImage(hypervisor, params()->hypervisor_addr, phys_proxy);
- writeFirmwareImage(nvram, params()->nvram_addr, phys_proxy);
- writeFirmwareImage(
- hypervisor_desc, params()->hypervisor_desc_addr, phys_proxy);
- writeFirmwareImage(
- partition_desc, params()->partition_desc_addr, phys_proxy);
-}
-
-FsWorkload::~FsWorkload()
-{
- delete resetSymtab;
- delete hypervisorSymtab;
- delete openbootSymtab;
- delete nvramSymtab;
- delete hypervisorDescSymtab;
- delete partitionDescSymtab;
- delete reset;
- delete openboot;
- delete hypervisor;
- delete nvram;
- delete hypervisor_desc;
- delete partition_desc;
-}
-
-void
-FsWorkload::serializeSymtab(CheckpointOut &cp) const
-{
- resetSymtab->serialize("reset_symtab", cp);
- hypervisorSymtab->serialize("hypervisor_symtab", cp);
- openbootSymtab->serialize("openboot_symtab", cp);
- nvramSymtab->serialize("nvram_symtab", cp);
- hypervisorDescSymtab->serialize("hypervisor_desc_symtab", cp);
- partitionDescSymtab->serialize("partition_desc_symtab", cp);
-}
-
-
-void
-FsWorkload::unserializeSymtab(CheckpointIn &cp)
-{
- resetSymtab->unserialize("reset_symtab", cp);
- hypervisorSymtab->unserialize("hypervisor_symtab", cp);
- openbootSymtab->unserialize("openboot_symtab", cp);
- nvramSymtab->unserialize("nvram_symtab", cp);
- hypervisorDescSymtab->unserialize("hypervisor_desc_symtab", cp);
- partitionDescSymtab->unserialize("partition_desc_symtab", cp);
}
} // namespace SparcISA
#ifndef __ARCH_SPARC_FS_WORKLOAD_HH__
#define __ARCH_SPARC_FS_WORKLOAD_HH__
-#include "base/loader/symtab.hh"
-#include "cpu/pc_event.hh"
-#include "kern/system_events.hh"
#include "params/SparcFsWorkload.hh"
#include "sim/os_kernel.hh"
-#include "sim/sim_object.hh"
namespace SparcISA
{
class FsWorkload : public OsKernel
{
public:
- typedef SparcFsWorkloadParams Params;
- FsWorkload(Params *p);
- ~FsWorkload();
-
+ FsWorkload(SparcFsWorkloadParams *p) : OsKernel(*p) {}
void initState() override;
-
-/**
- * Serialization stuff
- */
- public:
- void serializeSymtab(CheckpointOut &cp) const override;
- void unserializeSymtab(CheckpointIn &cp) override;
-
- /** reset binary symbol table */
- SymbolTable *resetSymtab;
-
- /** hypervison binary symbol table */
- SymbolTable *hypervisorSymtab;
-
- /** openboot symbol table */
- SymbolTable *openbootSymtab;
-
- /** nvram symbol table? */
- SymbolTable *nvramSymtab;
-
- /** hypervisor desc symbol table? */
- SymbolTable *hypervisorDescSymtab;
-
- /** partition desc symbol table? */
- SymbolTable *partitionDescSymtab;
-
- /** Object pointer for the reset binary */
- ObjectFile *reset;
-
- /** Object pointer for the hypervisor code */
- ObjectFile *hypervisor;
-
- /** Object pointer for the openboot code */
- ObjectFile *openboot;
-
- /** Object pointer for the nvram image */
- ObjectFile *nvram;
-
- /** Object pointer for the hypervisor description image */
- ObjectFile *hypervisor_desc;
-
- /** Object pointer for the partition description image */
- ObjectFile *partition_desc;
-
- protected:
- const Params *params() const { return (const Params *)&_params; }
-
- /** Add a function-based event to reset binary. */
- template <class T>
- T *
- addResetFuncEvent(const char *lbl)
- {
- return addFuncEvent<T>(resetSymtab, lbl);
- }
-
- /** Add a function-based event to the hypervisor. */
- template <class T>
- T *
- addHypervisorFuncEvent(const char *lbl)
- {
- return addFuncEvent<T>(hypervisorSymtab, lbl);
- }
-
- /** Add a function-based event to the openboot. */
- template <class T>
- T *
- addOpenbootFuncEvent(const char *lbl)
- {
- return addFuncEvent<T>(openbootSymtab, lbl);
- }
};
} // namespace SparcISA