mm_disk.cc (4870:fcc39d001154) | mm_disk.cc (4918:3214e3694fb2) |
---|---|
1/* 2 * Copyright (c) 2006 The Regents of The University of Michigan 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are 7 * met: redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer; --- 26 unchanged lines hidden (view full) --- 35 36#include <cstring> 37 38#include "base/trace.hh" 39#include "dev/sparc/mm_disk.hh" 40#include "dev/platform.hh" 41#include "mem/port.hh" 42#include "mem/packet_access.hh" | 1/* 2 * Copyright (c) 2006 The Regents of The University of Michigan 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are 7 * met: redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer; --- 26 unchanged lines hidden (view full) --- 35 36#include <cstring> 37 38#include "base/trace.hh" 39#include "dev/sparc/mm_disk.hh" 40#include "dev/platform.hh" 41#include "mem/port.hh" 42#include "mem/packet_access.hh" |
43#include "sim/builder.hh" | |
44#include "sim/byteswap.hh" 45#include "sim/system.hh" 46 | 43#include "sim/byteswap.hh" 44#include "sim/system.hh" 45 |
47MmDisk::MmDisk(Params *p) | 46MmDisk::MmDisk(const Params *p) |
48 : BasicPioDevice(p), image(p->image), curSector((off_t)-1), dirty(false) 49{ 50 std::memset(&diskData, 0, SectorSize); 51 pioSize = image->size() * SectorSize; 52} 53 54Tick 55MmDisk::read(PacketPtr pkt) --- 110 unchanged lines hidden (view full) --- 166 // serialization 167 int bytes_read; 168 if (dirty) { 169 bytes_read = image->write(diskData, curSector); 170 assert(bytes_read == SectorSize); 171 } 172} 173 | 47 : BasicPioDevice(p), image(p->image), curSector((off_t)-1), dirty(false) 48{ 49 std::memset(&diskData, 0, SectorSize); 50 pioSize = image->size() * SectorSize; 51} 52 53Tick 54MmDisk::read(PacketPtr pkt) --- 110 unchanged lines hidden (view full) --- 165 // serialization 166 int bytes_read; 167 if (dirty) { 168 bytes_read = image->write(diskData, curSector); 169 assert(bytes_read == SectorSize); 170 } 171} 172 |
174 175 176 177BEGIN_DECLARE_SIM_OBJECT_PARAMS(MmDisk) 178 Param<Addr> pio_addr; 179 Param<Tick> pio_latency; 180 Param<Addr> pio_size; 181 SimObjectParam<Platform *> platform; 182 SimObjectParam<System *> system; 183 SimObjectParam<DiskImage *> image; 184END_DECLARE_SIM_OBJECT_PARAMS(MmDisk) 185 186BEGIN_INIT_SIM_OBJECT_PARAMS(MmDisk) 187 188 INIT_PARAM(pio_addr, "Device Address"), 189 INIT_PARAM(pio_latency, "Programmed IO latency"), 190 INIT_PARAM(pio_size, "Size of address range"), 191 INIT_PARAM(platform, "platform"), 192 INIT_PARAM(system, "system object"), 193 INIT_PARAM(image, "disk image") 194 195END_INIT_SIM_OBJECT_PARAMS(MmDisk) 196 197CREATE_SIM_OBJECT(MmDisk) | 173MmDisk * 174MmDiskParams::create() |
198{ | 175{ |
199 MmDisk::Params *p = new MmDisk::Params; 200 p->name = getInstanceName(); 201 p->pio_addr = pio_addr; 202 p->pio_delay = pio_latency; 203 p->platform = platform; 204 p->system = system; 205 p->image = image; 206 return new MmDisk(p); | 176 return new MmDisk(this); |
207} | 177} |
208 209REGISTER_SIM_OBJECT("MmDisk", MmDisk) | |