VirtIO.py revision 11478:c926270c33c8
18981Sandreas.hansson@arm.com# -*- mode:python -*-
210744SGeoffrey.Blake@arm.com
38981Sandreas.hansson@arm.com# Copyright (c) 2014 ARM Limited
48981Sandreas.hansson@arm.com# All rights reserved.
58981Sandreas.hansson@arm.com#
68981Sandreas.hansson@arm.com# The license below extends only to copyright in the software and shall
78981Sandreas.hansson@arm.com# not be construed as granting a license to any other intellectual
88981Sandreas.hansson@arm.com# property including but not limited to intellectual property relating
98981Sandreas.hansson@arm.com# to a hardware implementation of the functionality of the software
108981Sandreas.hansson@arm.com# licensed hereunder.  You may use the software subject to the license
118981Sandreas.hansson@arm.com# terms below provided that you ensure that this notice is replicated
128981Sandreas.hansson@arm.com# unmodified and in its entirety in all distributions of the software,
138981Sandreas.hansson@arm.com# modified or unmodified, in source code or in binary form.
148981Sandreas.hansson@arm.com#
158981Sandreas.hansson@arm.com# Redistribution and use in source and binary forms, with or without
168981Sandreas.hansson@arm.com# modification, are permitted provided that the following conditions are
178981Sandreas.hansson@arm.com# met: redistributions of source code must retain the above copyright
188981Sandreas.hansson@arm.com# notice, this list of conditions and the following disclaimer;
198981Sandreas.hansson@arm.com# redistributions in binary form must reproduce the above copyright
208981Sandreas.hansson@arm.com# notice, this list of conditions and the following disclaimer in the
218981Sandreas.hansson@arm.com# documentation and/or other materials provided with the distribution;
228981Sandreas.hansson@arm.com# neither the name of the copyright holders nor the names of its
238981Sandreas.hansson@arm.com# contributors may be used to endorse or promote products derived from
248981Sandreas.hansson@arm.com# this software without specific prior written permission.
258981Sandreas.hansson@arm.com#
268981Sandreas.hansson@arm.com# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
278981Sandreas.hansson@arm.com# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
288981Sandreas.hansson@arm.com# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
298981Sandreas.hansson@arm.com# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
308981Sandreas.hansson@arm.com# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
318981Sandreas.hansson@arm.com# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
328981Sandreas.hansson@arm.com# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
338981Sandreas.hansson@arm.com# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
348981Sandreas.hansson@arm.com# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
358981Sandreas.hansson@arm.com# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
368981Sandreas.hansson@arm.com# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
378981Sandreas.hansson@arm.com#
388981Sandreas.hansson@arm.com# Authors: Andreas Sandberg
398981Sandreas.hansson@arm.com
408981Sandreas.hansson@arm.comfrom m5.SimObject import SimObject
419398Sandreas.hansson@arm.comfrom m5.params import *
429398Sandreas.hansson@arm.comfrom m5.proxy import *
439356Snilay@cs.wisc.edufrom Device import PioDevice
448981Sandreas.hansson@arm.comfrom PciDevice import PciDevice
458981Sandreas.hansson@arm.com
469398Sandreas.hansson@arm.com
478981Sandreas.hansson@arm.comclass VirtIODeviceBase(SimObject):
488981Sandreas.hansson@arm.com    type = 'VirtIODeviceBase'
498981Sandreas.hansson@arm.com    cxx_header = 'dev/virtio/base.hh'
508981Sandreas.hansson@arm.com    abstract = True
518981Sandreas.hansson@arm.com
528981Sandreas.hansson@arm.com    subsystem = Param.UInt8(0x00, "VirtIO subsystem ID")
538981Sandreas.hansson@arm.com
548981Sandreas.hansson@arm.com    system = Param.System(Parent.any, "system object")
5510902Sandreas.sandberg@arm.com
568981Sandreas.hansson@arm.comclass PciVirtIO(PciDevice):
578981Sandreas.hansson@arm.com    type = 'PciVirtIO'
5810615Skanishk.sugand@arm.com    cxx_header = 'dev/virtio/pci.hh'
5910902Sandreas.sandberg@arm.com
6010902Sandreas.sandberg@arm.com    vio = Param.VirtIODeviceBase("VirtIO device")
6110902Sandreas.sandberg@arm.com
628981Sandreas.hansson@arm.com    VendorID = 0x1AF4
6310189Ssascha.bischoff@ARM.com    SubsystemVendorID = VendorID;
6410189Ssascha.bischoff@ARM.com    DeviceID = 0x1000
6510189Ssascha.bischoff@ARM.com
6610189Ssascha.bischoff@ARM.com    ClassCode = 0xff # Misc device
6710189Ssascha.bischoff@ARM.com
6810189Ssascha.bischoff@ARM.com    BAR0 = 0x00000001 # Anywhere in 32-bit space; IOREG
6910189Ssascha.bischoff@ARM.com    BAR0Size = '0B' # Overridden by the device model
7010189Ssascha.bischoff@ARM.com
7110189Ssascha.bischoff@ARM.com    InterruptPin = 0x01 # Use #INTA
7210189Ssascha.bischoff@ARM.com