Device.py revision 8742:9df38d259935
16313Sgblack@eecs.umich.edu# Copyright (c) 2005-2007 The Regents of The University of Michigan
211574SCurtis.Dunham@arm.com# All rights reserved.
37093Sgblack@eecs.umich.edu#
47093Sgblack@eecs.umich.edu# Redistribution and use in source and binary forms, with or without
57093Sgblack@eecs.umich.edu# modification, are permitted provided that the following conditions are
67093Sgblack@eecs.umich.edu# met: redistributions of source code must retain the above copyright
77093Sgblack@eecs.umich.edu# notice, this list of conditions and the following disclaimer;
87093Sgblack@eecs.umich.edu# redistributions in binary form must reproduce the above copyright
97093Sgblack@eecs.umich.edu# notice, this list of conditions and the following disclaimer in the
107093Sgblack@eecs.umich.edu# documentation and/or other materials provided with the distribution;
117093Sgblack@eecs.umich.edu# neither the name of the copyright holders nor the names of its
127093Sgblack@eecs.umich.edu# contributors may be used to endorse or promote products derived from
137093Sgblack@eecs.umich.edu# this software without specific prior written permission.
146313Sgblack@eecs.umich.edu#
156313Sgblack@eecs.umich.edu# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
166313Sgblack@eecs.umich.edu# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
176313Sgblack@eecs.umich.edu# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
186313Sgblack@eecs.umich.edu# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
196313Sgblack@eecs.umich.edu# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
206313Sgblack@eecs.umich.edu# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
216313Sgblack@eecs.umich.edu# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
226313Sgblack@eecs.umich.edu# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
236313Sgblack@eecs.umich.edu# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
246313Sgblack@eecs.umich.edu# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
256313Sgblack@eecs.umich.edu# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
266313Sgblack@eecs.umich.edu#
276313Sgblack@eecs.umich.edu# Authors: Nathan Binkert
286313Sgblack@eecs.umich.edu
296313Sgblack@eecs.umich.edufrom m5.params import *
306313Sgblack@eecs.umich.edufrom m5.proxy import *
316313Sgblack@eecs.umich.edufrom MemObject import MemObject
326313Sgblack@eecs.umich.edu
336313Sgblack@eecs.umich.educlass PioDevice(MemObject):
346313Sgblack@eecs.umich.edu    type = 'PioDevice'
356313Sgblack@eecs.umich.edu    abstract = True
366313Sgblack@eecs.umich.edu    pio = Port("Programmed I/O port")
376313Sgblack@eecs.umich.edu    system = Param.System(Parent.any, "System this device is part of")
386313Sgblack@eecs.umich.edu
396313Sgblack@eecs.umich.educlass BasicPioDevice(PioDevice):
406313Sgblack@eecs.umich.edu    type = 'BasicPioDevice'
416313Sgblack@eecs.umich.edu    abstract = True
426313Sgblack@eecs.umich.edu    pio_addr = Param.Addr("Device Address")
436313Sgblack@eecs.umich.edu    pio_latency = Param.Latency('1ns', "Programmed IO latency in simticks")
447404SAli.Saidi@ARM.com
456313Sgblack@eecs.umich.educlass DmaDevice(PioDevice):
4610461SAndreas.Sandberg@ARM.com    type = 'DmaDevice'
476333Sgblack@eecs.umich.edu    abstract = True
4810037SARM gem5 Developers    dma = Port(Self.pio.peerObj.port, "DMA port")
497404SAli.Saidi@ARM.com    min_backoff_delay = Param.Latency('4ns',
506313Sgblack@eecs.umich.edu      "min time between a nack packet being received and the next request made by the device")
518232Snate@binkert.org    max_backoff_delay = Param.Latency('10us',
529384SAndreas.Sandberg@arm.com      "max time between a nack packet being received and the next request made by the device")
5311165SRekai.GonzalezAlberquilla@arm.com
546313Sgblack@eecs.umich.edu
559384SAndreas.Sandberg@arm.com
5610461SAndreas.Sandberg@ARM.comclass IsaFake(BasicPioDevice):
576333Sgblack@eecs.umich.edu    type = 'IsaFake'
586313Sgblack@eecs.umich.edu    pio_size = Param.Addr(0x8, "Size of address range")
596313Sgblack@eecs.umich.edu    ret_data8 = Param.UInt8(0xFF, "Default data to return")
606313Sgblack@eecs.umich.edu    ret_data16 = Param.UInt16(0xFFFF, "Default data to return")
616313Sgblack@eecs.umich.edu    ret_data32 = Param.UInt32(0xFFFFFFFF, "Default data to return")
626313Sgblack@eecs.umich.edu    ret_data64 = Param.UInt64(0xFFFFFFFFFFFFFFFF, "Default data to return")
6310037SARM gem5 Developers    ret_bad_addr = Param.Bool(False, "Return pkt status bad address on access")
6410037SARM gem5 Developers    update_data = Param.Bool(False, "Update the data that is returned on writes")
6510037SARM gem5 Developers    warn_access = Param.String("", "String to print when device is accessed")
6610037SARM gem5 Developers    fake_mem = Param.Bool(False,
6710037SARM gem5 Developers      "Is this device acting like a memory and thus may get a cache line sized req")
6810037SARM gem5 Developers
6910037SARM gem5 Developersclass BadAddr(IsaFake):
7010037SARM gem5 Developers    pio_addr = 0
7110037SARM gem5 Developers    ret_bad_addr = Param.Bool(True, "Return pkt status bad address on access")
7210037SARM gem5 Developers
7310037SARM gem5 Developers
7410037SARM gem5 Developers