Pc.py revision 5447
16145Snate@binkert.org# Copyright (c) 2008 The Regents of The University of Michigan
26145Snate@binkert.org# All rights reserved.
36145Snate@binkert.org#
46145Snate@binkert.org# Redistribution and use in source and binary forms, with or without
56145Snate@binkert.org# modification, are permitted provided that the following conditions are
66145Snate@binkert.org# met: redistributions of source code must retain the above copyright
76145Snate@binkert.org# notice, this list of conditions and the following disclaimer;
86145Snate@binkert.org# redistributions in binary form must reproduce the above copyright
96145Snate@binkert.org# notice, this list of conditions and the following disclaimer in the
106145Snate@binkert.org# documentation and/or other materials provided with the distribution;
116145Snate@binkert.org# neither the name of the copyright holders nor the names of its
126145Snate@binkert.org# contributors may be used to endorse or promote products derived from
136145Snate@binkert.org# this software without specific prior written permission.
146145Snate@binkert.org#
156145Snate@binkert.org# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
166145Snate@binkert.org# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
176145Snate@binkert.org# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
186145Snate@binkert.org# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
196145Snate@binkert.org# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
206145Snate@binkert.org# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
216145Snate@binkert.org# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
226145Snate@binkert.org# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
236145Snate@binkert.org# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
246145Snate@binkert.org# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
256145Snate@binkert.org# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
266145Snate@binkert.org#
276145Snate@binkert.org# Authors: Gabe Black
286145Snate@binkert.org
297832Snate@binkert.orgfrom m5.params import *
307832Snate@binkert.orgfrom m5.proxy import *
318645Snilay@cs.wisc.edufrom Uart import Uart8250
327054Snate@binkert.orgfrom Device import IsaFake
338232Snate@binkert.orgfrom SouthBridge import SouthBridge
3411092Snilay@cs.wisc.edufrom Platform import Platform
358229Snate@binkert.orgfrom Pci import PciConfigAll
3610301Snilay@cs.wisc.edufrom SimConsole import SimConsole
376154Snate@binkert.org
3810895Snilay@cs.wisc.edudef x86IOAddress(port):
3911108Sdavid.hashe@amd.com    IO_address_space_base = 0x8000000000000000
406145Snate@binkert.org    return IO_address_space_base + port;
417055Snate@binkert.org
427055Snate@binkert.orgclass PC(Platform):
436145Snate@binkert.org    type = 'PC'
446145Snate@binkert.org    system = Param.System(Parent.any, "system")
456145Snate@binkert.org
466145Snate@binkert.org    pciconfig = PciConfigAll()
476145Snate@binkert.org
4810895Snilay@cs.wisc.edu    south_bridge = SouthBridge()
496145Snate@binkert.org
5010918Sbrandon.potter@amd.com    # "Non-existant" port used for timing purposes by the linux kernel
519230Snilay@cs.wisc.edu    i_dont_exist = IsaFake(pio_addr=x86IOAddress(0x80), pio_size=1)
5211092Snilay@cs.wisc.edu
5311092Snilay@cs.wisc.edu    # Ports behind the pci config and data regsiters. These don't do anything,
5411092Snilay@cs.wisc.edu    # but the linux kernel fiddles with them anway.
556145Snate@binkert.org    behind_pci = IsaFake(pio_addr=x86IOAddress(0xcf8), pio_size=8)
5610370Snilay@cs.wisc.edu
5710370Snilay@cs.wisc.edu    # Serial port and console
587832Snate@binkert.org    console = SimConsole()
597054Snate@binkert.org    com_1 = Uart8250()
6010311Snilay@cs.wisc.edu    com_1.pio_addr = x86IOAddress(0x3f8)
617054Snate@binkert.org    com_1.sim_console = console
628259SBrad.Beckmann@amd.com
636145Snate@binkert.org    def attachIO(self, bus):
647054Snate@binkert.org        self.south_bridge.pio = bus.port
659863Snilay@cs.wisc.edu        self.i_dont_exist.pio = bus.port
666145Snate@binkert.org        self.behind_pci.pio = bus.port
676145Snate@binkert.org        self.com_1.pio = bus.port
687054Snate@binkert.org        self.pciconfig.pio = bus.default
6910370Snilay@cs.wisc.edu        bus.responder_set = True
7010370Snilay@cs.wisc.edu        bus.responder = self.pciconfig
716145Snate@binkert.org