PciDevice.py revision 9198
112837Sgabeblack@google.com# Copyright (c) 2005-2007 The Regents of The University of Michigan
212837Sgabeblack@google.com# All rights reserved.
312837Sgabeblack@google.com#
412837Sgabeblack@google.com# Redistribution and use in source and binary forms, with or without
512837Sgabeblack@google.com# modification, are permitted provided that the following conditions are
612837Sgabeblack@google.com# met: redistributions of source code must retain the above copyright
712837Sgabeblack@google.com# notice, this list of conditions and the following disclaimer;
812837Sgabeblack@google.com# redistributions in binary form must reproduce the above copyright
912837Sgabeblack@google.com# notice, this list of conditions and the following disclaimer in the
1012837Sgabeblack@google.com# documentation and/or other materials provided with the distribution;
1112837Sgabeblack@google.com# neither the name of the copyright holders nor the names of its
1212837Sgabeblack@google.com# contributors may be used to endorse or promote products derived from
1312837Sgabeblack@google.com# this software without specific prior written permission.
1412837Sgabeblack@google.com#
1512837Sgabeblack@google.com# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
1612837Sgabeblack@google.com# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
1712837Sgabeblack@google.com# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
1812837Sgabeblack@google.com# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
1912837Sgabeblack@google.com# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
2012837Sgabeblack@google.com# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
2112837Sgabeblack@google.com# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
2212837Sgabeblack@google.com# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
2312837Sgabeblack@google.com# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2412837Sgabeblack@google.com# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
2512837Sgabeblack@google.com# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2612837Sgabeblack@google.com#
2712837Sgabeblack@google.com# Authors: Nathan Binkert
2812837Sgabeblack@google.com
2912837Sgabeblack@google.comfrom m5.SimObject import SimObject
3013039Sgabeblack@google.comfrom m5.params import *
3113039Sgabeblack@google.comfrom m5.proxy import *
3212837Sgabeblack@google.comfrom Device import BasicPioDevice, DmaDevice, PioDevice
3312989Sgabeblack@google.com
3412986Sgabeblack@google.comclass PciConfigAll(PioDevice):
3513039Sgabeblack@google.com    type = 'PciConfigAll'
3613149Sgabeblack@google.com    platform = Param.Platform(Parent.any, "Platform this device is part of.")
3712837Sgabeblack@google.com    pio_latency = Param.Latency('30ns', "Programmed IO latency")
3813149Sgabeblack@google.com    bus = Param.UInt8(0x00, "PCI bus to act as config space for")
3912837Sgabeblack@google.com    size = Param.MemorySize32('16MB', "Size of config space")
4012837Sgabeblack@google.com
4112837Sgabeblack@google.com
4212837Sgabeblack@google.comclass PciDevice(DmaDevice):
4312983Sgabeblack@google.com    type = 'PciDevice'
4412837Sgabeblack@google.com    abstract = True
4512983Sgabeblack@google.com    platform = Param.Platform(Parent.any, "Platform this device is part of.")
4612983Sgabeblack@google.com    config = SlavePort("PCI configuration space port")
4712983Sgabeblack@google.com    pci_bus = Param.Int("PCI bus")
4812983Sgabeblack@google.com    pci_dev = Param.Int("PCI device number")
4912983Sgabeblack@google.com    pci_func = Param.Int("PCI function code")
5012983Sgabeblack@google.com    pio_latency = Param.Latency('30ns', "Programmed IO latency")
5112983Sgabeblack@google.com    config_latency = Param.Latency('20ns', "Config read or write latency")
5212983Sgabeblack@google.com
5312983Sgabeblack@google.com    VendorID = Param.UInt16("Vendor ID")
5412983Sgabeblack@google.com    DeviceID = Param.UInt16("Device ID")
5512983Sgabeblack@google.com    Command = Param.UInt16(0, "Command")
5612983Sgabeblack@google.com    Status = Param.UInt16(0, "Status")
5712983Sgabeblack@google.com    Revision = Param.UInt8(0, "Device")
5812983Sgabeblack@google.com    ProgIF = Param.UInt8(0, "Programming Interface")
5912983Sgabeblack@google.com    SubClassCode = Param.UInt8(0, "Sub-Class Code")
6012983Sgabeblack@google.com    ClassCode = Param.UInt8(0, "Class Code")
6112983Sgabeblack@google.com    CacheLineSize = Param.UInt8(0, "System Cacheline Size")
6212983Sgabeblack@google.com    LatencyTimer = Param.UInt8(0, "PCI Latency Timer")
6312983Sgabeblack@google.com    HeaderType = Param.UInt8(0, "PCI Header Type")
6413039Sgabeblack@google.com    BIST = Param.UInt8(0, "Built In Self Test")
6513039Sgabeblack@google.com
6613039Sgabeblack@google.com    BAR0 = Param.UInt32(0x00, "Base Address Register 0")
6713039Sgabeblack@google.com    BAR1 = Param.UInt32(0x00, "Base Address Register 1")
6813039Sgabeblack@google.com    BAR2 = Param.UInt32(0x00, "Base Address Register 2")
6913039Sgabeblack@google.com    BAR3 = Param.UInt32(0x00, "Base Address Register 3")
7013039Sgabeblack@google.com    BAR4 = Param.UInt32(0x00, "Base Address Register 4")
7113039Sgabeblack@google.com    BAR5 = Param.UInt32(0x00, "Base Address Register 5")
7213039Sgabeblack@google.com    BAR0Size = Param.MemorySize32('0B', "Base Address Register 0 Size")
7313039Sgabeblack@google.com    BAR1Size = Param.MemorySize32('0B', "Base Address Register 1 Size")
7413039Sgabeblack@google.com    BAR2Size = Param.MemorySize32('0B', "Base Address Register 2 Size")
7513039Sgabeblack@google.com    BAR3Size = Param.MemorySize32('0B', "Base Address Register 3 Size")
7613039Sgabeblack@google.com    BAR4Size = Param.MemorySize32('0B', "Base Address Register 4 Size")
7713039Sgabeblack@google.com    BAR5Size = Param.MemorySize32('0B', "Base Address Register 5 Size")
7813039Sgabeblack@google.com    BAR0LegacyIO = Param.Bool(False, "Whether BAR0 is hardwired legacy IO")
7912986Sgabeblack@google.com    BAR1LegacyIO = Param.Bool(False, "Whether BAR1 is hardwired legacy IO")
8013039Sgabeblack@google.com    BAR2LegacyIO = Param.Bool(False, "Whether BAR2 is hardwired legacy IO")
8112986Sgabeblack@google.com    BAR3LegacyIO = Param.Bool(False, "Whether BAR3 is hardwired legacy IO")
8213039Sgabeblack@google.com    BAR4LegacyIO = Param.Bool(False, "Whether BAR4 is hardwired legacy IO")
8313039Sgabeblack@google.com    BAR5LegacyIO = Param.Bool(False, "Whether BAR5 is hardwired legacy IO")
8413039Sgabeblack@google.com
8513039Sgabeblack@google.com    CardbusCIS = Param.UInt32(0x00, "Cardbus Card Information Structure")
8613039Sgabeblack@google.com    SubsystemID = Param.UInt16(0x00, "Subsystem ID")
8713039Sgabeblack@google.com    SubsystemVendorID = Param.UInt16(0x00, "Subsystem Vendor ID")
8813039Sgabeblack@google.com    ExpansionROM = Param.UInt32(0x00, "Expansion ROM Base Address")
8912986Sgabeblack@google.com    InterruptLine = Param.UInt8(0x00, "Interrupt Line")
9013039Sgabeblack@google.com    InterruptPin = Param.UInt8(0x00, "Interrupt Pin")
9113039Sgabeblack@google.com    MaximumLatency = Param.UInt8(0x00, "Maximum Latency")
9213039Sgabeblack@google.com    MinimumGrant = Param.UInt8(0x00, "Minimum Grant")
9312986Sgabeblack@google.com
9412986Sgabeblack@google.com
9512986Sgabeblack@google.com