mm_disk.cc (4198:4ada78de338c) | mm_disk.cc (4762:c94e103c83ad) |
---|---|
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) --- 112 unchanged lines hidden (view full) --- 168 // serialization 169 int bytes_read; 170 if (dirty) { 171 bytes_read = image->write(diskData, curSector); 172 assert(bytes_read == SectorSize); 173 } 174} 175 | 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) --- 112 unchanged lines hidden (view full) --- 167 // serialization 168 int bytes_read; 169 if (dirty) { 170 bytes_read = image->write(diskData, curSector); 171 assert(bytes_read == SectorSize); 172 } 173} 174 |
176 177 178 179BEGIN_DECLARE_SIM_OBJECT_PARAMS(MmDisk) 180 Param<Addr> pio_addr; 181 Param<Tick> pio_latency; 182 Param<Addr> pio_size; 183 SimObjectParam<Platform *> platform; 184 SimObjectParam<System *> system; 185 SimObjectParam<DiskImage *> image; 186END_DECLARE_SIM_OBJECT_PARAMS(MmDisk) 187 188BEGIN_INIT_SIM_OBJECT_PARAMS(MmDisk) 189 190 INIT_PARAM(pio_addr, "Device Address"), 191 INIT_PARAM(pio_latency, "Programmed IO latency"), 192 INIT_PARAM(pio_size, "Size of address range"), 193 INIT_PARAM(platform, "platform"), 194 INIT_PARAM(system, "system object"), 195 INIT_PARAM(image, "disk image") 196 197END_INIT_SIM_OBJECT_PARAMS(MmDisk) 198 199CREATE_SIM_OBJECT(MmDisk) | 175MmDisk * 176MmDiskParams::create() |
200{ | 177{ |
201 MmDisk::Params *p = new MmDisk::Params; 202 p->name = getInstanceName(); 203 p->pio_addr = pio_addr; 204 p->pio_delay = pio_latency; 205 p->platform = platform; 206 p->system = system; 207 p->image = image; 208 return new MmDisk(p); | 178 return new MmDisk(this); |
209} | 179} |
210 211REGISTER_SIM_OBJECT("MmDisk", MmDisk) | |