Subversion Repositories HelenOS

Rev

Rev 3591 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
3489 rimsky 1
#
2
# This configuration file was assembled from the bagle machine
3
# configuration files as found in Simics 3.0.21. It won't probably
4
# work in Simics versions prior to Simics 3.0.
5
#
6
# The machine simulated is SunFire server Sun Enterprise E6500.
7
#
8
# - modified to boot from CD-ROM
9
# - framebuffer color depth set to 24bpp
10
#
11
 
12
script-branch {
13
    wait-for-variable machine_defined
14
    $pcibrd = (create-sunfire-pci-board mac_address = "10:10:10:10:10:14")
3493 rimsky 15
    $pgx64 = (create-sun-pci-pgx64)
16
    $gfxcon = (create-std-graphics-console)
17
    $keyboard = (create-sun-type5-keyboard)
18
    $mouse = (create-sun-type5-mouse)
3489 rimsky 19
    $scsi_bus = (create-std-scsi-bus)
20
 
21
    $system.connect slot2 $pcibrd
3493 rimsky 22
    $pcibrd.connect pci-slot0 $pgx64
3489 rimsky 23
    $pcibrd.connect $scsi_bus
3493 rimsky 24
    $system.connect keyboard $keyboard
25
    $system.connect mouse $mouse
3489 rimsky 26
 
3493 rimsky 27
    $gfxcon.connect $pgx64
28
    $gfxcon.connect $keyboard
29
    $gfxcon.connect $mouse
3489 rimsky 30
}
31
 
32
$save_slot2 = "yes"
33
 
34
if not defined hostid        {$hostid        = 0x80804a6c}
35
if not defined freq_mhz      {$freq_mhz      = 168}
36
if not defined mac_address   {$mac_address   = "10:10:10:10:10:12"}
37
if not defined disk_size     {$disk_size     = 2128486400}
38
if not defined rtc_time      {$rtc_time      = "2002-06-02 13:00:00 UTC"}
3664 rimsky 39
if not defined num_cpus      {$num_cpus      = 3}
3489 rimsky 40
if not defined memory_megs   {$memory_megs   = 256}
41
if not defined save_slot2    {$save_slot2    = "no"}
42
 
43
add-directory "%simics%/targets/sunfire/images/"
44
 
45
import-pci-components
46
import-std-components
47
import-sun-components
48
import-sunfire-components
49
 
50
$system = (create-sunfire-6500-backplane cpu_frequency = $freq_mhz
51
                                         hostid = $hostid
52
                                         mac_address = $mac_address
53
                                         rtc_time = $rtc_time)
54
 
55
$board = 0
56
$cpus_left = $num_cpus
57
$megs_left = $memory_megs
58
 
59
while $cpus_left or $megs_left {
60
    $cpubrd[$board] = (create-sunfire-cpu-board
61
                           num_cpus = (min $cpus_left 2)
62
                           memory_megs = (min $megs_left 4096))
63
    $system.connect ("slot" + $board) $cpubrd[$board]
64
    if $board == 0 {
65
        $system.connect central-cpu $cpubrd[$board]
66
    }
67
    $cpus_left = (max ($cpus_left - 2) 0)
68
    $megs_left = (max ($megs_left - 4096) 0)
69
    $board += 1
70
    if $board == 1 {$board = 2}
71
    if $board == 2 and ($save_slot2 == yes) {$board = 3}
72
}
73
 
74
$sbusbrd = (create-sunfire-sbus-board mac_address = $mac_address)
75
$scsi_bus = (create-std-scsi-bus)
76
$scsi_disk = (create-std-scsi-disk scsi_id = 1 size = $disk_size)
77
$scsi_cdrom = (create-std-scsi-cdrom scsi_id = 6)
78
$console = (create-std-text-console)
79
 
80
$system.connect slot1 $sbusbrd
81
$sbusbrd.connect $scsi_bus
82
$scsi_bus.connect $scsi_disk
83
$scsi_bus.connect $scsi_cdrom
84
$system.connect ttya $console
85
 
86
$machine_defined = 1
87
 
88
instantiate-components
89
 
90
$eth_comp = $sbus_fas_hme
91
$eth_cnt = ""
92
run-command-file "%simics%/targets/common/add-eth-link.include"
93
 
94
if not defined ip_address   {$ip_address   = "10.10.0.6"}
95
 
96
if $service_node {
97
    local $sn = ($service_node.get-component-object sn)
98
    ($sn.add-host name = $host_name
99
                         ip = $ip_address domain = network.sim
100
                         mac = $mac_address)
101
}
102
 
103
default-port-forward-target $ip_address
104
 
105
$cdrom_path = "image.iso"
106
($scsi_cdrom.get-component-object cd).insert (new-file-cdrom $cdrom_path)
107
 
108
$system.set-prom-env boot-command "boot cdrom"
109
$system.set-prom-env auto-boot? true
3664 rimsky 110
$system.set-prom-env "output-device" "screen:r640x480x60"
3489 rimsky 111
 
112
@buf = 0;
113
@offset = 0;
114
@register2Number = SIM_get_register_number(SIM_current_processor(), "g2");
115
@register3Number = SIM_get_register_number(SIM_current_processor(), "g3");
116
 
117
@def schedule():
118
	SIM_realtime_event(100, handler, 0, 0, '');
119
 
120
@def handler(x):
121
	global buf
122
	global offset
123
	if (SIM_simics_is_running()):
124
		register2Value = SIM_read_register(SIM_current_processor(), register2Number);
125
		if ((buf == 0) and register2Value == 0x18273645):	
126
			buf = SIM_read_register(SIM_current_processor(), register3Number);
127
			SIM_write_register(SIM_current_processor(), register2Number, 0);
128
			SIM_flush();
129
			print buf
130
		elif (buf != 0):
131
			byte = SIM_read_phys_memory(SIM_current_processor(), buf + offset, 1);
132
			while byte != 0:
133
				SIM_putchar(byte);
134
				SIM_flush();
135
				SIM_write_phys_memory(SIM_current_processor(), buf + offset, 0, 1);
136
				offset = (offset + 1) % 512;
137
				byte = SIM_read_phys_memory(SIM_current_processor(), buf + offset, 1);
138
	schedule();
139
 
140
@schedule();