baddev.cc revision 3918
1892SN/A/* 21762SN/A * Copyright (c) 2004-2005 The Regents of The University of Michigan 3892SN/A * All rights reserved. 4892SN/A * 5892SN/A * Redistribution and use in source and binary forms, with or without 6892SN/A * modification, are permitted provided that the following conditions are 7892SN/A * met: redistributions of source code must retain the above copyright 8892SN/A * notice, this list of conditions and the following disclaimer; 9892SN/A * redistributions in binary form must reproduce the above copyright 10892SN/A * notice, this list of conditions and the following disclaimer in the 11892SN/A * documentation and/or other materials provided with the distribution; 12892SN/A * neither the name of the copyright holders nor the names of its 13892SN/A * contributors may be used to endorse or promote products derived from 14892SN/A * this software without specific prior written permission. 15892SN/A * 16892SN/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 17892SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 18892SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 19892SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 20892SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 21892SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 22892SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23892SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24892SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25892SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 26892SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 272665Ssaidi@eecs.umich.edu * 282665Ssaidi@eecs.umich.edu * Authors: Ali Saidi 29892SN/A */ 30802SN/A 311722SN/A/** @file 32802SN/A * BadDevice implemenation 33802SN/A */ 34802SN/A 35802SN/A#include <deque> 36802SN/A#include <string> 37802SN/A#include <vector> 38802SN/A 39802SN/A#include "base/trace.hh" 40802SN/A#include "dev/baddev.hh" 411310SN/A#include "dev/platform.hh" 422542SN/A#include "mem/port.hh" 43802SN/A#include "sim/builder.hh" 44802SN/A#include "sim/system.hh" 45802SN/A 46802SN/Ausing namespace std; 472107SN/Ausing namespace TheISA; 48802SN/A 492539SN/ABadDevice::BadDevice(Params *p) 502542SN/A : BasicPioDevice(p), devname(p->device_name) 51802SN/A{ 523846Shsul@eecs.umich.edu pioSize = 0x10; 53802SN/A} 54802SN/A 55909SN/ATick 563349Sbinkertn@umich.eduBadDevice::read(PacketPtr pkt) 57909SN/A{ 582539SN/A panic("Device %s not imlpmented\n", devname); 593918Ssaidi@eecs.umich.edu M5_DUMMY_RETURN 602539SN/A} 612539SN/A 622539SN/ATick 633349Sbinkertn@umich.eduBadDevice::write(PacketPtr pkt) 642539SN/A{ 652539SN/A panic("Device %s not imlpmented\n", devname); 663918Ssaidi@eecs.umich.edu M5_DUMMY_RETURN 67909SN/A} 68802SN/A 69802SN/ABEGIN_DECLARE_SIM_OBJECT_PARAMS(BadDevice) 70802SN/A 712539SN/A Param<string> devicename; 722539SN/A Param<Addr> pio_addr; 732542SN/A SimObjectParam<System *> system; 741310SN/A SimObjectParam<Platform *> platform; 751310SN/A Param<Tick> pio_latency; 76802SN/A 77802SN/AEND_DECLARE_SIM_OBJECT_PARAMS(BadDevice) 78802SN/A 79802SN/ABEGIN_INIT_SIM_OBJECT_PARAMS(BadDevice) 80802SN/A 812539SN/A INIT_PARAM(devicename, "Name of device to error on"), 822539SN/A INIT_PARAM(pio_addr, "Device Address"), 832539SN/A INIT_PARAM(system, "system object"), 842539SN/A INIT_PARAM(platform, "platform"), 852539SN/A INIT_PARAM_DFLT(pio_latency, "Programmed IO latency", 1000) 86802SN/A 87802SN/AEND_INIT_SIM_OBJECT_PARAMS(BadDevice) 88802SN/A 89802SN/ACREATE_SIM_OBJECT(BadDevice) 90802SN/A{ 912539SN/A BadDevice::Params *p = new BadDevice::Params; 922539SN/A p->name =getInstanceName(); 932539SN/A p->platform = platform; 942539SN/A p->pio_addr = pio_addr; 952539SN/A p->pio_delay = pio_latency; 962539SN/A p->system = system; 972542SN/A p->device_name = devicename; 982539SN/A return new BadDevice(p); 99802SN/A} 100802SN/A 101802SN/AREGISTER_SIM_OBJECT("BadDevice", BadDevice) 102