Tsunami.py revision 5480:b9460d7f74f0
15664Sgblack@eecs.umich.edu# Copyright (c) 2005-2007 The Regents of The University of Michigan
25664Sgblack@eecs.umich.edu# All rights reserved.
35664Sgblack@eecs.umich.edu#
45664Sgblack@eecs.umich.edu# Redistribution and use in source and binary forms, with or without
55664Sgblack@eecs.umich.edu# modification, are permitted provided that the following conditions are
65664Sgblack@eecs.umich.edu# met: redistributions of source code must retain the above copyright
75664Sgblack@eecs.umich.edu# notice, this list of conditions and the following disclaimer;
85664Sgblack@eecs.umich.edu# redistributions in binary form must reproduce the above copyright
95664Sgblack@eecs.umich.edu# notice, this list of conditions and the following disclaimer in the
105664Sgblack@eecs.umich.edu# documentation and/or other materials provided with the distribution;
115664Sgblack@eecs.umich.edu# neither the name of the copyright holders nor the names of its
125664Sgblack@eecs.umich.edu# contributors may be used to endorse or promote products derived from
135664Sgblack@eecs.umich.edu# this software without specific prior written permission.
145664Sgblack@eecs.umich.edu#
155664Sgblack@eecs.umich.edu# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
165664Sgblack@eecs.umich.edu# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
175664Sgblack@eecs.umich.edu# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
185664Sgblack@eecs.umich.edu# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
195664Sgblack@eecs.umich.edu# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
205664Sgblack@eecs.umich.edu# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
215664Sgblack@eecs.umich.edu# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
225664Sgblack@eecs.umich.edu# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
235664Sgblack@eecs.umich.edu# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
245664Sgblack@eecs.umich.edu# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
255664Sgblack@eecs.umich.edu# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
265664Sgblack@eecs.umich.edu#
275664Sgblack@eecs.umich.edu# Authors: Nathan Binkert
285664Sgblack@eecs.umich.edu
295664Sgblack@eecs.umich.edufrom m5.params import *
305664Sgblack@eecs.umich.edufrom m5.proxy import *
315664Sgblack@eecs.umich.edufrom BadDevice import BadDevice
325664Sgblack@eecs.umich.edufrom AlphaBackdoor import AlphaBackdoor
335664Sgblack@eecs.umich.edufrom Device import BasicPioDevice, IsaFake, BadAddr
345664Sgblack@eecs.umich.edufrom Pci import PciConfigAll
355664Sgblack@eecs.umich.edufrom Platform import Platform
365664Sgblack@eecs.umich.edufrom Uart import Uart8250
375664Sgblack@eecs.umich.edu
385664Sgblack@eecs.umich.educlass TsunamiCChip(BasicPioDevice):
395664Sgblack@eecs.umich.edu    type = 'TsunamiCChip'
405664Sgblack@eecs.umich.edu    tsunami = Param.Tsunami(Parent.any, "Tsunami")
415664Sgblack@eecs.umich.edu
42class TsunamiIO(BasicPioDevice):
43    type = 'TsunamiIO'
44    time = Param.Time('01/01/2009',
45        "System time to use ('Now' for actual time)")
46    year_is_bcd = Param.Bool(False,
47        "The RTC should interpret the year as a BCD value")
48    tsunami = Param.Tsunami(Parent.any, "Tsunami")
49    frequency = Param.Frequency('1024Hz', "frequency of interrupts")
50
51class TsunamiPChip(BasicPioDevice):
52    type = 'TsunamiPChip'
53    tsunami = Param.Tsunami(Parent.any, "Tsunami")
54
55class Tsunami(Platform):
56    type = 'Tsunami'
57    system = Param.System(Parent.any, "system")
58
59    cchip = TsunamiCChip(pio_addr=0x801a0000000)
60    pchip = TsunamiPChip(pio_addr=0x80180000000)
61    pciconfig = PciConfigAll()
62    fake_sm_chip = IsaFake(pio_addr=0x801fc000370)
63
64    fake_uart1 = IsaFake(pio_addr=0x801fc0002f8)
65    fake_uart2 = IsaFake(pio_addr=0x801fc0003e8)
66    fake_uart3 = IsaFake(pio_addr=0x801fc0002e8)
67    fake_uart4 = IsaFake(pio_addr=0x801fc0003f0)
68
69    fake_ppc = IsaFake(pio_addr=0x801fc0003bb)
70
71    fake_OROM = IsaFake(pio_addr=0x800000a0000, pio_size=0x60000)
72
73    fake_pnp_addr = IsaFake(pio_addr=0x801fc000279)
74    fake_pnp_write = IsaFake(pio_addr=0x801fc000a79)
75    fake_pnp_read0 = IsaFake(pio_addr=0x801fc000203)
76    fake_pnp_read1 = IsaFake(pio_addr=0x801fc000243)
77    fake_pnp_read2 = IsaFake(pio_addr=0x801fc000283)
78    fake_pnp_read3 = IsaFake(pio_addr=0x801fc0002c3)
79    fake_pnp_read4 = IsaFake(pio_addr=0x801fc000303)
80    fake_pnp_read5 = IsaFake(pio_addr=0x801fc000343)
81    fake_pnp_read6 = IsaFake(pio_addr=0x801fc000383)
82    fake_pnp_read7 = IsaFake(pio_addr=0x801fc0003c3)
83
84    fake_ata0 = IsaFake(pio_addr=0x801fc0001f0)
85    fake_ata1 = IsaFake(pio_addr=0x801fc000170)
86
87    fb = BadDevice(pio_addr=0x801fc0003d0, devicename='FrameBuffer')
88    io = TsunamiIO(pio_addr=0x801fc000000)
89    uart = Uart8250(pio_addr=0x801fc0003f8)
90    backdoor = AlphaBackdoor(pio_addr=0x80200000000, disk=Parent.simple_disk)
91
92    # Attach I/O devices to specified bus object.  Can't do this
93    # earlier, since the bus object itself is typically defined at the
94    # System level.
95    def attachIO(self, bus):
96        self.cchip.pio = bus.port
97        self.pchip.pio = bus.port
98        self.pciconfig.pio = bus.default
99        bus.responder_set = True
100        bus.responder = self.pciconfig
101        self.fake_sm_chip.pio = bus.port
102        self.fake_uart1.pio = bus.port
103        self.fake_uart2.pio = bus.port
104        self.fake_uart3.pio = bus.port
105        self.fake_uart4.pio = bus.port
106        self.fake_ppc.pio = bus.port
107        self.fake_OROM.pio = bus.port
108        self.fake_pnp_addr.pio = bus.port
109        self.fake_pnp_write.pio = bus.port
110        self.fake_pnp_read0.pio = bus.port
111        self.fake_pnp_read1.pio = bus.port
112        self.fake_pnp_read2.pio = bus.port
113        self.fake_pnp_read3.pio = bus.port
114        self.fake_pnp_read4.pio = bus.port
115        self.fake_pnp_read5.pio = bus.port
116        self.fake_pnp_read6.pio = bus.port
117        self.fake_pnp_read7.pio = bus.port
118        self.fake_ata0.pio = bus.port
119        self.fake_ata1.pio = bus.port
120        self.fb.pio = bus.port
121        self.io.pio = bus.port
122        self.uart.pio = bus.port
123        self.backdoor.pio = bus.port
124