PciDevice.py revision 4486
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 PciConfigData(SimObject): 35 type = 'PciConfigData' 36 VendorID = Param.UInt16("Vendor ID") 37 DeviceID = Param.UInt16("Device ID") 38 Command = Param.UInt16(0, "Command") 39 Status = Param.UInt16(0, "Status") 40 Revision = Param.UInt8(0, "Device") 41 ProgIF = Param.UInt8(0, "Programming Interface") 42 SubClassCode = Param.UInt8(0, "Sub-Class Code") 43 ClassCode = Param.UInt8(0, "Class Code") 44 CacheLineSize = Param.UInt8(0, "System Cacheline Size") 45 LatencyTimer = Param.UInt8(0, "PCI Latency Timer") 46 HeaderType = Param.UInt8(0, "PCI Header Type") 47 BIST = Param.UInt8(0, "Built In Self Test") 48 49 BAR0 = Param.UInt32(0x00, "Base Address Register 0") 50 BAR1 = Param.UInt32(0x00, "Base Address Register 1") 51 BAR2 = Param.UInt32(0x00, "Base Address Register 2") 52 BAR3 = Param.UInt32(0x00, "Base Address Register 3") 53 BAR4 = Param.UInt32(0x00, "Base Address Register 4") 54 BAR5 = Param.UInt32(0x00, "Base Address Register 5") 55 BAR0Size = Param.MemorySize32('0B', "Base Address Register 0 Size") 56 BAR1Size = Param.MemorySize32('0B', "Base Address Register 1 Size") 57 BAR2Size = Param.MemorySize32('0B', "Base Address Register 2 Size") 58 BAR3Size = Param.MemorySize32('0B', "Base Address Register 3 Size") 59 BAR4Size = Param.MemorySize32('0B', "Base Address Register 4 Size") 60 BAR5Size = Param.MemorySize32('0B', "Base Address Register 5 Size") 61 62 CardbusCIS = Param.UInt32(0x00, "Cardbus Card Information Structure") 63 SubsystemID = Param.UInt16(0x00, "Subsystem ID") 64 SubsystemVendorID = Param.UInt16(0x00, "Subsystem Vendor ID") 65 ExpansionROM = Param.UInt32(0x00, "Expansion ROM Base Address") 66 InterruptLine = Param.UInt8(0x00, "Interrupt Line") 67 InterruptPin = Param.UInt8(0x00, "Interrupt Pin") 68 MaximumLatency = Param.UInt8(0x00, "Maximum Latency") 69 MinimumGrant = Param.UInt8(0x00, "Minimum Grant") 70 71class PciConfigAll(PioDevice): 72 type = 'PciConfigAll' 73 pio_latency = Param.Tick(1, "Programmed IO latency in simticks") 74 bus = Param.UInt8(0x00, "PCI bus to act as config space for") 75 size = Param.MemorySize32('16MB', "Size of config space") 76 77 78class PciDevice(DmaDevice): 79 type = 'PciDevice' 80 abstract = True 81 config = Port(Self.pio.peerObj.port, "PCI configuration space port") 82 pci_bus = Param.Int("PCI bus") 83 pci_dev = Param.Int("PCI device number") 84 pci_func = Param.Int("PCI function code") 85 pio_latency = Param.Latency('1ns', "Programmed IO latency in simticks") 86 configdata = Param.PciConfigData(Parent.any, "PCI Config data") 87 config_latency = Param.Latency('20ns', "Config read or write latency") 88