PciDevice.py revision 9198
1# Copyright (c) 2005-2007 The Regents of The University of Michigan
2# All rights reserved.
3#
4# Redistribution and use in source and binary forms, with or without
5# modification, are permitted provided that the following conditions are
6# met: redistributions of source code must retain the above copyright
7# notice, this list of conditions and the following disclaimer;
8# redistributions in binary form must reproduce the above copyright
9# notice, this list of conditions and the following disclaimer in the
10# documentation and/or other materials provided with the distribution;
11# neither the name of the copyright holders nor the names of its
12# contributors may be used to endorse or promote products derived from
13# this software without specific prior written permission.
14#
15# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
16# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
17# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
18# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
19# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
20# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
21# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26#
27# Authors: Nathan Binkert
28
29from m5.SimObject import SimObject
30from m5.params import *
31from m5.proxy import *
32from Device import BasicPioDevice, DmaDevice, PioDevice
33
34class PciConfigAll(PioDevice):
35    type = 'PciConfigAll'
36    platform = Param.Platform(Parent.any, "Platform this device is part of.")
37    pio_latency = Param.Latency('30ns', "Programmed IO latency")
38    bus = Param.UInt8(0x00, "PCI bus to act as config space for")
39    size = Param.MemorySize32('16MB', "Size of config space")
40
41
42class PciDevice(DmaDevice):
43    type = 'PciDevice'
44    abstract = True
45    platform = Param.Platform(Parent.any, "Platform this device is part of.")
46    config = SlavePort("PCI configuration space port")
47    pci_bus = Param.Int("PCI bus")
48    pci_dev = Param.Int("PCI device number")
49    pci_func = Param.Int("PCI function code")
50    pio_latency = Param.Latency('30ns', "Programmed IO latency")
51    config_latency = Param.Latency('20ns', "Config read or write latency")
52
53    VendorID = Param.UInt16("Vendor ID")
54    DeviceID = Param.UInt16("Device ID")
55    Command = Param.UInt16(0, "Command")
56    Status = Param.UInt16(0, "Status")
57    Revision = Param.UInt8(0, "Device")
58    ProgIF = Param.UInt8(0, "Programming Interface")
59    SubClassCode = Param.UInt8(0, "Sub-Class Code")
60    ClassCode = Param.UInt8(0, "Class Code")
61    CacheLineSize = Param.UInt8(0, "System Cacheline Size")
62    LatencyTimer = Param.UInt8(0, "PCI Latency Timer")
63    HeaderType = Param.UInt8(0, "PCI Header Type")
64    BIST = Param.UInt8(0, "Built In Self Test")
65
66    BAR0 = Param.UInt32(0x00, "Base Address Register 0")
67    BAR1 = Param.UInt32(0x00, "Base Address Register 1")
68    BAR2 = Param.UInt32(0x00, "Base Address Register 2")
69    BAR3 = Param.UInt32(0x00, "Base Address Register 3")
70    BAR4 = Param.UInt32(0x00, "Base Address Register 4")
71    BAR5 = Param.UInt32(0x00, "Base Address Register 5")
72    BAR0Size = Param.MemorySize32('0B', "Base Address Register 0 Size")
73    BAR1Size = Param.MemorySize32('0B', "Base Address Register 1 Size")
74    BAR2Size = Param.MemorySize32('0B', "Base Address Register 2 Size")
75    BAR3Size = Param.MemorySize32('0B', "Base Address Register 3 Size")
76    BAR4Size = Param.MemorySize32('0B', "Base Address Register 4 Size")
77    BAR5Size = Param.MemorySize32('0B', "Base Address Register 5 Size")
78    BAR0LegacyIO = Param.Bool(False, "Whether BAR0 is hardwired legacy IO")
79    BAR1LegacyIO = Param.Bool(False, "Whether BAR1 is hardwired legacy IO")
80    BAR2LegacyIO = Param.Bool(False, "Whether BAR2 is hardwired legacy IO")
81    BAR3LegacyIO = Param.Bool(False, "Whether BAR3 is hardwired legacy IO")
82    BAR4LegacyIO = Param.Bool(False, "Whether BAR4 is hardwired legacy IO")
83    BAR5LegacyIO = Param.Bool(False, "Whether BAR5 is hardwired legacy IO")
84
85    CardbusCIS = Param.UInt32(0x00, "Cardbus Card Information Structure")
86    SubsystemID = Param.UInt16(0x00, "Subsystem ID")
87    SubsystemVendorID = Param.UInt16(0x00, "Subsystem Vendor ID")
88    ExpansionROM = Param.UInt32(0x00, "Expansion ROM Base Address")
89    InterruptLine = Param.UInt8(0x00, "Interrupt Line")
90    InterruptPin = Param.UInt8(0x00, "Interrupt Pin")
91    MaximumLatency = Param.UInt8(0x00, "Maximum Latency")
92    MinimumGrant = Param.UInt8(0x00, "Minimum Grant")
93
94
95