Update scripts for testing ALPHA_FS and MIPS_SE.
[gem5.git] / configs / test / fs.py
1 import m5
2 from m5.objects import *
3 import os
4 from SysPaths import *
5
6 parser = optparse.OptionParser(option_list=m5.standardOptions)
7
8 parser.add_option("-t", "--timing", action="store_true")
9
10 (options, args) = parser.parse_args()
11
12 if args:
13 print "Error: script doesn't take any positional arguments"
14 sys.exit(1)
15
16 # Base for tests is directory containing this file.
17 test_base = os.path.dirname(__file__)
18
19 linux_image = env.get('LINUX_IMAGE', disk('linux-latest.img'))
20
21 class IdeControllerPciData(PciConfigData):
22 VendorID = 0x8086
23 DeviceID = 0x7111
24 Command = 0x0
25 Status = 0x280
26 Revision = 0x0
27 ClassCode = 0x01
28 SubClassCode = 0x01
29 ProgIF = 0x85
30 BAR0 = 0x00000001
31 BAR1 = 0x00000001
32 BAR2 = 0x00000001
33 BAR3 = 0x00000001
34 BAR4 = 0x00000001
35 BAR5 = 0x00000001
36 InterruptLine = 0x1f
37 InterruptPin = 0x01
38 BAR0Size = '8B'
39 BAR1Size = '4B'
40 BAR2Size = '8B'
41 BAR3Size = '4B'
42 BAR4Size = '16B'
43
44 class SinicPciData(PciConfigData):
45 VendorID = 0x1291
46 DeviceID = 0x1293
47 Status = 0x0290
48 SubClassCode = 0x00
49 ClassCode = 0x02
50 ProgIF = 0x00
51 BAR0 = 0x00000000
52 BAR1 = 0x00000000
53 BAR2 = 0x00000000
54 BAR3 = 0x00000000
55 BAR4 = 0x00000000
56 BAR5 = 0x00000000
57 MaximumLatency = 0x34
58 MinimumGrant = 0xb0
59 InterruptLine = 0x1e
60 InterruptPin = 0x01
61 BAR0Size = '64kB'
62
63 class NSGigEPciData(PciConfigData):
64 VendorID = 0x100B
65 DeviceID = 0x0022
66 Status = 0x0290
67 SubClassCode = 0x00
68 ClassCode = 0x02
69 ProgIF = 0x00
70 BAR0 = 0x00000001
71 BAR1 = 0x00000000
72 BAR2 = 0x00000000
73 BAR3 = 0x00000000
74 BAR4 = 0x00000000
75 BAR5 = 0x00000000
76 MaximumLatency = 0x34
77 MinimumGrant = 0xb0
78 InterruptLine = 0x1e
79 InterruptPin = 0x01
80 BAR0Size = '256B'
81 BAR1Size = '4kB'
82
83 class LinuxRootDisk(IdeDisk):
84 raw_image = RawDiskImage(image_file=linux_image, read_only=True)
85 image = CowDiskImage(child=Parent.raw_image, read_only=False)
86
87 class LinuxSwapDisk(IdeDisk):
88 raw_image = RawDiskImage(image_file = disk('linux-bigswap2.img'),
89 read_only=True)
90 image = CowDiskImage(child = Parent.raw_image, read_only=False)
91
92 class SpecwebFilesetDisk(IdeDisk):
93 raw_image = RawDiskImage(image_file = disk('specweb-fileset.img'),
94 read_only=True)
95 image = CowDiskImage(child = Parent.raw_image, read_only=False)
96
97 class BaseTsunami(Tsunami):
98 cchip = TsunamiCChip(pio_addr=0x801a0000000)
99 pchip = TsunamiPChip(pio_addr=0x80180000000)
100 pciconfig = PciConfigAll(pio_addr=0x801fe000000)
101 fake_sm_chip = IsaFake(pio_addr=0x801fc000370)
102
103 fake_uart1 = IsaFake(pio_addr=0x801fc0002f8)
104 fake_uart2 = IsaFake(pio_addr=0x801fc0003e8)
105 fake_uart3 = IsaFake(pio_addr=0x801fc0002e8)
106 fake_uart4 = IsaFake(pio_addr=0x801fc0003f0)
107
108 fake_ppc = IsaFake(pio_addr=0x801fc0003bc)
109
110 fake_OROM = IsaFake(pio_addr=0x800000a0000, pio_size=0x60000)
111
112 fake_pnp_addr = IsaFake(pio_addr=0x801fc000279)
113 fake_pnp_write = IsaFake(pio_addr=0x801fc000a79)
114 fake_pnp_read0 = IsaFake(pio_addr=0x801fc000203)
115 fake_pnp_read1 = IsaFake(pio_addr=0x801fc000243)
116 fake_pnp_read2 = IsaFake(pio_addr=0x801fc000283)
117 fake_pnp_read3 = IsaFake(pio_addr=0x801fc0002c3)
118 fake_pnp_read4 = IsaFake(pio_addr=0x801fc000303)
119 fake_pnp_read5 = IsaFake(pio_addr=0x801fc000343)
120 fake_pnp_read6 = IsaFake(pio_addr=0x801fc000383)
121 fake_pnp_read7 = IsaFake(pio_addr=0x801fc0003c3)
122
123 fake_ata0 = IsaFake(pio_addr=0x801fc0001f0)
124 fake_ata1 = IsaFake(pio_addr=0x801fc000170)
125
126 fb = BadDevice(pio_addr=0x801fc0003d0, devicename='FrameBuffer')
127 io = TsunamiIO(pio_addr=0x801fc000000)
128 uart = Uart8250(pio_addr=0x801fc0003f8)
129 ethernet = NSGigE(configdata=NSGigEPciData(),
130 pci_bus=0, pci_dev=1, pci_func=0)
131 etherint = NSGigEInt(device=Parent.ethernet)
132 # ethernet = Sinic(configdata=SinicPciData(),
133 # pci_bus=0, pci_dev=1, pci_func=0)
134 # etherint = SinicInt(device=Parent.ethernet)
135 console = AlphaConsole(pio_addr=0x80200000000, disk=Parent.simple_disk)
136 # bridge = PciFake(configdata=BridgePciData(), pci_bus=0, pci_dev=2, pci_func=0)
137
138 #class FreeBSDTsunami(BaseTsunami):
139 # disk0 = FreeBSDRootDisk(delay='0us', driveID='master')
140 # ide = IdeController(disks=[Parent.disk0],
141 # configdata=IdeControllerPciData(),
142 # pci_func=0, pci_dev=0, pci_bus=0)
143
144 class LinuxTsunami(BaseTsunami):
145 disk0 = LinuxRootDisk(driveID='master')
146 disk1 = SpecwebFilesetDisk(driveID='slave')
147 disk2 = LinuxSwapDisk(driveID='master')
148 ide = IdeController(disks=[Parent.disk0, Parent.disk1, Parent.disk2],
149 configdata=IdeControllerPciData(),
150 pci_func=0, pci_dev=0, pci_bus=0)
151
152 class LinuxAlphaSystem(LinuxAlphaSystem):
153 magicbus = Bus(bus_id=0)
154 magicbus2 = Bus(bus_id=1)
155 bridge = Bridge()
156 physmem = PhysicalMemory(range = AddrRange('128MB'))
157 c0a = Connector(side_a=Parent.magicbus, side_b=Parent.bridge, side_b_name="side_a")
158 c0b = Connector(side_a=Parent.magicbus2, side_b=Parent.bridge, side_b_name="side_b")
159 c1 = Connector(side_a=Parent.physmem, side_b=Parent.magicbus2)
160 tsunami = LinuxTsunami()
161 c2 = Connector(side_a=Parent.tsunami.cchip, side_a_name='pio', side_b=Parent.magicbus)
162 c3 = Connector(side_a=Parent.tsunami.pchip, side_a_name='pio', side_b=Parent.magicbus)
163 c4 = Connector(side_a=Parent.tsunami.pciconfig, side_a_name='pio', side_b=Parent.magicbus)
164 c5 = Connector(side_a=Parent.tsunami.fake_sm_chip, side_a_name='pio', side_b=Parent.magicbus)
165 c6 = Connector(side_a=Parent.tsunami.ethernet, side_a_name='pio', side_b=Parent.magicbus)
166 c6a = Connector(side_a=Parent.tsunami.ethernet, side_a_name='dma', side_b=Parent.magicbus)
167 c7 = Connector(side_a=Parent.tsunami.fake_uart1, side_a_name='pio', side_b=Parent.magicbus)
168 c8 = Connector(side_a=Parent.tsunami.fake_uart2, side_a_name='pio', side_b=Parent.magicbus)
169 c9 = Connector(side_a=Parent.tsunami.fake_uart3, side_a_name='pio', side_b=Parent.magicbus)
170 c10 = Connector(side_a=Parent.tsunami.fake_uart4, side_a_name='pio', side_b=Parent.magicbus)
171 c11 = Connector(side_a=Parent.tsunami.ide, side_a_name='pio', side_b=Parent.magicbus)
172 c13 = Connector(side_a=Parent.tsunami.ide, side_a_name='dma', side_b=Parent.magicbus)
173 c12 = Connector(side_a=Parent.tsunami.fake_ppc, side_a_name='pio', side_b=Parent.magicbus)
174 c14 = Connector(side_a=Parent.tsunami.fake_OROM, side_a_name='pio', side_b=Parent.magicbus)
175 c16 = Connector(side_a=Parent.tsunami.fake_pnp_addr, side_a_name='pio', side_b=Parent.magicbus)
176 c17 = Connector(side_a=Parent.tsunami.fake_pnp_write, side_a_name='pio', side_b=Parent.magicbus)
177 c18 = Connector(side_a=Parent.tsunami.fake_pnp_read0, side_a_name='pio', side_b=Parent.magicbus)
178 c19 = Connector(side_a=Parent.tsunami.fake_pnp_read1, side_a_name='pio', side_b=Parent.magicbus)
179 c20 = Connector(side_a=Parent.tsunami.fake_pnp_read2, side_a_name='pio', side_b=Parent.magicbus)
180 c21 = Connector(side_a=Parent.tsunami.fake_pnp_read3, side_a_name='pio', side_b=Parent.magicbus)
181 c22 = Connector(side_a=Parent.tsunami.fake_pnp_read4, side_a_name='pio', side_b=Parent.magicbus)
182 c23 = Connector(side_a=Parent.tsunami.fake_pnp_read5, side_a_name='pio', side_b=Parent.magicbus)
183 c24 = Connector(side_a=Parent.tsunami.fake_pnp_read6, side_a_name='pio', side_b=Parent.magicbus)
184 c25 = Connector(side_a=Parent.tsunami.fake_pnp_read7, side_a_name='pio', side_b=Parent.magicbus)
185 c27 = Connector(side_a=Parent.tsunami.fake_ata0, side_a_name='pio', side_b=Parent.magicbus)
186 c28 = Connector(side_a=Parent.tsunami.fake_ata1, side_a_name='pio', side_b=Parent.magicbus)
187 c30 = Connector(side_a=Parent.tsunami.fb, side_a_name='pio', side_b=Parent.magicbus)
188 c31 = Connector(side_a=Parent.tsunami.io, side_a_name='pio', side_b=Parent.magicbus)
189 c32 = Connector(side_a=Parent.tsunami.uart, side_a_name='pio', side_b=Parent.magicbus)
190 c33 = Connector(side_a=Parent.tsunami.console, side_a_name='pio', side_b=Parent.magicbus)
191 raw_image = RawDiskImage(image_file=disk('linux-latest.img'),
192 read_only=True)
193 simple_disk = SimpleDisk(disk=Parent.raw_image)
194 intrctrl = IntrControl()
195 if options.timing:
196 cpu = TimingSimpleCPU()
197 else:
198 cpu = AtomicSimpleCPU()
199 cpu.mem = Parent.magicbus2
200 sim_console = SimConsole(listener=ConsoleListener(port=3456))
201 kernel = binary('vmlinux')
202 pal = binary('ts_osfpal')
203 console = binary('console')
204 boot_osflags = 'root=/dev/hda1 console=ttyS0'
205 # readfile = os.path.join(test_base, 'halt.sh')
206
207
208 BaseCPU.itb = AlphaITB()
209 BaseCPU.dtb = AlphaDTB()
210 BaseCPU.system = Parent.any
211
212 class TsunamiRoot(System):
213 pass
214
215
216 def DualRoot(ClientSystem, ServerSystem):
217 self = Root()
218 self.client = ClientSystem()
219 self.server = ServerSystem()
220
221 self.etherdump = EtherDump(file='ethertrace')
222 self.etherlink = EtherLink(int1 = Parent.client.tsunami.etherint[0],
223 int2 = Parent.server.tsunami.etherint[0],
224 dump = Parent.etherdump)
225 self.clock = '5GHz'
226 return self
227
228 root = DualRoot(ClientSystem = LinuxAlphaSystem(readfile=script('netperf-stream-nt-client.rcS')),
229 ServerSystem = LinuxAlphaSystem(readfile=script('netperf-server.rcS')))
230
231 m5.instantiate(root)
232
233 exit_event = m5.simulate()
234
235 print 'Exiting @', m5.curTick(), 'because', exit_event.getCause()