root / hw / sun4m.c @ f7b4f61f
History | View | Annotate | Download (52.1 kB)
1 | 420557e8 | bellard | /*
|
---|---|---|---|
2 | ee76f82e | blueswir1 | * QEMU Sun4m & Sun4d & Sun4c System Emulator
|
3 | 5fafdf24 | ths | *
|
4 | b81b3b10 | bellard | * Copyright (c) 2003-2005 Fabrice Bellard
|
5 | 5fafdf24 | ths | *
|
6 | 420557e8 | bellard | * Permission is hereby granted, free of charge, to any person obtaining a copy
|
7 | 420557e8 | bellard | * of this software and associated documentation files (the "Software"), to deal
|
8 | 420557e8 | bellard | * in the Software without restriction, including without limitation the rights
|
9 | 420557e8 | bellard | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
10 | 420557e8 | bellard | * copies of the Software, and to permit persons to whom the Software is
|
11 | 420557e8 | bellard | * furnished to do so, subject to the following conditions:
|
12 | 420557e8 | bellard | *
|
13 | 420557e8 | bellard | * The above copyright notice and this permission notice shall be included in
|
14 | 420557e8 | bellard | * all copies or substantial portions of the Software.
|
15 | 420557e8 | bellard | *
|
16 | 420557e8 | bellard | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17 | 420557e8 | bellard | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18 | 420557e8 | bellard | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
19 | 420557e8 | bellard | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
20 | 420557e8 | bellard | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21 | 420557e8 | bellard | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
22 | 420557e8 | bellard | * THE SOFTWARE.
|
23 | 420557e8 | bellard | */
|
24 | 9d07d757 | Paul Brook | #include "sysbus.h" |
25 | 87ecb68b | pbrook | #include "qemu-timer.h" |
26 | 87ecb68b | pbrook | #include "sun4m.h" |
27 | 87ecb68b | pbrook | #include "nvram.h" |
28 | 87ecb68b | pbrook | #include "sparc32_dma.h" |
29 | 87ecb68b | pbrook | #include "fdc.h" |
30 | 87ecb68b | pbrook | #include "sysemu.h" |
31 | 87ecb68b | pbrook | #include "net.h" |
32 | 87ecb68b | pbrook | #include "boards.h" |
33 | d2c63fc1 | blueswir1 | #include "firmware_abi.h" |
34 | 8b17de88 | blueswir1 | #include "scsi.h" |
35 | 22548760 | blueswir1 | #include "pc.h" |
36 | 22548760 | blueswir1 | #include "isa.h" |
37 | 3cce6243 | blueswir1 | #include "fw_cfg.h" |
38 | b4ed08e0 | blueswir1 | #include "escc.h" |
39 | 4b48bf05 | Blue Swirl | #include "qdev-addr.h" |
40 | d2c63fc1 | blueswir1 | |
41 | b3a23197 | blueswir1 | //#define DEBUG_IRQ
|
42 | 420557e8 | bellard | |
43 | 36cd9210 | blueswir1 | /*
|
44 | 36cd9210 | blueswir1 | * Sun4m architecture was used in the following machines:
|
45 | 36cd9210 | blueswir1 | *
|
46 | 36cd9210 | blueswir1 | * SPARCserver 6xxMP/xx
|
47 | 77f193da | blueswir1 | * SPARCclassic (SPARCclassic Server)(SPARCstation LC) (4/15),
|
48 | 77f193da | blueswir1 | * SPARCclassic X (4/10)
|
49 | 36cd9210 | blueswir1 | * SPARCstation LX/ZX (4/30)
|
50 | 36cd9210 | blueswir1 | * SPARCstation Voyager
|
51 | 36cd9210 | blueswir1 | * SPARCstation 10/xx, SPARCserver 10/xx
|
52 | 36cd9210 | blueswir1 | * SPARCstation 5, SPARCserver 5
|
53 | 36cd9210 | blueswir1 | * SPARCstation 20/xx, SPARCserver 20
|
54 | 36cd9210 | blueswir1 | * SPARCstation 4
|
55 | 36cd9210 | blueswir1 | *
|
56 | 7d85892b | blueswir1 | * Sun4d architecture was used in the following machines:
|
57 | 7d85892b | blueswir1 | *
|
58 | 7d85892b | blueswir1 | * SPARCcenter 2000
|
59 | 7d85892b | blueswir1 | * SPARCserver 1000
|
60 | 7d85892b | blueswir1 | *
|
61 | ee76f82e | blueswir1 | * Sun4c architecture was used in the following machines:
|
62 | ee76f82e | blueswir1 | * SPARCstation 1/1+, SPARCserver 1/1+
|
63 | ee76f82e | blueswir1 | * SPARCstation SLC
|
64 | ee76f82e | blueswir1 | * SPARCstation IPC
|
65 | ee76f82e | blueswir1 | * SPARCstation ELC
|
66 | ee76f82e | blueswir1 | * SPARCstation IPX
|
67 | ee76f82e | blueswir1 | *
|
68 | 36cd9210 | blueswir1 | * See for example: http://www.sunhelp.org/faq/sunref1.html
|
69 | 36cd9210 | blueswir1 | */
|
70 | 36cd9210 | blueswir1 | |
71 | b3a23197 | blueswir1 | #ifdef DEBUG_IRQ
|
72 | 001faf32 | Blue Swirl | #define DPRINTF(fmt, ...) \
|
73 | 001faf32 | Blue Swirl | do { printf("CPUIRQ: " fmt , ## __VA_ARGS__); } while (0) |
74 | b3a23197 | blueswir1 | #else
|
75 | 001faf32 | Blue Swirl | #define DPRINTF(fmt, ...)
|
76 | b3a23197 | blueswir1 | #endif
|
77 | b3a23197 | blueswir1 | |
78 | 420557e8 | bellard | #define KERNEL_LOAD_ADDR 0x00004000 |
79 | b6f479d3 | bellard | #define CMDLINE_ADDR 0x007ff000 |
80 | 713c45fa | bellard | #define INITRD_LOAD_ADDR 0x00800000 |
81 | a7227727 | blueswir1 | #define PROM_SIZE_MAX (1024 * 1024) |
82 | 40ce0a9a | blueswir1 | #define PROM_VADDR 0xffd00000 |
83 | f930d07e | blueswir1 | #define PROM_FILENAME "openbios-sparc32" |
84 | 3cce6243 | blueswir1 | #define CFG_ADDR 0xd00000510ULL |
85 | fbfcf955 | blueswir1 | #define FW_CFG_SUN4M_DEPTH (FW_CFG_ARCH_LOCAL + 0x00) |
86 | b8174937 | bellard | |
87 | ba3c64fb | bellard | #define MAX_CPUS 16 |
88 | b3a23197 | blueswir1 | #define MAX_PILS 16 |
89 | 420557e8 | bellard | |
90 | b4ed08e0 | blueswir1 | #define ESCC_CLOCK 4915200 |
91 | b4ed08e0 | blueswir1 | |
92 | 8137cde8 | blueswir1 | struct sun4m_hwdef {
|
93 | 5dcb6b91 | blueswir1 | target_phys_addr_t iommu_base, slavio_base; |
94 | 5dcb6b91 | blueswir1 | target_phys_addr_t intctl_base, counter_base, nvram_base, ms_kb_base; |
95 | 5dcb6b91 | blueswir1 | target_phys_addr_t serial_base, fd_base; |
96 | 4c2485de | blueswir1 | target_phys_addr_t idreg_base, dma_base, esp_base, le_base; |
97 | 0019ad53 | blueswir1 | target_phys_addr_t tcx_base, cs_base, apc_base, aux1_base, aux2_base; |
98 | 7eb0c8e8 | blueswir1 | target_phys_addr_t ecc_base; |
99 | 7eb0c8e8 | blueswir1 | uint32_t ecc_version; |
100 | 905fdcb5 | blueswir1 | uint8_t nvram_machine_id; |
101 | 905fdcb5 | blueswir1 | uint16_t machine_id; |
102 | 7fbfb139 | blueswir1 | uint32_t iommu_version; |
103 | 3ebf5aaf | blueswir1 | uint64_t max_mem; |
104 | 3ebf5aaf | blueswir1 | const char * const default_cpu_model; |
105 | 36cd9210 | blueswir1 | }; |
106 | 36cd9210 | blueswir1 | |
107 | 7d85892b | blueswir1 | #define MAX_IOUNITS 5 |
108 | 7d85892b | blueswir1 | |
109 | 7d85892b | blueswir1 | struct sun4d_hwdef {
|
110 | 7d85892b | blueswir1 | target_phys_addr_t iounit_bases[MAX_IOUNITS], slavio_base; |
111 | 7d85892b | blueswir1 | target_phys_addr_t counter_base, nvram_base, ms_kb_base; |
112 | 7d85892b | blueswir1 | target_phys_addr_t serial_base; |
113 | 7d85892b | blueswir1 | target_phys_addr_t espdma_base, esp_base; |
114 | 7d85892b | blueswir1 | target_phys_addr_t ledma_base, le_base; |
115 | 7d85892b | blueswir1 | target_phys_addr_t tcx_base; |
116 | 7d85892b | blueswir1 | target_phys_addr_t sbi_base; |
117 | 905fdcb5 | blueswir1 | uint8_t nvram_machine_id; |
118 | 905fdcb5 | blueswir1 | uint16_t machine_id; |
119 | 7d85892b | blueswir1 | uint32_t iounit_version; |
120 | 7d85892b | blueswir1 | uint64_t max_mem; |
121 | 7d85892b | blueswir1 | const char * const default_cpu_model; |
122 | 7d85892b | blueswir1 | }; |
123 | 7d85892b | blueswir1 | |
124 | 8137cde8 | blueswir1 | struct sun4c_hwdef {
|
125 | 8137cde8 | blueswir1 | target_phys_addr_t iommu_base, slavio_base; |
126 | 8137cde8 | blueswir1 | target_phys_addr_t intctl_base, counter_base, nvram_base, ms_kb_base; |
127 | 8137cde8 | blueswir1 | target_phys_addr_t serial_base, fd_base; |
128 | 8137cde8 | blueswir1 | target_phys_addr_t idreg_base, dma_base, esp_base, le_base; |
129 | 1572a18c | blueswir1 | target_phys_addr_t tcx_base, aux1_base; |
130 | 8137cde8 | blueswir1 | uint8_t nvram_machine_id; |
131 | 8137cde8 | blueswir1 | uint16_t machine_id; |
132 | 8137cde8 | blueswir1 | uint32_t iommu_version; |
133 | 8137cde8 | blueswir1 | uint64_t max_mem; |
134 | 8137cde8 | blueswir1 | const char * const default_cpu_model; |
135 | 8137cde8 | blueswir1 | }; |
136 | 8137cde8 | blueswir1 | |
137 | 6f7e9aec | bellard | int DMA_get_channel_mode (int nchan) |
138 | 6f7e9aec | bellard | { |
139 | 6f7e9aec | bellard | return 0; |
140 | 6f7e9aec | bellard | } |
141 | 6f7e9aec | bellard | int DMA_read_memory (int nchan, void *buf, int pos, int size) |
142 | 6f7e9aec | bellard | { |
143 | 6f7e9aec | bellard | return 0; |
144 | 6f7e9aec | bellard | } |
145 | 6f7e9aec | bellard | int DMA_write_memory (int nchan, void *buf, int pos, int size) |
146 | 6f7e9aec | bellard | { |
147 | 6f7e9aec | bellard | return 0; |
148 | 6f7e9aec | bellard | } |
149 | 6f7e9aec | bellard | void DMA_hold_DREQ (int nchan) {} |
150 | 6f7e9aec | bellard | void DMA_release_DREQ (int nchan) {} |
151 | 6f7e9aec | bellard | void DMA_schedule(int nchan) {} |
152 | 6f7e9aec | bellard | void DMA_init (int high_page_enable) {} |
153 | 6f7e9aec | bellard | void DMA_register_channel (int nchan, |
154 | 6f7e9aec | bellard | DMA_transfer_handler transfer_handler, |
155 | 6f7e9aec | bellard | void *opaque)
|
156 | 6f7e9aec | bellard | { |
157 | 6f7e9aec | bellard | } |
158 | 6f7e9aec | bellard | |
159 | 513f789f | blueswir1 | static int fw_cfg_boot_set(void *opaque, const char *boot_device) |
160 | 81864572 | blueswir1 | { |
161 | 513f789f | blueswir1 | fw_cfg_add_i16(opaque, FW_CFG_BOOT_DEVICE, boot_device[0]);
|
162 | 81864572 | blueswir1 | return 0; |
163 | 81864572 | blueswir1 | } |
164 | 81864572 | blueswir1 | |
165 | 819385c5 | bellard | static void nvram_init(m48t59_t *nvram, uint8_t *macaddr, const char *cmdline, |
166 | 6ef05b95 | blueswir1 | const char *boot_devices, ram_addr_t RAM_size, |
167 | f930d07e | blueswir1 | uint32_t kernel_size, |
168 | f930d07e | blueswir1 | int width, int height, int depth, |
169 | 905fdcb5 | blueswir1 | int nvram_machine_id, const char *arch) |
170 | e80cfcfc | bellard | { |
171 | d2c63fc1 | blueswir1 | unsigned int i; |
172 | 66508601 | blueswir1 | uint32_t start, end; |
173 | d2c63fc1 | blueswir1 | uint8_t image[0x1ff0];
|
174 | d2c63fc1 | blueswir1 | struct OpenBIOS_nvpart_v1 *part_header;
|
175 | d2c63fc1 | blueswir1 | |
176 | d2c63fc1 | blueswir1 | memset(image, '\0', sizeof(image)); |
177 | e80cfcfc | bellard | |
178 | 513f789f | blueswir1 | start = 0;
|
179 | b6f479d3 | bellard | |
180 | 66508601 | blueswir1 | // OpenBIOS nvram variables
|
181 | 66508601 | blueswir1 | // Variable partition
|
182 | d2c63fc1 | blueswir1 | part_header = (struct OpenBIOS_nvpart_v1 *)&image[start];
|
183 | d2c63fc1 | blueswir1 | part_header->signature = OPENBIOS_PART_SYSTEM; |
184 | 363a37d5 | blueswir1 | pstrcpy(part_header->name, sizeof(part_header->name), "system"); |
185 | 66508601 | blueswir1 | |
186 | d2c63fc1 | blueswir1 | end = start + sizeof(struct OpenBIOS_nvpart_v1); |
187 | 66508601 | blueswir1 | for (i = 0; i < nb_prom_envs; i++) |
188 | d2c63fc1 | blueswir1 | end = OpenBIOS_set_var(image, end, prom_envs[i]); |
189 | d2c63fc1 | blueswir1 | |
190 | d2c63fc1 | blueswir1 | // End marker
|
191 | d2c63fc1 | blueswir1 | image[end++] = '\0';
|
192 | 66508601 | blueswir1 | |
193 | 66508601 | blueswir1 | end = start + ((end - start + 15) & ~15); |
194 | d2c63fc1 | blueswir1 | OpenBIOS_finish_partition(part_header, end - start); |
195 | 66508601 | blueswir1 | |
196 | 66508601 | blueswir1 | // free partition
|
197 | 66508601 | blueswir1 | start = end; |
198 | d2c63fc1 | blueswir1 | part_header = (struct OpenBIOS_nvpart_v1 *)&image[start];
|
199 | d2c63fc1 | blueswir1 | part_header->signature = OPENBIOS_PART_FREE; |
200 | 363a37d5 | blueswir1 | pstrcpy(part_header->name, sizeof(part_header->name), "free"); |
201 | 66508601 | blueswir1 | |
202 | 66508601 | blueswir1 | end = 0x1fd0;
|
203 | d2c63fc1 | blueswir1 | OpenBIOS_finish_partition(part_header, end - start); |
204 | d2c63fc1 | blueswir1 | |
205 | 905fdcb5 | blueswir1 | Sun_init_header((struct Sun_nvram *)&image[0x1fd8], macaddr, |
206 | 905fdcb5 | blueswir1 | nvram_machine_id); |
207 | d2c63fc1 | blueswir1 | |
208 | d2c63fc1 | blueswir1 | for (i = 0; i < sizeof(image); i++) |
209 | d2c63fc1 | blueswir1 | m48t59_write(nvram, i, image[i]); |
210 | e80cfcfc | bellard | } |
211 | e80cfcfc | bellard | |
212 | d453c2c3 | Blue Swirl | static DeviceState *slavio_intctl;
|
213 | e80cfcfc | bellard | |
214 | 376253ec | aliguori | void pic_info(Monitor *mon)
|
215 | e80cfcfc | bellard | { |
216 | 7d85892b | blueswir1 | if (slavio_intctl)
|
217 | 376253ec | aliguori | slavio_pic_info(mon, slavio_intctl); |
218 | e80cfcfc | bellard | } |
219 | e80cfcfc | bellard | |
220 | 376253ec | aliguori | void irq_info(Monitor *mon)
|
221 | e80cfcfc | bellard | { |
222 | 7d85892b | blueswir1 | if (slavio_intctl)
|
223 | 376253ec | aliguori | slavio_irq_info(mon, slavio_intctl); |
224 | e80cfcfc | bellard | } |
225 | e80cfcfc | bellard | |
226 | 327ac2e7 | blueswir1 | void cpu_check_irqs(CPUState *env)
|
227 | 327ac2e7 | blueswir1 | { |
228 | 327ac2e7 | blueswir1 | if (env->pil_in && (env->interrupt_index == 0 || |
229 | 327ac2e7 | blueswir1 | (env->interrupt_index & ~15) == TT_EXTINT)) {
|
230 | 327ac2e7 | blueswir1 | unsigned int i; |
231 | 327ac2e7 | blueswir1 | |
232 | 327ac2e7 | blueswir1 | for (i = 15; i > 0; i--) { |
233 | 327ac2e7 | blueswir1 | if (env->pil_in & (1 << i)) { |
234 | 327ac2e7 | blueswir1 | int old_interrupt = env->interrupt_index;
|
235 | 327ac2e7 | blueswir1 | |
236 | 327ac2e7 | blueswir1 | env->interrupt_index = TT_EXTINT | i; |
237 | f32d7ec5 | blueswir1 | if (old_interrupt != env->interrupt_index) {
|
238 | f32d7ec5 | blueswir1 | DPRINTF("Set CPU IRQ %d\n", i);
|
239 | 327ac2e7 | blueswir1 | cpu_interrupt(env, CPU_INTERRUPT_HARD); |
240 | f32d7ec5 | blueswir1 | } |
241 | 327ac2e7 | blueswir1 | break;
|
242 | 327ac2e7 | blueswir1 | } |
243 | 327ac2e7 | blueswir1 | } |
244 | 327ac2e7 | blueswir1 | } else if (!env->pil_in && (env->interrupt_index & ~15) == TT_EXTINT) { |
245 | f32d7ec5 | blueswir1 | DPRINTF("Reset CPU IRQ %d\n", env->interrupt_index & 15); |
246 | 327ac2e7 | blueswir1 | env->interrupt_index = 0;
|
247 | 327ac2e7 | blueswir1 | cpu_reset_interrupt(env, CPU_INTERRUPT_HARD); |
248 | 327ac2e7 | blueswir1 | } |
249 | 327ac2e7 | blueswir1 | } |
250 | 327ac2e7 | blueswir1 | |
251 | b3a23197 | blueswir1 | static void cpu_set_irq(void *opaque, int irq, int level) |
252 | b3a23197 | blueswir1 | { |
253 | b3a23197 | blueswir1 | CPUState *env = opaque; |
254 | b3a23197 | blueswir1 | |
255 | b3a23197 | blueswir1 | if (level) {
|
256 | b3a23197 | blueswir1 | DPRINTF("Raise CPU IRQ %d\n", irq);
|
257 | b3a23197 | blueswir1 | env->halted = 0;
|
258 | 327ac2e7 | blueswir1 | env->pil_in |= 1 << irq;
|
259 | 327ac2e7 | blueswir1 | cpu_check_irqs(env); |
260 | b3a23197 | blueswir1 | } else {
|
261 | b3a23197 | blueswir1 | DPRINTF("Lower CPU IRQ %d\n", irq);
|
262 | 327ac2e7 | blueswir1 | env->pil_in &= ~(1 << irq);
|
263 | 327ac2e7 | blueswir1 | cpu_check_irqs(env); |
264 | b3a23197 | blueswir1 | } |
265 | b3a23197 | blueswir1 | } |
266 | b3a23197 | blueswir1 | |
267 | b3a23197 | blueswir1 | static void dummy_cpu_set_irq(void *opaque, int irq, int level) |
268 | b3a23197 | blueswir1 | { |
269 | b3a23197 | blueswir1 | } |
270 | b3a23197 | blueswir1 | |
271 | c68ea704 | bellard | static void main_cpu_reset(void *opaque) |
272 | c68ea704 | bellard | { |
273 | c68ea704 | bellard | CPUState *env = opaque; |
274 | 3d29fbef | blueswir1 | |
275 | 3d29fbef | blueswir1 | cpu_reset(env); |
276 | 3d29fbef | blueswir1 | env->halted = 0;
|
277 | 3d29fbef | blueswir1 | } |
278 | 3d29fbef | blueswir1 | |
279 | 3d29fbef | blueswir1 | static void secondary_cpu_reset(void *opaque) |
280 | 3d29fbef | blueswir1 | { |
281 | 3d29fbef | blueswir1 | CPUState *env = opaque; |
282 | 3d29fbef | blueswir1 | |
283 | c68ea704 | bellard | cpu_reset(env); |
284 | 3d29fbef | blueswir1 | env->halted = 1;
|
285 | c68ea704 | bellard | } |
286 | c68ea704 | bellard | |
287 | 6d0c293d | blueswir1 | static void cpu_halt_signal(void *opaque, int irq, int level) |
288 | 6d0c293d | blueswir1 | { |
289 | 6d0c293d | blueswir1 | if (level && cpu_single_env)
|
290 | 6d0c293d | blueswir1 | cpu_interrupt(cpu_single_env, CPU_INTERRUPT_HALT); |
291 | 6d0c293d | blueswir1 | } |
292 | 6d0c293d | blueswir1 | |
293 | 3ebf5aaf | blueswir1 | static unsigned long sun4m_load_kernel(const char *kernel_filename, |
294 | 293f78bc | blueswir1 | const char *initrd_filename, |
295 | 293f78bc | blueswir1 | ram_addr_t RAM_size) |
296 | 3ebf5aaf | blueswir1 | { |
297 | 3ebf5aaf | blueswir1 | int linux_boot;
|
298 | 3ebf5aaf | blueswir1 | unsigned int i; |
299 | 3ebf5aaf | blueswir1 | long initrd_size, kernel_size;
|
300 | 3ebf5aaf | blueswir1 | |
301 | 3ebf5aaf | blueswir1 | linux_boot = (kernel_filename != NULL);
|
302 | 3ebf5aaf | blueswir1 | |
303 | 3ebf5aaf | blueswir1 | kernel_size = 0;
|
304 | 3ebf5aaf | blueswir1 | if (linux_boot) {
|
305 | 3ebf5aaf | blueswir1 | kernel_size = load_elf(kernel_filename, -0xf0000000ULL, NULL, NULL, |
306 | 3ebf5aaf | blueswir1 | NULL);
|
307 | 3ebf5aaf | blueswir1 | if (kernel_size < 0) |
308 | 293f78bc | blueswir1 | kernel_size = load_aout(kernel_filename, KERNEL_LOAD_ADDR, |
309 | 293f78bc | blueswir1 | RAM_size - KERNEL_LOAD_ADDR); |
310 | 3ebf5aaf | blueswir1 | if (kernel_size < 0) |
311 | 293f78bc | blueswir1 | kernel_size = load_image_targphys(kernel_filename, |
312 | 293f78bc | blueswir1 | KERNEL_LOAD_ADDR, |
313 | 293f78bc | blueswir1 | RAM_size - KERNEL_LOAD_ADDR); |
314 | 3ebf5aaf | blueswir1 | if (kernel_size < 0) { |
315 | 3ebf5aaf | blueswir1 | fprintf(stderr, "qemu: could not load kernel '%s'\n",
|
316 | 3ebf5aaf | blueswir1 | kernel_filename); |
317 | 3ebf5aaf | blueswir1 | exit(1);
|
318 | 3ebf5aaf | blueswir1 | } |
319 | 3ebf5aaf | blueswir1 | |
320 | 3ebf5aaf | blueswir1 | /* load initrd */
|
321 | 3ebf5aaf | blueswir1 | initrd_size = 0;
|
322 | 3ebf5aaf | blueswir1 | if (initrd_filename) {
|
323 | 293f78bc | blueswir1 | initrd_size = load_image_targphys(initrd_filename, |
324 | 293f78bc | blueswir1 | INITRD_LOAD_ADDR, |
325 | 293f78bc | blueswir1 | RAM_size - INITRD_LOAD_ADDR); |
326 | 3ebf5aaf | blueswir1 | if (initrd_size < 0) { |
327 | 3ebf5aaf | blueswir1 | fprintf(stderr, "qemu: could not load initial ram disk '%s'\n",
|
328 | 3ebf5aaf | blueswir1 | initrd_filename); |
329 | 3ebf5aaf | blueswir1 | exit(1);
|
330 | 3ebf5aaf | blueswir1 | } |
331 | 3ebf5aaf | blueswir1 | } |
332 | 3ebf5aaf | blueswir1 | if (initrd_size > 0) { |
333 | 3ebf5aaf | blueswir1 | for (i = 0; i < 64 * TARGET_PAGE_SIZE; i += TARGET_PAGE_SIZE) { |
334 | 293f78bc | blueswir1 | if (ldl_phys(KERNEL_LOAD_ADDR + i) == 0x48647253) { // HdrS |
335 | 293f78bc | blueswir1 | stl_phys(KERNEL_LOAD_ADDR + i + 16, INITRD_LOAD_ADDR);
|
336 | 293f78bc | blueswir1 | stl_phys(KERNEL_LOAD_ADDR + i + 20, initrd_size);
|
337 | 3ebf5aaf | blueswir1 | break;
|
338 | 3ebf5aaf | blueswir1 | } |
339 | 3ebf5aaf | blueswir1 | } |
340 | 3ebf5aaf | blueswir1 | } |
341 | 3ebf5aaf | blueswir1 | } |
342 | 3ebf5aaf | blueswir1 | return kernel_size;
|
343 | 3ebf5aaf | blueswir1 | } |
344 | 3ebf5aaf | blueswir1 | |
345 | 4b48bf05 | Blue Swirl | static void *iommu_init(target_phys_addr_t addr, uint32_t version, qemu_irq irq) |
346 | 4b48bf05 | Blue Swirl | { |
347 | 4b48bf05 | Blue Swirl | DeviceState *dev; |
348 | 4b48bf05 | Blue Swirl | SysBusDevice *s; |
349 | 4b48bf05 | Blue Swirl | |
350 | 4b48bf05 | Blue Swirl | dev = qdev_create(NULL, "iommu"); |
351 | 4b48bf05 | Blue Swirl | qdev_prop_set_uint32(dev, "version", version);
|
352 | 4b48bf05 | Blue Swirl | qdev_init(dev); |
353 | 4b48bf05 | Blue Swirl | s = sysbus_from_qdev(dev); |
354 | 4b48bf05 | Blue Swirl | sysbus_connect_irq(s, 0, irq);
|
355 | 4b48bf05 | Blue Swirl | sysbus_mmio_map(s, 0, addr);
|
356 | 4b48bf05 | Blue Swirl | |
357 | 4b48bf05 | Blue Swirl | return s;
|
358 | 4b48bf05 | Blue Swirl | } |
359 | 4b48bf05 | Blue Swirl | |
360 | 74ff8d90 | Blue Swirl | static void *sparc32_dma_init(target_phys_addr_t daddr, qemu_irq parent_irq, |
361 | 74ff8d90 | Blue Swirl | void *iommu, qemu_irq *dev_irq)
|
362 | 74ff8d90 | Blue Swirl | { |
363 | 74ff8d90 | Blue Swirl | DeviceState *dev; |
364 | 74ff8d90 | Blue Swirl | SysBusDevice *s; |
365 | 74ff8d90 | Blue Swirl | |
366 | 74ff8d90 | Blue Swirl | dev = qdev_create(NULL, "sparc32_dma"); |
367 | 74ff8d90 | Blue Swirl | qdev_prop_set_ptr(dev, "iommu_opaque", iommu);
|
368 | 74ff8d90 | Blue Swirl | qdev_init(dev); |
369 | 74ff8d90 | Blue Swirl | s = sysbus_from_qdev(dev); |
370 | 74ff8d90 | Blue Swirl | sysbus_connect_irq(s, 0, parent_irq);
|
371 | 74ff8d90 | Blue Swirl | *dev_irq = qdev_get_gpio_in(dev, 0);
|
372 | 74ff8d90 | Blue Swirl | sysbus_mmio_map(s, 0, daddr);
|
373 | 74ff8d90 | Blue Swirl | |
374 | 74ff8d90 | Blue Swirl | return s;
|
375 | 74ff8d90 | Blue Swirl | } |
376 | 74ff8d90 | Blue Swirl | |
377 | 9d07d757 | Paul Brook | static void lance_init(NICInfo *nd, target_phys_addr_t leaddr, |
378 | 74ff8d90 | Blue Swirl | void *dma_opaque, qemu_irq irq)
|
379 | 9d07d757 | Paul Brook | { |
380 | 9d07d757 | Paul Brook | DeviceState *dev; |
381 | 9d07d757 | Paul Brook | SysBusDevice *s; |
382 | 74ff8d90 | Blue Swirl | qemu_irq reset; |
383 | 9d07d757 | Paul Brook | |
384 | 9d07d757 | Paul Brook | qemu_check_nic_model(&nd_table[0], "lance"); |
385 | 9d07d757 | Paul Brook | |
386 | 9d07d757 | Paul Brook | dev = qdev_create(NULL, "lance"); |
387 | ee6847d1 | Gerd Hoffmann | dev->nd = nd; |
388 | daa65491 | Blue Swirl | qdev_prop_set_ptr(dev, "dma", dma_opaque);
|
389 | 9d07d757 | Paul Brook | qdev_init(dev); |
390 | 9d07d757 | Paul Brook | s = sysbus_from_qdev(dev); |
391 | 9d07d757 | Paul Brook | sysbus_mmio_map(s, 0, leaddr);
|
392 | 9d07d757 | Paul Brook | sysbus_connect_irq(s, 0, irq);
|
393 | 74ff8d90 | Blue Swirl | reset = qdev_get_gpio_in(dev, 0);
|
394 | 74ff8d90 | Blue Swirl | qdev_connect_gpio_out(dma_opaque, 0, reset);
|
395 | 9d07d757 | Paul Brook | } |
396 | 9d07d757 | Paul Brook | |
397 | 4b48bf05 | Blue Swirl | static DeviceState *slavio_intctl_init(target_phys_addr_t addr,
|
398 | 4b48bf05 | Blue Swirl | target_phys_addr_t addrg, |
399 | 462eda24 | Blue Swirl | qemu_irq **parent_irq) |
400 | 4b48bf05 | Blue Swirl | { |
401 | 4b48bf05 | Blue Swirl | DeviceState *dev; |
402 | 4b48bf05 | Blue Swirl | SysBusDevice *s; |
403 | 4b48bf05 | Blue Swirl | unsigned int i, j; |
404 | 4b48bf05 | Blue Swirl | |
405 | 4b48bf05 | Blue Swirl | dev = qdev_create(NULL, "slavio_intctl"); |
406 | 4b48bf05 | Blue Swirl | qdev_init(dev); |
407 | 4b48bf05 | Blue Swirl | |
408 | 4b48bf05 | Blue Swirl | s = sysbus_from_qdev(dev); |
409 | 4b48bf05 | Blue Swirl | |
410 | 4b48bf05 | Blue Swirl | for (i = 0; i < MAX_CPUS; i++) { |
411 | 4b48bf05 | Blue Swirl | for (j = 0; j < MAX_PILS; j++) { |
412 | 4b48bf05 | Blue Swirl | sysbus_connect_irq(s, i * MAX_PILS + j, parent_irq[i][j]); |
413 | 4b48bf05 | Blue Swirl | } |
414 | 4b48bf05 | Blue Swirl | } |
415 | 4b48bf05 | Blue Swirl | sysbus_mmio_map(s, 0, addrg);
|
416 | 4b48bf05 | Blue Swirl | for (i = 0; i < MAX_CPUS; i++) { |
417 | 4b48bf05 | Blue Swirl | sysbus_mmio_map(s, i + 1, addr + i * TARGET_PAGE_SIZE);
|
418 | 4b48bf05 | Blue Swirl | } |
419 | 4b48bf05 | Blue Swirl | |
420 | 4b48bf05 | Blue Swirl | return dev;
|
421 | 4b48bf05 | Blue Swirl | } |
422 | 4b48bf05 | Blue Swirl | |
423 | 4b48bf05 | Blue Swirl | #define SYS_TIMER_OFFSET 0x10000ULL |
424 | 4b48bf05 | Blue Swirl | #define CPU_TIMER_OFFSET(cpu) (0x1000ULL * cpu) |
425 | 4b48bf05 | Blue Swirl | |
426 | 4b48bf05 | Blue Swirl | static void slavio_timer_init_all(target_phys_addr_t addr, qemu_irq master_irq, |
427 | 4b48bf05 | Blue Swirl | qemu_irq *cpu_irqs, unsigned int num_cpus) |
428 | 4b48bf05 | Blue Swirl | { |
429 | 4b48bf05 | Blue Swirl | DeviceState *dev; |
430 | 4b48bf05 | Blue Swirl | SysBusDevice *s; |
431 | 4b48bf05 | Blue Swirl | unsigned int i; |
432 | 4b48bf05 | Blue Swirl | |
433 | 4b48bf05 | Blue Swirl | dev = qdev_create(NULL, "slavio_timer"); |
434 | 4b48bf05 | Blue Swirl | qdev_prop_set_uint32(dev, "num_cpus", num_cpus);
|
435 | 4b48bf05 | Blue Swirl | qdev_init(dev); |
436 | 4b48bf05 | Blue Swirl | s = sysbus_from_qdev(dev); |
437 | 4b48bf05 | Blue Swirl | sysbus_connect_irq(s, 0, master_irq);
|
438 | 4b48bf05 | Blue Swirl | sysbus_mmio_map(s, 0, addr + SYS_TIMER_OFFSET);
|
439 | 4b48bf05 | Blue Swirl | |
440 | 4b48bf05 | Blue Swirl | for (i = 0; i < MAX_CPUS; i++) { |
441 | 4b48bf05 | Blue Swirl | sysbus_mmio_map(s, i + 1, addr + (target_phys_addr_t)CPU_TIMER_OFFSET(i));
|
442 | 4b48bf05 | Blue Swirl | sysbus_connect_irq(s, i + 1, cpu_irqs[i]);
|
443 | 4b48bf05 | Blue Swirl | } |
444 | 4b48bf05 | Blue Swirl | } |
445 | 4b48bf05 | Blue Swirl | |
446 | 4b48bf05 | Blue Swirl | #define MISC_LEDS 0x01600000 |
447 | 4b48bf05 | Blue Swirl | #define MISC_CFG 0x01800000 |
448 | 4b48bf05 | Blue Swirl | #define MISC_DIAG 0x01a00000 |
449 | 4b48bf05 | Blue Swirl | #define MISC_MDM 0x01b00000 |
450 | 4b48bf05 | Blue Swirl | #define MISC_SYS 0x01f00000 |
451 | 4b48bf05 | Blue Swirl | |
452 | b2b6f6ec | Blue Swirl | static void slavio_misc_init(target_phys_addr_t base, |
453 | b2b6f6ec | Blue Swirl | target_phys_addr_t aux1_base, |
454 | b2b6f6ec | Blue Swirl | target_phys_addr_t aux2_base, qemu_irq irq, |
455 | b2b6f6ec | Blue Swirl | qemu_irq fdc_tc) |
456 | 4b48bf05 | Blue Swirl | { |
457 | 4b48bf05 | Blue Swirl | DeviceState *dev; |
458 | 4b48bf05 | Blue Swirl | SysBusDevice *s; |
459 | 4b48bf05 | Blue Swirl | |
460 | 4b48bf05 | Blue Swirl | dev = qdev_create(NULL, "slavio_misc"); |
461 | 4b48bf05 | Blue Swirl | qdev_init(dev); |
462 | 4b48bf05 | Blue Swirl | s = sysbus_from_qdev(dev); |
463 | 4b48bf05 | Blue Swirl | if (base) {
|
464 | 4b48bf05 | Blue Swirl | /* 8 bit registers */
|
465 | 4b48bf05 | Blue Swirl | /* Slavio control */
|
466 | 4b48bf05 | Blue Swirl | sysbus_mmio_map(s, 0, base + MISC_CFG);
|
467 | 4b48bf05 | Blue Swirl | /* Diagnostics */
|
468 | 4b48bf05 | Blue Swirl | sysbus_mmio_map(s, 1, base + MISC_DIAG);
|
469 | 4b48bf05 | Blue Swirl | /* Modem control */
|
470 | 4b48bf05 | Blue Swirl | sysbus_mmio_map(s, 2, base + MISC_MDM);
|
471 | 4b48bf05 | Blue Swirl | /* 16 bit registers */
|
472 | 4b48bf05 | Blue Swirl | /* ss600mp diag LEDs */
|
473 | 4b48bf05 | Blue Swirl | sysbus_mmio_map(s, 3, base + MISC_LEDS);
|
474 | 4b48bf05 | Blue Swirl | /* 32 bit registers */
|
475 | 4b48bf05 | Blue Swirl | /* System control */
|
476 | 4b48bf05 | Blue Swirl | sysbus_mmio_map(s, 4, base + MISC_SYS);
|
477 | 4b48bf05 | Blue Swirl | } |
478 | 4b48bf05 | Blue Swirl | if (aux1_base) {
|
479 | 4b48bf05 | Blue Swirl | /* AUX 1 (Misc System Functions) */
|
480 | 4b48bf05 | Blue Swirl | sysbus_mmio_map(s, 5, aux1_base);
|
481 | 4b48bf05 | Blue Swirl | } |
482 | 4b48bf05 | Blue Swirl | if (aux2_base) {
|
483 | 4b48bf05 | Blue Swirl | /* AUX 2 (Software Powerdown Control) */
|
484 | 4b48bf05 | Blue Swirl | sysbus_mmio_map(s, 6, aux2_base);
|
485 | 4b48bf05 | Blue Swirl | } |
486 | 4b48bf05 | Blue Swirl | sysbus_connect_irq(s, 0, irq);
|
487 | 4b48bf05 | Blue Swirl | sysbus_connect_irq(s, 1, fdc_tc);
|
488 | d9c32310 | Blue Swirl | qemu_system_powerdown = qdev_get_gpio_in(dev, 0);
|
489 | 4b48bf05 | Blue Swirl | } |
490 | 4b48bf05 | Blue Swirl | |
491 | 4b48bf05 | Blue Swirl | static void ecc_init(target_phys_addr_t base, qemu_irq irq, uint32_t version) |
492 | 4b48bf05 | Blue Swirl | { |
493 | 4b48bf05 | Blue Swirl | DeviceState *dev; |
494 | 4b48bf05 | Blue Swirl | SysBusDevice *s; |
495 | 4b48bf05 | Blue Swirl | |
496 | 4b48bf05 | Blue Swirl | dev = qdev_create(NULL, "eccmemctl"); |
497 | 4b48bf05 | Blue Swirl | qdev_prop_set_uint32(dev, "version", version);
|
498 | 4b48bf05 | Blue Swirl | qdev_init(dev); |
499 | 4b48bf05 | Blue Swirl | s = sysbus_from_qdev(dev); |
500 | 4b48bf05 | Blue Swirl | sysbus_connect_irq(s, 0, irq);
|
501 | 4b48bf05 | Blue Swirl | sysbus_mmio_map(s, 0, base);
|
502 | 4b48bf05 | Blue Swirl | if (version == 0) { // SS-600MP only |
503 | 4b48bf05 | Blue Swirl | sysbus_mmio_map(s, 1, base + 0x1000); |
504 | 4b48bf05 | Blue Swirl | } |
505 | 4b48bf05 | Blue Swirl | } |
506 | 4b48bf05 | Blue Swirl | |
507 | 4b48bf05 | Blue Swirl | static void apc_init(target_phys_addr_t power_base, qemu_irq cpu_halt) |
508 | 4b48bf05 | Blue Swirl | { |
509 | 4b48bf05 | Blue Swirl | DeviceState *dev; |
510 | 4b48bf05 | Blue Swirl | SysBusDevice *s; |
511 | 4b48bf05 | Blue Swirl | |
512 | 4b48bf05 | Blue Swirl | dev = qdev_create(NULL, "apc"); |
513 | 4b48bf05 | Blue Swirl | qdev_init(dev); |
514 | 4b48bf05 | Blue Swirl | s = sysbus_from_qdev(dev); |
515 | 4b48bf05 | Blue Swirl | /* Power management (APC) XXX: not a Slavio device */
|
516 | 4b48bf05 | Blue Swirl | sysbus_mmio_map(s, 0, power_base);
|
517 | 4b48bf05 | Blue Swirl | sysbus_connect_irq(s, 0, cpu_halt);
|
518 | 4b48bf05 | Blue Swirl | } |
519 | 4b48bf05 | Blue Swirl | |
520 | 4b48bf05 | Blue Swirl | static void tcx_init(target_phys_addr_t addr, int vram_size, int width, |
521 | 4b48bf05 | Blue Swirl | int height, int depth) |
522 | 4b48bf05 | Blue Swirl | { |
523 | 4b48bf05 | Blue Swirl | DeviceState *dev; |
524 | 4b48bf05 | Blue Swirl | SysBusDevice *s; |
525 | 4b48bf05 | Blue Swirl | |
526 | 4b48bf05 | Blue Swirl | dev = qdev_create(NULL, "SUNW,tcx"); |
527 | 4b48bf05 | Blue Swirl | qdev_prop_set_taddr(dev, "addr", addr);
|
528 | 4b48bf05 | Blue Swirl | qdev_prop_set_uint32(dev, "vram_size", vram_size);
|
529 | 4b48bf05 | Blue Swirl | qdev_prop_set_uint16(dev, "width", width);
|
530 | 4b48bf05 | Blue Swirl | qdev_prop_set_uint16(dev, "height", height);
|
531 | 4b48bf05 | Blue Swirl | qdev_prop_set_uint16(dev, "depth", depth);
|
532 | 4b48bf05 | Blue Swirl | qdev_init(dev); |
533 | 4b48bf05 | Blue Swirl | s = sysbus_from_qdev(dev); |
534 | 4b48bf05 | Blue Swirl | /* 8-bit plane */
|
535 | 4b48bf05 | Blue Swirl | sysbus_mmio_map(s, 0, addr + 0x00800000ULL); |
536 | 4b48bf05 | Blue Swirl | /* DAC */
|
537 | 4b48bf05 | Blue Swirl | sysbus_mmio_map(s, 1, addr + 0x00200000ULL); |
538 | 4b48bf05 | Blue Swirl | /* TEC (dummy) */
|
539 | 4b48bf05 | Blue Swirl | sysbus_mmio_map(s, 2, addr + 0x00700000ULL); |
540 | 4b48bf05 | Blue Swirl | /* THC 24 bit: NetBSD writes here even with 8-bit display: dummy */
|
541 | 4b48bf05 | Blue Swirl | sysbus_mmio_map(s, 3, addr + 0x00301000ULL); |
542 | 4b48bf05 | Blue Swirl | if (depth == 24) { |
543 | 4b48bf05 | Blue Swirl | /* 24-bit plane */
|
544 | 4b48bf05 | Blue Swirl | sysbus_mmio_map(s, 4, addr + 0x02000000ULL); |
545 | 4b48bf05 | Blue Swirl | /* Control plane */
|
546 | 4b48bf05 | Blue Swirl | sysbus_mmio_map(s, 5, addr + 0x0a000000ULL); |
547 | 4b48bf05 | Blue Swirl | } else {
|
548 | 4b48bf05 | Blue Swirl | /* THC 8 bit (dummy) */
|
549 | 4b48bf05 | Blue Swirl | sysbus_mmio_map(s, 4, addr + 0x00300000ULL); |
550 | 4b48bf05 | Blue Swirl | } |
551 | 4b48bf05 | Blue Swirl | } |
552 | 4b48bf05 | Blue Swirl | |
553 | 325f2747 | Blue Swirl | /* NCR89C100/MACIO Internal ID register */
|
554 | 325f2747 | Blue Swirl | static const uint8_t idreg_data[] = { 0xfe, 0x81, 0x01, 0x03 }; |
555 | 325f2747 | Blue Swirl | |
556 | 325f2747 | Blue Swirl | static void idreg_init(target_phys_addr_t addr) |
557 | 325f2747 | Blue Swirl | { |
558 | 325f2747 | Blue Swirl | DeviceState *dev; |
559 | 325f2747 | Blue Swirl | SysBusDevice *s; |
560 | 325f2747 | Blue Swirl | |
561 | 325f2747 | Blue Swirl | dev = qdev_create(NULL, "macio_idreg"); |
562 | 325f2747 | Blue Swirl | qdev_init(dev); |
563 | 325f2747 | Blue Swirl | s = sysbus_from_qdev(dev); |
564 | 325f2747 | Blue Swirl | |
565 | 325f2747 | Blue Swirl | sysbus_mmio_map(s, 0, addr);
|
566 | 325f2747 | Blue Swirl | cpu_physical_memory_write_rom(addr, idreg_data, sizeof(idreg_data));
|
567 | 325f2747 | Blue Swirl | } |
568 | 325f2747 | Blue Swirl | |
569 | 81a322d4 | Gerd Hoffmann | static int idreg_init1(SysBusDevice *dev) |
570 | 325f2747 | Blue Swirl | { |
571 | 325f2747 | Blue Swirl | ram_addr_t idreg_offset; |
572 | 325f2747 | Blue Swirl | |
573 | 325f2747 | Blue Swirl | idreg_offset = qemu_ram_alloc(sizeof(idreg_data));
|
574 | 325f2747 | Blue Swirl | sysbus_init_mmio(dev, sizeof(idreg_data), idreg_offset | IO_MEM_ROM);
|
575 | 81a322d4 | Gerd Hoffmann | return 0; |
576 | 325f2747 | Blue Swirl | } |
577 | 325f2747 | Blue Swirl | |
578 | 325f2747 | Blue Swirl | static SysBusDeviceInfo idreg_info = {
|
579 | 325f2747 | Blue Swirl | .init = idreg_init1, |
580 | 325f2747 | Blue Swirl | .qdev.name = "macio_idreg",
|
581 | 325f2747 | Blue Swirl | .qdev.size = sizeof(SysBusDevice),
|
582 | 325f2747 | Blue Swirl | }; |
583 | 325f2747 | Blue Swirl | |
584 | 325f2747 | Blue Swirl | static void idreg_register_devices(void) |
585 | 325f2747 | Blue Swirl | { |
586 | 325f2747 | Blue Swirl | sysbus_register_withprop(&idreg_info); |
587 | 325f2747 | Blue Swirl | } |
588 | 325f2747 | Blue Swirl | |
589 | 325f2747 | Blue Swirl | device_init(idreg_register_devices); |
590 | 325f2747 | Blue Swirl | |
591 | f48f6569 | Blue Swirl | /* Boot PROM (OpenBIOS) */
|
592 | f48f6569 | Blue Swirl | static void prom_init(target_phys_addr_t addr, const char *bios_name) |
593 | f48f6569 | Blue Swirl | { |
594 | f48f6569 | Blue Swirl | DeviceState *dev; |
595 | f48f6569 | Blue Swirl | SysBusDevice *s; |
596 | f48f6569 | Blue Swirl | char *filename;
|
597 | f48f6569 | Blue Swirl | int ret;
|
598 | f48f6569 | Blue Swirl | |
599 | f48f6569 | Blue Swirl | dev = qdev_create(NULL, "openprom"); |
600 | f48f6569 | Blue Swirl | qdev_init(dev); |
601 | f48f6569 | Blue Swirl | s = sysbus_from_qdev(dev); |
602 | f48f6569 | Blue Swirl | |
603 | f48f6569 | Blue Swirl | sysbus_mmio_map(s, 0, addr);
|
604 | f48f6569 | Blue Swirl | |
605 | f48f6569 | Blue Swirl | /* load boot prom */
|
606 | f48f6569 | Blue Swirl | if (bios_name == NULL) { |
607 | f48f6569 | Blue Swirl | bios_name = PROM_FILENAME; |
608 | f48f6569 | Blue Swirl | } |
609 | f48f6569 | Blue Swirl | filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name); |
610 | f48f6569 | Blue Swirl | if (filename) {
|
611 | f48f6569 | Blue Swirl | ret = load_elf(filename, addr - PROM_VADDR, NULL, NULL, NULL); |
612 | f48f6569 | Blue Swirl | if (ret < 0 || ret > PROM_SIZE_MAX) { |
613 | f48f6569 | Blue Swirl | ret = load_image_targphys(filename, addr, PROM_SIZE_MAX); |
614 | f48f6569 | Blue Swirl | } |
615 | f48f6569 | Blue Swirl | qemu_free(filename); |
616 | f48f6569 | Blue Swirl | } else {
|
617 | f48f6569 | Blue Swirl | ret = -1;
|
618 | f48f6569 | Blue Swirl | } |
619 | f48f6569 | Blue Swirl | if (ret < 0 || ret > PROM_SIZE_MAX) { |
620 | f48f6569 | Blue Swirl | fprintf(stderr, "qemu: could not load prom '%s'\n", bios_name);
|
621 | f48f6569 | Blue Swirl | exit(1);
|
622 | f48f6569 | Blue Swirl | } |
623 | f48f6569 | Blue Swirl | } |
624 | f48f6569 | Blue Swirl | |
625 | 81a322d4 | Gerd Hoffmann | static int prom_init1(SysBusDevice *dev) |
626 | f48f6569 | Blue Swirl | { |
627 | f48f6569 | Blue Swirl | ram_addr_t prom_offset; |
628 | f48f6569 | Blue Swirl | |
629 | f48f6569 | Blue Swirl | prom_offset = qemu_ram_alloc(PROM_SIZE_MAX); |
630 | f48f6569 | Blue Swirl | sysbus_init_mmio(dev, PROM_SIZE_MAX, prom_offset | IO_MEM_ROM); |
631 | 81a322d4 | Gerd Hoffmann | return 0; |
632 | f48f6569 | Blue Swirl | } |
633 | f48f6569 | Blue Swirl | |
634 | f48f6569 | Blue Swirl | static SysBusDeviceInfo prom_info = {
|
635 | f48f6569 | Blue Swirl | .init = prom_init1, |
636 | f48f6569 | Blue Swirl | .qdev.name = "openprom",
|
637 | f48f6569 | Blue Swirl | .qdev.size = sizeof(SysBusDevice),
|
638 | ee6847d1 | Gerd Hoffmann | .qdev.props = (Property[]) { |
639 | ee6847d1 | Gerd Hoffmann | {/* end of property list */}
|
640 | f48f6569 | Blue Swirl | } |
641 | f48f6569 | Blue Swirl | }; |
642 | f48f6569 | Blue Swirl | |
643 | f48f6569 | Blue Swirl | static void prom_register_devices(void) |
644 | f48f6569 | Blue Swirl | { |
645 | f48f6569 | Blue Swirl | sysbus_register_withprop(&prom_info); |
646 | f48f6569 | Blue Swirl | } |
647 | f48f6569 | Blue Swirl | |
648 | f48f6569 | Blue Swirl | device_init(prom_register_devices); |
649 | f48f6569 | Blue Swirl | |
650 | ee6847d1 | Gerd Hoffmann | typedef struct RamDevice |
651 | ee6847d1 | Gerd Hoffmann | { |
652 | ee6847d1 | Gerd Hoffmann | SysBusDevice busdev; |
653 | 04843626 | Blue Swirl | uint64_t size; |
654 | ee6847d1 | Gerd Hoffmann | } RamDevice; |
655 | ee6847d1 | Gerd Hoffmann | |
656 | a350db85 | Blue Swirl | /* System RAM */
|
657 | 81a322d4 | Gerd Hoffmann | static int ram_init1(SysBusDevice *dev) |
658 | a350db85 | Blue Swirl | { |
659 | a350db85 | Blue Swirl | ram_addr_t RAM_size, ram_offset; |
660 | ee6847d1 | Gerd Hoffmann | RamDevice *d = FROM_SYSBUS(RamDevice, dev); |
661 | a350db85 | Blue Swirl | |
662 | ee6847d1 | Gerd Hoffmann | RAM_size = d->size; |
663 | a350db85 | Blue Swirl | |
664 | a350db85 | Blue Swirl | ram_offset = qemu_ram_alloc(RAM_size); |
665 | a350db85 | Blue Swirl | sysbus_init_mmio(dev, RAM_size, ram_offset); |
666 | 81a322d4 | Gerd Hoffmann | return 0; |
667 | a350db85 | Blue Swirl | } |
668 | a350db85 | Blue Swirl | |
669 | a350db85 | Blue Swirl | static void ram_init(target_phys_addr_t addr, ram_addr_t RAM_size, |
670 | a350db85 | Blue Swirl | uint64_t max_mem) |
671 | a350db85 | Blue Swirl | { |
672 | a350db85 | Blue Swirl | DeviceState *dev; |
673 | a350db85 | Blue Swirl | SysBusDevice *s; |
674 | ee6847d1 | Gerd Hoffmann | RamDevice *d; |
675 | a350db85 | Blue Swirl | |
676 | a350db85 | Blue Swirl | /* allocate RAM */
|
677 | a350db85 | Blue Swirl | if ((uint64_t)RAM_size > max_mem) {
|
678 | a350db85 | Blue Swirl | fprintf(stderr, |
679 | a350db85 | Blue Swirl | "qemu: Too much memory for this machine: %d, maximum %d\n",
|
680 | a350db85 | Blue Swirl | (unsigned int)(RAM_size / (1024 * 1024)), |
681 | a350db85 | Blue Swirl | (unsigned int)(max_mem / (1024 * 1024))); |
682 | a350db85 | Blue Swirl | exit(1);
|
683 | a350db85 | Blue Swirl | } |
684 | a350db85 | Blue Swirl | dev = qdev_create(NULL, "memory"); |
685 | a350db85 | Blue Swirl | s = sysbus_from_qdev(dev); |
686 | a350db85 | Blue Swirl | |
687 | ee6847d1 | Gerd Hoffmann | d = FROM_SYSBUS(RamDevice, s); |
688 | ee6847d1 | Gerd Hoffmann | d->size = RAM_size; |
689 | f6e097e7 | Blue Swirl | qdev_init(dev); |
690 | ee6847d1 | Gerd Hoffmann | |
691 | a350db85 | Blue Swirl | sysbus_mmio_map(s, 0, addr);
|
692 | a350db85 | Blue Swirl | } |
693 | a350db85 | Blue Swirl | |
694 | a350db85 | Blue Swirl | static SysBusDeviceInfo ram_info = {
|
695 | a350db85 | Blue Swirl | .init = ram_init1, |
696 | a350db85 | Blue Swirl | .qdev.name = "memory",
|
697 | ee6847d1 | Gerd Hoffmann | .qdev.size = sizeof(RamDevice),
|
698 | ee6847d1 | Gerd Hoffmann | .qdev.props = (Property[]) { |
699 | c885159a | Gerd Hoffmann | DEFINE_PROP_UINT64("size", RamDevice, size, 0), |
700 | c885159a | Gerd Hoffmann | DEFINE_PROP_END_OF_LIST(), |
701 | a350db85 | Blue Swirl | } |
702 | a350db85 | Blue Swirl | }; |
703 | a350db85 | Blue Swirl | |
704 | a350db85 | Blue Swirl | static void ram_register_devices(void) |
705 | a350db85 | Blue Swirl | { |
706 | a350db85 | Blue Swirl | sysbus_register_withprop(&ram_info); |
707 | a350db85 | Blue Swirl | } |
708 | a350db85 | Blue Swirl | |
709 | a350db85 | Blue Swirl | device_init(ram_register_devices); |
710 | a350db85 | Blue Swirl | |
711 | 666713c0 | Blue Swirl | static CPUState *cpu_devinit(const char *cpu_model, unsigned int id, |
712 | 666713c0 | Blue Swirl | uint64_t prom_addr, qemu_irq **cpu_irqs) |
713 | 666713c0 | Blue Swirl | { |
714 | 666713c0 | Blue Swirl | CPUState *env; |
715 | 666713c0 | Blue Swirl | |
716 | 666713c0 | Blue Swirl | env = cpu_init(cpu_model); |
717 | 666713c0 | Blue Swirl | if (!env) {
|
718 | 666713c0 | Blue Swirl | fprintf(stderr, "qemu: Unable to find Sparc CPU definition\n");
|
719 | 666713c0 | Blue Swirl | exit(1);
|
720 | 666713c0 | Blue Swirl | } |
721 | 666713c0 | Blue Swirl | |
722 | 666713c0 | Blue Swirl | cpu_sparc_set_id(env, id); |
723 | 666713c0 | Blue Swirl | if (id == 0) { |
724 | 666713c0 | Blue Swirl | qemu_register_reset(main_cpu_reset, env); |
725 | 666713c0 | Blue Swirl | } else {
|
726 | 666713c0 | Blue Swirl | qemu_register_reset(secondary_cpu_reset, env); |
727 | 666713c0 | Blue Swirl | env->halted = 1;
|
728 | 666713c0 | Blue Swirl | } |
729 | 666713c0 | Blue Swirl | *cpu_irqs = qemu_allocate_irqs(cpu_set_irq, env, MAX_PILS); |
730 | 666713c0 | Blue Swirl | env->prom_addr = prom_addr; |
731 | 666713c0 | Blue Swirl | |
732 | 666713c0 | Blue Swirl | return env;
|
733 | 666713c0 | Blue Swirl | } |
734 | 666713c0 | Blue Swirl | |
735 | 8137cde8 | blueswir1 | static void sun4m_hw_init(const struct sun4m_hwdef *hwdef, ram_addr_t RAM_size, |
736 | 3ebf5aaf | blueswir1 | const char *boot_device, |
737 | 3023f332 | aliguori | const char *kernel_filename, |
738 | 3ebf5aaf | blueswir1 | const char *kernel_cmdline, |
739 | 3ebf5aaf | blueswir1 | const char *initrd_filename, const char *cpu_model) |
740 | 420557e8 | bellard | { |
741 | 666713c0 | Blue Swirl | CPUState *envs[MAX_CPUS]; |
742 | 713c45fa | bellard | unsigned int i; |
743 | cfb9de9c | Paul Brook | void *iommu, *espdma, *ledma, *nvram;
|
744 | a1961a4b | Blue Swirl | qemu_irq *cpu_irqs[MAX_CPUS], slavio_irq[32], slavio_cpu_irq[MAX_CPUS],
|
745 | 6f6260c7 | Blue Swirl | espdma_irq, ledma_irq; |
746 | 74ff8d90 | Blue Swirl | qemu_irq esp_reset; |
747 | 2582cfa0 | Blue Swirl | qemu_irq fdc_tc; |
748 | 6d0c293d | blueswir1 | qemu_irq *cpu_halt; |
749 | 5c6602c5 | blueswir1 | unsigned long kernel_size; |
750 | e4bcb14c | ths | BlockDriverState *fd[MAX_FD]; |
751 | 3cce6243 | blueswir1 | void *fw_cfg;
|
752 | 751c6a17 | Gerd Hoffmann | DriveInfo *dinfo; |
753 | 420557e8 | bellard | |
754 | ba3c64fb | bellard | /* init CPUs */
|
755 | 3ebf5aaf | blueswir1 | if (!cpu_model)
|
756 | 3ebf5aaf | blueswir1 | cpu_model = hwdef->default_cpu_model; |
757 | b3a23197 | blueswir1 | |
758 | ba3c64fb | bellard | for(i = 0; i < smp_cpus; i++) { |
759 | 666713c0 | Blue Swirl | envs[i] = cpu_devinit(cpu_model, i, hwdef->slavio_base, &cpu_irqs[i]); |
760 | ba3c64fb | bellard | } |
761 | b3a23197 | blueswir1 | |
762 | b3a23197 | blueswir1 | for (i = smp_cpus; i < MAX_CPUS; i++)
|
763 | b3a23197 | blueswir1 | cpu_irqs[i] = qemu_allocate_irqs(dummy_cpu_set_irq, NULL, MAX_PILS);
|
764 | b3a23197 | blueswir1 | |
765 | 3ebf5aaf | blueswir1 | |
766 | 3ebf5aaf | blueswir1 | /* set up devices */
|
767 | a350db85 | Blue Swirl | ram_init(0, RAM_size, hwdef->max_mem);
|
768 | a350db85 | Blue Swirl | |
769 | f48f6569 | Blue Swirl | prom_init(hwdef->slavio_base, bios_name); |
770 | f48f6569 | Blue Swirl | |
771 | d453c2c3 | Blue Swirl | slavio_intctl = slavio_intctl_init(hwdef->intctl_base, |
772 | d453c2c3 | Blue Swirl | hwdef->intctl_base + 0x10000ULL,
|
773 | 462eda24 | Blue Swirl | cpu_irqs); |
774 | a1961a4b | Blue Swirl | |
775 | a1961a4b | Blue Swirl | for (i = 0; i < 32; i++) { |
776 | d453c2c3 | Blue Swirl | slavio_irq[i] = qdev_get_gpio_in(slavio_intctl, i); |
777 | a1961a4b | Blue Swirl | } |
778 | a1961a4b | Blue Swirl | for (i = 0; i < MAX_CPUS; i++) { |
779 | d453c2c3 | Blue Swirl | slavio_cpu_irq[i] = qdev_get_gpio_in(slavio_intctl, 32 + i);
|
780 | a1961a4b | Blue Swirl | } |
781 | b3a23197 | blueswir1 | |
782 | fe096129 | blueswir1 | if (hwdef->idreg_base) {
|
783 | 325f2747 | Blue Swirl | idreg_init(hwdef->idreg_base); |
784 | 4c2485de | blueswir1 | } |
785 | 4c2485de | blueswir1 | |
786 | ff403da6 | blueswir1 | iommu = iommu_init(hwdef->iommu_base, hwdef->iommu_version, |
787 | c533e0b3 | Blue Swirl | slavio_irq[30]);
|
788 | ff403da6 | blueswir1 | |
789 | c533e0b3 | Blue Swirl | espdma = sparc32_dma_init(hwdef->dma_base, slavio_irq[18],
|
790 | 74ff8d90 | Blue Swirl | iommu, &espdma_irq); |
791 | 2d069bab | blueswir1 | |
792 | 5aca8c3b | blueswir1 | ledma = sparc32_dma_init(hwdef->dma_base + 16ULL,
|
793 | 74ff8d90 | Blue Swirl | slavio_irq[16], iommu, &ledma_irq);
|
794 | ba3c64fb | bellard | |
795 | eee0b836 | blueswir1 | if (graphic_depth != 8 && graphic_depth != 24) { |
796 | eee0b836 | blueswir1 | fprintf(stderr, "qemu: Unsupported depth: %d\n", graphic_depth);
|
797 | eee0b836 | blueswir1 | exit (1);
|
798 | eee0b836 | blueswir1 | } |
799 | d95d8f1c | Blue Swirl | tcx_init(hwdef->tcx_base, 0x00100000, graphic_width, graphic_height,
|
800 | dc828ca1 | pbrook | graphic_depth); |
801 | dbe06e18 | blueswir1 | |
802 | 74ff8d90 | Blue Swirl | lance_init(&nd_table[0], hwdef->le_base, ledma, ledma_irq);
|
803 | dbe06e18 | blueswir1 | |
804 | d95d8f1c | Blue Swirl | nvram = m48t59_init(slavio_irq[0], hwdef->nvram_base, 0, 0x2000, 8); |
805 | 81732d19 | blueswir1 | |
806 | c533e0b3 | Blue Swirl | slavio_timer_init_all(hwdef->counter_base, slavio_irq[19], slavio_cpu_irq, smp_cpus);
|
807 | 81732d19 | blueswir1 | |
808 | c533e0b3 | Blue Swirl | slavio_serial_ms_kbd_init(hwdef->ms_kb_base, slavio_irq[14],
|
809 | 993fbfdb | Anthony Liguori | display_type == DT_NOGRAPHIC, ESCC_CLOCK, 1);
|
810 | b81b3b10 | bellard | // Slavio TTYA (base+4, Linux ttyS0) is the first Qemu serial device
|
811 | b81b3b10 | bellard | // Slavio TTYB (base+0, Linux ttyS1) is the second Qemu serial device
|
812 | c533e0b3 | Blue Swirl | escc_init(hwdef->serial_base, slavio_irq[15], slavio_irq[15], |
813 | aeeb69c7 | aurel32 | serial_hds[0], serial_hds[1], ESCC_CLOCK, 1); |
814 | 741402f9 | blueswir1 | |
815 | 6d0c293d | blueswir1 | cpu_halt = qemu_allocate_irqs(cpu_halt_signal, NULL, 1); |
816 | b2b6f6ec | Blue Swirl | slavio_misc_init(hwdef->slavio_base, hwdef->aux1_base, hwdef->aux2_base, |
817 | b2b6f6ec | Blue Swirl | slavio_irq[30], fdc_tc);
|
818 | b2b6f6ec | Blue Swirl | |
819 | 2582cfa0 | Blue Swirl | if (hwdef->apc_base) {
|
820 | 2582cfa0 | Blue Swirl | apc_init(hwdef->apc_base, cpu_halt[0]);
|
821 | 2582cfa0 | Blue Swirl | } |
822 | 2be17ebd | blueswir1 | |
823 | fe096129 | blueswir1 | if (hwdef->fd_base) {
|
824 | e4bcb14c | ths | /* there is zero or one floppy drive */
|
825 | 309e60bd | blueswir1 | memset(fd, 0, sizeof(fd)); |
826 | 751c6a17 | Gerd Hoffmann | dinfo = drive_get(IF_FLOPPY, 0, 0); |
827 | 751c6a17 | Gerd Hoffmann | if (dinfo)
|
828 | 751c6a17 | Gerd Hoffmann | fd[0] = dinfo->bdrv;
|
829 | 2d069bab | blueswir1 | |
830 | c533e0b3 | Blue Swirl | sun4m_fdctrl_init(slavio_irq[22], hwdef->fd_base, fd,
|
831 | 2582cfa0 | Blue Swirl | &fdc_tc); |
832 | e4bcb14c | ths | } |
833 | e4bcb14c | ths | |
834 | e4bcb14c | ths | if (drive_get_max_bus(IF_SCSI) > 0) { |
835 | e4bcb14c | ths | fprintf(stderr, "qemu: too many SCSI bus\n");
|
836 | e4bcb14c | ths | exit(1);
|
837 | e4bcb14c | ths | } |
838 | e4bcb14c | ths | |
839 | 74ff8d90 | Blue Swirl | esp_reset = qdev_get_gpio_in(espdma, 0);
|
840 | cfb9de9c | Paul Brook | esp_init(hwdef->esp_base, 2,
|
841 | cfb9de9c | Paul Brook | espdma_memory_read, espdma_memory_write, |
842 | 74ff8d90 | Blue Swirl | espdma, espdma_irq, &esp_reset); |
843 | 74ff8d90 | Blue Swirl | |
844 | f1587550 | ths | |
845 | fa28ec52 | Blue Swirl | if (hwdef->cs_base) {
|
846 | fa28ec52 | Blue Swirl | sysbus_create_simple("SUNW,CS4231", hwdef->cs_base,
|
847 | c533e0b3 | Blue Swirl | slavio_irq[5]);
|
848 | fa28ec52 | Blue Swirl | } |
849 | b3ceef24 | blueswir1 | |
850 | 293f78bc | blueswir1 | kernel_size = sun4m_load_kernel(kernel_filename, initrd_filename, |
851 | 293f78bc | blueswir1 | RAM_size); |
852 | 36cd9210 | blueswir1 | |
853 | 36cd9210 | blueswir1 | nvram_init(nvram, (uint8_t *)&nd_table[0].macaddr, kernel_cmdline,
|
854 | b3ceef24 | blueswir1 | boot_device, RAM_size, kernel_size, graphic_width, |
855 | 905fdcb5 | blueswir1 | graphic_height, graphic_depth, hwdef->nvram_machine_id, |
856 | 905fdcb5 | blueswir1 | "Sun4m");
|
857 | 7eb0c8e8 | blueswir1 | |
858 | fe096129 | blueswir1 | if (hwdef->ecc_base)
|
859 | c533e0b3 | Blue Swirl | ecc_init(hwdef->ecc_base, slavio_irq[28],
|
860 | e42c20b4 | blueswir1 | hwdef->ecc_version); |
861 | 3cce6243 | blueswir1 | |
862 | 3cce6243 | blueswir1 | fw_cfg = fw_cfg_init(0, 0, CFG_ADDR, CFG_ADDR + 2); |
863 | 3cce6243 | blueswir1 | fw_cfg_add_i32(fw_cfg, FW_CFG_ID, 1);
|
864 | 905fdcb5 | blueswir1 | fw_cfg_add_i64(fw_cfg, FW_CFG_RAM_SIZE, (uint64_t)ram_size); |
865 | 905fdcb5 | blueswir1 | fw_cfg_add_i16(fw_cfg, FW_CFG_MACHINE_ID, hwdef->machine_id); |
866 | fbfcf955 | blueswir1 | fw_cfg_add_i16(fw_cfg, FW_CFG_SUN4M_DEPTH, graphic_depth); |
867 | 513f789f | blueswir1 | fw_cfg_add_i32(fw_cfg, FW_CFG_KERNEL_ADDR, KERNEL_LOAD_ADDR); |
868 | 513f789f | blueswir1 | fw_cfg_add_i32(fw_cfg, FW_CFG_KERNEL_SIZE, kernel_size); |
869 | 513f789f | blueswir1 | if (kernel_cmdline) {
|
870 | 513f789f | blueswir1 | fw_cfg_add_i32(fw_cfg, FW_CFG_KERNEL_CMDLINE, CMDLINE_ADDR); |
871 | 513f789f | blueswir1 | pstrcpy_targphys(CMDLINE_ADDR, TARGET_PAGE_SIZE, kernel_cmdline); |
872 | 513f789f | blueswir1 | } else {
|
873 | 513f789f | blueswir1 | fw_cfg_add_i32(fw_cfg, FW_CFG_KERNEL_CMDLINE, 0);
|
874 | 513f789f | blueswir1 | } |
875 | 513f789f | blueswir1 | fw_cfg_add_i32(fw_cfg, FW_CFG_INITRD_ADDR, INITRD_LOAD_ADDR); |
876 | 513f789f | blueswir1 | fw_cfg_add_i32(fw_cfg, FW_CFG_INITRD_SIZE, 0); // not used |
877 | 513f789f | blueswir1 | fw_cfg_add_i16(fw_cfg, FW_CFG_BOOT_DEVICE, boot_device[0]);
|
878 | 513f789f | blueswir1 | qemu_register_boot_set(fw_cfg_boot_set, fw_cfg); |
879 | 36cd9210 | blueswir1 | } |
880 | 36cd9210 | blueswir1 | |
881 | 905fdcb5 | blueswir1 | enum {
|
882 | 905fdcb5 | blueswir1 | ss2_id = 0,
|
883 | 905fdcb5 | blueswir1 | ss5_id = 32,
|
884 | 905fdcb5 | blueswir1 | vger_id, |
885 | 905fdcb5 | blueswir1 | lx_id, |
886 | 905fdcb5 | blueswir1 | ss4_id, |
887 | 905fdcb5 | blueswir1 | scls_id, |
888 | 905fdcb5 | blueswir1 | sbook_id, |
889 | 905fdcb5 | blueswir1 | ss10_id = 64,
|
890 | 905fdcb5 | blueswir1 | ss20_id, |
891 | 905fdcb5 | blueswir1 | ss600mp_id, |
892 | 905fdcb5 | blueswir1 | ss1000_id = 96,
|
893 | 905fdcb5 | blueswir1 | ss2000_id, |
894 | 905fdcb5 | blueswir1 | }; |
895 | 905fdcb5 | blueswir1 | |
896 | 8137cde8 | blueswir1 | static const struct sun4m_hwdef sun4m_hwdefs[] = { |
897 | 36cd9210 | blueswir1 | /* SS-5 */
|
898 | 36cd9210 | blueswir1 | { |
899 | 36cd9210 | blueswir1 | .iommu_base = 0x10000000,
|
900 | 36cd9210 | blueswir1 | .tcx_base = 0x50000000,
|
901 | 36cd9210 | blueswir1 | .cs_base = 0x6c000000,
|
902 | 384ccb5d | blueswir1 | .slavio_base = 0x70000000,
|
903 | 36cd9210 | blueswir1 | .ms_kb_base = 0x71000000,
|
904 | 36cd9210 | blueswir1 | .serial_base = 0x71100000,
|
905 | 36cd9210 | blueswir1 | .nvram_base = 0x71200000,
|
906 | 36cd9210 | blueswir1 | .fd_base = 0x71400000,
|
907 | 36cd9210 | blueswir1 | .counter_base = 0x71d00000,
|
908 | 36cd9210 | blueswir1 | .intctl_base = 0x71e00000,
|
909 | 4c2485de | blueswir1 | .idreg_base = 0x78000000,
|
910 | 36cd9210 | blueswir1 | .dma_base = 0x78400000,
|
911 | 36cd9210 | blueswir1 | .esp_base = 0x78800000,
|
912 | 36cd9210 | blueswir1 | .le_base = 0x78c00000,
|
913 | 127fc407 | blueswir1 | .apc_base = 0x6a000000,
|
914 | 0019ad53 | blueswir1 | .aux1_base = 0x71900000,
|
915 | 0019ad53 | blueswir1 | .aux2_base = 0x71910000,
|
916 | 905fdcb5 | blueswir1 | .nvram_machine_id = 0x80,
|
917 | 905fdcb5 | blueswir1 | .machine_id = ss5_id, |
918 | cf3102ac | blueswir1 | .iommu_version = 0x05000000,
|
919 | 3ebf5aaf | blueswir1 | .max_mem = 0x10000000,
|
920 | 3ebf5aaf | blueswir1 | .default_cpu_model = "Fujitsu MB86904",
|
921 | e0353fe2 | blueswir1 | }, |
922 | e0353fe2 | blueswir1 | /* SS-10 */
|
923 | e0353fe2 | blueswir1 | { |
924 | 5dcb6b91 | blueswir1 | .iommu_base = 0xfe0000000ULL,
|
925 | 5dcb6b91 | blueswir1 | .tcx_base = 0xe20000000ULL,
|
926 | 5dcb6b91 | blueswir1 | .slavio_base = 0xff0000000ULL,
|
927 | 5dcb6b91 | blueswir1 | .ms_kb_base = 0xff1000000ULL,
|
928 | 5dcb6b91 | blueswir1 | .serial_base = 0xff1100000ULL,
|
929 | 5dcb6b91 | blueswir1 | .nvram_base = 0xff1200000ULL,
|
930 | 5dcb6b91 | blueswir1 | .fd_base = 0xff1700000ULL,
|
931 | 5dcb6b91 | blueswir1 | .counter_base = 0xff1300000ULL,
|
932 | 5dcb6b91 | blueswir1 | .intctl_base = 0xff1400000ULL,
|
933 | 4c2485de | blueswir1 | .idreg_base = 0xef0000000ULL,
|
934 | 5dcb6b91 | blueswir1 | .dma_base = 0xef0400000ULL,
|
935 | 5dcb6b91 | blueswir1 | .esp_base = 0xef0800000ULL,
|
936 | 5dcb6b91 | blueswir1 | .le_base = 0xef0c00000ULL,
|
937 | 0019ad53 | blueswir1 | .apc_base = 0xefa000000ULL, // XXX should not exist |
938 | 127fc407 | blueswir1 | .aux1_base = 0xff1800000ULL,
|
939 | 127fc407 | blueswir1 | .aux2_base = 0xff1a01000ULL,
|
940 | 7eb0c8e8 | blueswir1 | .ecc_base = 0xf00000000ULL,
|
941 | 7eb0c8e8 | blueswir1 | .ecc_version = 0x10000000, // version 0, implementation 1 |
942 | 905fdcb5 | blueswir1 | .nvram_machine_id = 0x72,
|
943 | 905fdcb5 | blueswir1 | .machine_id = ss10_id, |
944 | 7fbfb139 | blueswir1 | .iommu_version = 0x03000000,
|
945 | 6ef05b95 | blueswir1 | .max_mem = 0xf00000000ULL,
|
946 | 3ebf5aaf | blueswir1 | .default_cpu_model = "TI SuperSparc II",
|
947 | 36cd9210 | blueswir1 | }, |
948 | 6a3b9cc9 | blueswir1 | /* SS-600MP */
|
949 | 6a3b9cc9 | blueswir1 | { |
950 | 6a3b9cc9 | blueswir1 | .iommu_base = 0xfe0000000ULL,
|
951 | 6a3b9cc9 | blueswir1 | .tcx_base = 0xe20000000ULL,
|
952 | 6a3b9cc9 | blueswir1 | .slavio_base = 0xff0000000ULL,
|
953 | 6a3b9cc9 | blueswir1 | .ms_kb_base = 0xff1000000ULL,
|
954 | 6a3b9cc9 | blueswir1 | .serial_base = 0xff1100000ULL,
|
955 | 6a3b9cc9 | blueswir1 | .nvram_base = 0xff1200000ULL,
|
956 | 6a3b9cc9 | blueswir1 | .counter_base = 0xff1300000ULL,
|
957 | 6a3b9cc9 | blueswir1 | .intctl_base = 0xff1400000ULL,
|
958 | 6a3b9cc9 | blueswir1 | .dma_base = 0xef0081000ULL,
|
959 | 6a3b9cc9 | blueswir1 | .esp_base = 0xef0080000ULL,
|
960 | 6a3b9cc9 | blueswir1 | .le_base = 0xef0060000ULL,
|
961 | 0019ad53 | blueswir1 | .apc_base = 0xefa000000ULL, // XXX should not exist |
962 | 127fc407 | blueswir1 | .aux1_base = 0xff1800000ULL,
|
963 | 127fc407 | blueswir1 | .aux2_base = 0xff1a01000ULL, // XXX should not exist |
964 | 7eb0c8e8 | blueswir1 | .ecc_base = 0xf00000000ULL,
|
965 | 7eb0c8e8 | blueswir1 | .ecc_version = 0x00000000, // version 0, implementation 0 |
966 | 905fdcb5 | blueswir1 | .nvram_machine_id = 0x71,
|
967 | 905fdcb5 | blueswir1 | .machine_id = ss600mp_id, |
968 | 7fbfb139 | blueswir1 | .iommu_version = 0x01000000,
|
969 | 6ef05b95 | blueswir1 | .max_mem = 0xf00000000ULL,
|
970 | 3ebf5aaf | blueswir1 | .default_cpu_model = "TI SuperSparc II",
|
971 | 6a3b9cc9 | blueswir1 | }, |
972 | ae40972f | blueswir1 | /* SS-20 */
|
973 | ae40972f | blueswir1 | { |
974 | ae40972f | blueswir1 | .iommu_base = 0xfe0000000ULL,
|
975 | ae40972f | blueswir1 | .tcx_base = 0xe20000000ULL,
|
976 | ae40972f | blueswir1 | .slavio_base = 0xff0000000ULL,
|
977 | ae40972f | blueswir1 | .ms_kb_base = 0xff1000000ULL,
|
978 | ae40972f | blueswir1 | .serial_base = 0xff1100000ULL,
|
979 | ae40972f | blueswir1 | .nvram_base = 0xff1200000ULL,
|
980 | ae40972f | blueswir1 | .fd_base = 0xff1700000ULL,
|
981 | ae40972f | blueswir1 | .counter_base = 0xff1300000ULL,
|
982 | ae40972f | blueswir1 | .intctl_base = 0xff1400000ULL,
|
983 | 4c2485de | blueswir1 | .idreg_base = 0xef0000000ULL,
|
984 | ae40972f | blueswir1 | .dma_base = 0xef0400000ULL,
|
985 | ae40972f | blueswir1 | .esp_base = 0xef0800000ULL,
|
986 | ae40972f | blueswir1 | .le_base = 0xef0c00000ULL,
|
987 | 0019ad53 | blueswir1 | .apc_base = 0xefa000000ULL, // XXX should not exist |
988 | 577d8dd4 | blueswir1 | .aux1_base = 0xff1800000ULL,
|
989 | 577d8dd4 | blueswir1 | .aux2_base = 0xff1a01000ULL,
|
990 | ae40972f | blueswir1 | .ecc_base = 0xf00000000ULL,
|
991 | ae40972f | blueswir1 | .ecc_version = 0x20000000, // version 0, implementation 2 |
992 | 905fdcb5 | blueswir1 | .nvram_machine_id = 0x72,
|
993 | 905fdcb5 | blueswir1 | .machine_id = ss20_id, |
994 | ae40972f | blueswir1 | .iommu_version = 0x13000000,
|
995 | 6ef05b95 | blueswir1 | .max_mem = 0xf00000000ULL,
|
996 | ae40972f | blueswir1 | .default_cpu_model = "TI SuperSparc II",
|
997 | ae40972f | blueswir1 | }, |
998 | a526a31c | blueswir1 | /* Voyager */
|
999 | a526a31c | blueswir1 | { |
1000 | a526a31c | blueswir1 | .iommu_base = 0x10000000,
|
1001 | a526a31c | blueswir1 | .tcx_base = 0x50000000,
|
1002 | a526a31c | blueswir1 | .slavio_base = 0x70000000,
|
1003 | a526a31c | blueswir1 | .ms_kb_base = 0x71000000,
|
1004 | a526a31c | blueswir1 | .serial_base = 0x71100000,
|
1005 | a526a31c | blueswir1 | .nvram_base = 0x71200000,
|
1006 | a526a31c | blueswir1 | .fd_base = 0x71400000,
|
1007 | a526a31c | blueswir1 | .counter_base = 0x71d00000,
|
1008 | a526a31c | blueswir1 | .intctl_base = 0x71e00000,
|
1009 | a526a31c | blueswir1 | .idreg_base = 0x78000000,
|
1010 | a526a31c | blueswir1 | .dma_base = 0x78400000,
|
1011 | a526a31c | blueswir1 | .esp_base = 0x78800000,
|
1012 | a526a31c | blueswir1 | .le_base = 0x78c00000,
|
1013 | a526a31c | blueswir1 | .apc_base = 0x71300000, // pmc |
1014 | a526a31c | blueswir1 | .aux1_base = 0x71900000,
|
1015 | a526a31c | blueswir1 | .aux2_base = 0x71910000,
|
1016 | 905fdcb5 | blueswir1 | .nvram_machine_id = 0x80,
|
1017 | 905fdcb5 | blueswir1 | .machine_id = vger_id, |
1018 | a526a31c | blueswir1 | .iommu_version = 0x05000000,
|
1019 | a526a31c | blueswir1 | .max_mem = 0x10000000,
|
1020 | a526a31c | blueswir1 | .default_cpu_model = "Fujitsu MB86904",
|
1021 | a526a31c | blueswir1 | }, |
1022 | a526a31c | blueswir1 | /* LX */
|
1023 | a526a31c | blueswir1 | { |
1024 | a526a31c | blueswir1 | .iommu_base = 0x10000000,
|
1025 | a526a31c | blueswir1 | .tcx_base = 0x50000000,
|
1026 | a526a31c | blueswir1 | .slavio_base = 0x70000000,
|
1027 | a526a31c | blueswir1 | .ms_kb_base = 0x71000000,
|
1028 | a526a31c | blueswir1 | .serial_base = 0x71100000,
|
1029 | a526a31c | blueswir1 | .nvram_base = 0x71200000,
|
1030 | a526a31c | blueswir1 | .fd_base = 0x71400000,
|
1031 | a526a31c | blueswir1 | .counter_base = 0x71d00000,
|
1032 | a526a31c | blueswir1 | .intctl_base = 0x71e00000,
|
1033 | a526a31c | blueswir1 | .idreg_base = 0x78000000,
|
1034 | a526a31c | blueswir1 | .dma_base = 0x78400000,
|
1035 | a526a31c | blueswir1 | .esp_base = 0x78800000,
|
1036 | a526a31c | blueswir1 | .le_base = 0x78c00000,
|
1037 | a526a31c | blueswir1 | .aux1_base = 0x71900000,
|
1038 | a526a31c | blueswir1 | .aux2_base = 0x71910000,
|
1039 | 905fdcb5 | blueswir1 | .nvram_machine_id = 0x80,
|
1040 | 905fdcb5 | blueswir1 | .machine_id = lx_id, |
1041 | a526a31c | blueswir1 | .iommu_version = 0x04000000,
|
1042 | a526a31c | blueswir1 | .max_mem = 0x10000000,
|
1043 | a526a31c | blueswir1 | .default_cpu_model = "TI MicroSparc I",
|
1044 | a526a31c | blueswir1 | }, |
1045 | a526a31c | blueswir1 | /* SS-4 */
|
1046 | a526a31c | blueswir1 | { |
1047 | a526a31c | blueswir1 | .iommu_base = 0x10000000,
|
1048 | a526a31c | blueswir1 | .tcx_base = 0x50000000,
|
1049 | a526a31c | blueswir1 | .cs_base = 0x6c000000,
|
1050 | a526a31c | blueswir1 | .slavio_base = 0x70000000,
|
1051 | a526a31c | blueswir1 | .ms_kb_base = 0x71000000,
|
1052 | a526a31c | blueswir1 | .serial_base = 0x71100000,
|
1053 | a526a31c | blueswir1 | .nvram_base = 0x71200000,
|
1054 | a526a31c | blueswir1 | .fd_base = 0x71400000,
|
1055 | a526a31c | blueswir1 | .counter_base = 0x71d00000,
|
1056 | a526a31c | blueswir1 | .intctl_base = 0x71e00000,
|
1057 | a526a31c | blueswir1 | .idreg_base = 0x78000000,
|
1058 | a526a31c | blueswir1 | .dma_base = 0x78400000,
|
1059 | a526a31c | blueswir1 | .esp_base = 0x78800000,
|
1060 | a526a31c | blueswir1 | .le_base = 0x78c00000,
|
1061 | a526a31c | blueswir1 | .apc_base = 0x6a000000,
|
1062 | a526a31c | blueswir1 | .aux1_base = 0x71900000,
|
1063 | a526a31c | blueswir1 | .aux2_base = 0x71910000,
|
1064 | 905fdcb5 | blueswir1 | .nvram_machine_id = 0x80,
|
1065 | 905fdcb5 | blueswir1 | .machine_id = ss4_id, |
1066 | a526a31c | blueswir1 | .iommu_version = 0x05000000,
|
1067 | a526a31c | blueswir1 | .max_mem = 0x10000000,
|
1068 | a526a31c | blueswir1 | .default_cpu_model = "Fujitsu MB86904",
|
1069 | a526a31c | blueswir1 | }, |
1070 | a526a31c | blueswir1 | /* SPARCClassic */
|
1071 | a526a31c | blueswir1 | { |
1072 | a526a31c | blueswir1 | .iommu_base = 0x10000000,
|
1073 | a526a31c | blueswir1 | .tcx_base = 0x50000000,
|
1074 | a526a31c | blueswir1 | .slavio_base = 0x70000000,
|
1075 | a526a31c | blueswir1 | .ms_kb_base = 0x71000000,
|
1076 | a526a31c | blueswir1 | .serial_base = 0x71100000,
|
1077 | a526a31c | blueswir1 | .nvram_base = 0x71200000,
|
1078 | a526a31c | blueswir1 | .fd_base = 0x71400000,
|
1079 | a526a31c | blueswir1 | .counter_base = 0x71d00000,
|
1080 | a526a31c | blueswir1 | .intctl_base = 0x71e00000,
|
1081 | a526a31c | blueswir1 | .idreg_base = 0x78000000,
|
1082 | a526a31c | blueswir1 | .dma_base = 0x78400000,
|
1083 | a526a31c | blueswir1 | .esp_base = 0x78800000,
|
1084 | a526a31c | blueswir1 | .le_base = 0x78c00000,
|
1085 | a526a31c | blueswir1 | .apc_base = 0x6a000000,
|
1086 | a526a31c | blueswir1 | .aux1_base = 0x71900000,
|
1087 | a526a31c | blueswir1 | .aux2_base = 0x71910000,
|
1088 | 905fdcb5 | blueswir1 | .nvram_machine_id = 0x80,
|
1089 | 905fdcb5 | blueswir1 | .machine_id = scls_id, |
1090 | a526a31c | blueswir1 | .iommu_version = 0x05000000,
|
1091 | a526a31c | blueswir1 | .max_mem = 0x10000000,
|
1092 | a526a31c | blueswir1 | .default_cpu_model = "TI MicroSparc I",
|
1093 | a526a31c | blueswir1 | }, |
1094 | a526a31c | blueswir1 | /* SPARCbook */
|
1095 | a526a31c | blueswir1 | { |
1096 | a526a31c | blueswir1 | .iommu_base = 0x10000000,
|
1097 | a526a31c | blueswir1 | .tcx_base = 0x50000000, // XXX |
1098 | a526a31c | blueswir1 | .slavio_base = 0x70000000,
|
1099 | a526a31c | blueswir1 | .ms_kb_base = 0x71000000,
|
1100 | a526a31c | blueswir1 | .serial_base = 0x71100000,
|
1101 | a526a31c | blueswir1 | .nvram_base = 0x71200000,
|
1102 | a526a31c | blueswir1 | .fd_base = 0x71400000,
|
1103 | a526a31c | blueswir1 | .counter_base = 0x71d00000,
|
1104 | a526a31c | blueswir1 | .intctl_base = 0x71e00000,
|
1105 | a526a31c | blueswir1 | .idreg_base = 0x78000000,
|
1106 | a526a31c | blueswir1 | .dma_base = 0x78400000,
|
1107 | a526a31c | blueswir1 | .esp_base = 0x78800000,
|
1108 | a526a31c | blueswir1 | .le_base = 0x78c00000,
|
1109 | a526a31c | blueswir1 | .apc_base = 0x6a000000,
|
1110 | a526a31c | blueswir1 | .aux1_base = 0x71900000,
|
1111 | a526a31c | blueswir1 | .aux2_base = 0x71910000,
|
1112 | 905fdcb5 | blueswir1 | .nvram_machine_id = 0x80,
|
1113 | 905fdcb5 | blueswir1 | .machine_id = sbook_id, |
1114 | a526a31c | blueswir1 | .iommu_version = 0x05000000,
|
1115 | a526a31c | blueswir1 | .max_mem = 0x10000000,
|
1116 | a526a31c | blueswir1 | .default_cpu_model = "TI MicroSparc I",
|
1117 | a526a31c | blueswir1 | }, |
1118 | 36cd9210 | blueswir1 | }; |
1119 | 36cd9210 | blueswir1 | |
1120 | 36cd9210 | blueswir1 | /* SPARCstation 5 hardware initialisation */
|
1121 | fbe1b595 | Paul Brook | static void ss5_init(ram_addr_t RAM_size, |
1122 | 3023f332 | aliguori | const char *boot_device, |
1123 | b881c2c6 | blueswir1 | const char *kernel_filename, const char *kernel_cmdline, |
1124 | b881c2c6 | blueswir1 | const char *initrd_filename, const char *cpu_model) |
1125 | 36cd9210 | blueswir1 | { |
1126 | 3023f332 | aliguori | sun4m_hw_init(&sun4m_hwdefs[0], RAM_size, boot_device, kernel_filename,
|
1127 | 3ebf5aaf | blueswir1 | kernel_cmdline, initrd_filename, cpu_model); |
1128 | 420557e8 | bellard | } |
1129 | c0e564d5 | bellard | |
1130 | e0353fe2 | blueswir1 | /* SPARCstation 10 hardware initialisation */
|
1131 | fbe1b595 | Paul Brook | static void ss10_init(ram_addr_t RAM_size, |
1132 | 3023f332 | aliguori | const char *boot_device, |
1133 | b881c2c6 | blueswir1 | const char *kernel_filename, const char *kernel_cmdline, |
1134 | b881c2c6 | blueswir1 | const char *initrd_filename, const char *cpu_model) |
1135 | e0353fe2 | blueswir1 | { |
1136 | 3023f332 | aliguori | sun4m_hw_init(&sun4m_hwdefs[1], RAM_size, boot_device, kernel_filename,
|
1137 | 3ebf5aaf | blueswir1 | kernel_cmdline, initrd_filename, cpu_model); |
1138 | e0353fe2 | blueswir1 | } |
1139 | e0353fe2 | blueswir1 | |
1140 | 6a3b9cc9 | blueswir1 | /* SPARCserver 600MP hardware initialisation */
|
1141 | fbe1b595 | Paul Brook | static void ss600mp_init(ram_addr_t RAM_size, |
1142 | 3023f332 | aliguori | const char *boot_device, |
1143 | 77f193da | blueswir1 | const char *kernel_filename, |
1144 | 77f193da | blueswir1 | const char *kernel_cmdline, |
1145 | 6a3b9cc9 | blueswir1 | const char *initrd_filename, const char *cpu_model) |
1146 | 6a3b9cc9 | blueswir1 | { |
1147 | 3023f332 | aliguori | sun4m_hw_init(&sun4m_hwdefs[2], RAM_size, boot_device, kernel_filename,
|
1148 | 3ebf5aaf | blueswir1 | kernel_cmdline, initrd_filename, cpu_model); |
1149 | 6a3b9cc9 | blueswir1 | } |
1150 | 6a3b9cc9 | blueswir1 | |
1151 | ae40972f | blueswir1 | /* SPARCstation 20 hardware initialisation */
|
1152 | fbe1b595 | Paul Brook | static void ss20_init(ram_addr_t RAM_size, |
1153 | 3023f332 | aliguori | const char *boot_device, |
1154 | ae40972f | blueswir1 | const char *kernel_filename, const char *kernel_cmdline, |
1155 | ae40972f | blueswir1 | const char *initrd_filename, const char *cpu_model) |
1156 | ae40972f | blueswir1 | { |
1157 | 3023f332 | aliguori | sun4m_hw_init(&sun4m_hwdefs[3], RAM_size, boot_device, kernel_filename,
|
1158 | ee76f82e | blueswir1 | kernel_cmdline, initrd_filename, cpu_model); |
1159 | ee76f82e | blueswir1 | } |
1160 | ee76f82e | blueswir1 | |
1161 | a526a31c | blueswir1 | /* SPARCstation Voyager hardware initialisation */
|
1162 | fbe1b595 | Paul Brook | static void vger_init(ram_addr_t RAM_size, |
1163 | 3023f332 | aliguori | const char *boot_device, |
1164 | a526a31c | blueswir1 | const char *kernel_filename, const char *kernel_cmdline, |
1165 | a526a31c | blueswir1 | const char *initrd_filename, const char *cpu_model) |
1166 | a526a31c | blueswir1 | { |
1167 | 3023f332 | aliguori | sun4m_hw_init(&sun4m_hwdefs[4], RAM_size, boot_device, kernel_filename,
|
1168 | a526a31c | blueswir1 | kernel_cmdline, initrd_filename, cpu_model); |
1169 | a526a31c | blueswir1 | } |
1170 | a526a31c | blueswir1 | |
1171 | a526a31c | blueswir1 | /* SPARCstation LX hardware initialisation */
|
1172 | fbe1b595 | Paul Brook | static void ss_lx_init(ram_addr_t RAM_size, |
1173 | 3023f332 | aliguori | const char *boot_device, |
1174 | a526a31c | blueswir1 | const char *kernel_filename, const char *kernel_cmdline, |
1175 | a526a31c | blueswir1 | const char *initrd_filename, const char *cpu_model) |
1176 | a526a31c | blueswir1 | { |
1177 | 3023f332 | aliguori | sun4m_hw_init(&sun4m_hwdefs[5], RAM_size, boot_device, kernel_filename,
|
1178 | a526a31c | blueswir1 | kernel_cmdline, initrd_filename, cpu_model); |
1179 | a526a31c | blueswir1 | } |
1180 | a526a31c | blueswir1 | |
1181 | a526a31c | blueswir1 | /* SPARCstation 4 hardware initialisation */
|
1182 | fbe1b595 | Paul Brook | static void ss4_init(ram_addr_t RAM_size, |
1183 | 3023f332 | aliguori | const char *boot_device, |
1184 | a526a31c | blueswir1 | const char *kernel_filename, const char *kernel_cmdline, |
1185 | a526a31c | blueswir1 | const char *initrd_filename, const char *cpu_model) |
1186 | a526a31c | blueswir1 | { |
1187 | 3023f332 | aliguori | sun4m_hw_init(&sun4m_hwdefs[6], RAM_size, boot_device, kernel_filename,
|
1188 | a526a31c | blueswir1 | kernel_cmdline, initrd_filename, cpu_model); |
1189 | a526a31c | blueswir1 | } |
1190 | a526a31c | blueswir1 | |
1191 | a526a31c | blueswir1 | /* SPARCClassic hardware initialisation */
|
1192 | fbe1b595 | Paul Brook | static void scls_init(ram_addr_t RAM_size, |
1193 | 3023f332 | aliguori | const char *boot_device, |
1194 | a526a31c | blueswir1 | const char *kernel_filename, const char *kernel_cmdline, |
1195 | a526a31c | blueswir1 | const char *initrd_filename, const char *cpu_model) |
1196 | a526a31c | blueswir1 | { |
1197 | 3023f332 | aliguori | sun4m_hw_init(&sun4m_hwdefs[7], RAM_size, boot_device, kernel_filename,
|
1198 | a526a31c | blueswir1 | kernel_cmdline, initrd_filename, cpu_model); |
1199 | a526a31c | blueswir1 | } |
1200 | a526a31c | blueswir1 | |
1201 | a526a31c | blueswir1 | /* SPARCbook hardware initialisation */
|
1202 | fbe1b595 | Paul Brook | static void sbook_init(ram_addr_t RAM_size, |
1203 | 3023f332 | aliguori | const char *boot_device, |
1204 | a526a31c | blueswir1 | const char *kernel_filename, const char *kernel_cmdline, |
1205 | a526a31c | blueswir1 | const char *initrd_filename, const char *cpu_model) |
1206 | a526a31c | blueswir1 | { |
1207 | 3023f332 | aliguori | sun4m_hw_init(&sun4m_hwdefs[8], RAM_size, boot_device, kernel_filename,
|
1208 | a526a31c | blueswir1 | kernel_cmdline, initrd_filename, cpu_model); |
1209 | a526a31c | blueswir1 | } |
1210 | a526a31c | blueswir1 | |
1211 | f80f9ec9 | Anthony Liguori | static QEMUMachine ss5_machine = {
|
1212 | 66de733b | blueswir1 | .name = "SS-5",
|
1213 | 66de733b | blueswir1 | .desc = "Sun4m platform, SPARCstation 5",
|
1214 | 66de733b | blueswir1 | .init = ss5_init, |
1215 | c9b1ae2c | blueswir1 | .use_scsi = 1,
|
1216 | 0c257437 | Anthony Liguori | .is_default = 1,
|
1217 | c0e564d5 | bellard | }; |
1218 | e0353fe2 | blueswir1 | |
1219 | f80f9ec9 | Anthony Liguori | static QEMUMachine ss10_machine = {
|
1220 | 66de733b | blueswir1 | .name = "SS-10",
|
1221 | 66de733b | blueswir1 | .desc = "Sun4m platform, SPARCstation 10",
|
1222 | 66de733b | blueswir1 | .init = ss10_init, |
1223 | c9b1ae2c | blueswir1 | .use_scsi = 1,
|
1224 | 1bcee014 | blueswir1 | .max_cpus = 4,
|
1225 | e0353fe2 | blueswir1 | }; |
1226 | 6a3b9cc9 | blueswir1 | |
1227 | f80f9ec9 | Anthony Liguori | static QEMUMachine ss600mp_machine = {
|
1228 | 66de733b | blueswir1 | .name = "SS-600MP",
|
1229 | 66de733b | blueswir1 | .desc = "Sun4m platform, SPARCserver 600MP",
|
1230 | 66de733b | blueswir1 | .init = ss600mp_init, |
1231 | c9b1ae2c | blueswir1 | .use_scsi = 1,
|
1232 | 1bcee014 | blueswir1 | .max_cpus = 4,
|
1233 | 6a3b9cc9 | blueswir1 | }; |
1234 | ae40972f | blueswir1 | |
1235 | f80f9ec9 | Anthony Liguori | static QEMUMachine ss20_machine = {
|
1236 | 66de733b | blueswir1 | .name = "SS-20",
|
1237 | 66de733b | blueswir1 | .desc = "Sun4m platform, SPARCstation 20",
|
1238 | 66de733b | blueswir1 | .init = ss20_init, |
1239 | c9b1ae2c | blueswir1 | .use_scsi = 1,
|
1240 | 1bcee014 | blueswir1 | .max_cpus = 4,
|
1241 | ae40972f | blueswir1 | }; |
1242 | ae40972f | blueswir1 | |
1243 | f80f9ec9 | Anthony Liguori | static QEMUMachine voyager_machine = {
|
1244 | 66de733b | blueswir1 | .name = "Voyager",
|
1245 | 66de733b | blueswir1 | .desc = "Sun4m platform, SPARCstation Voyager",
|
1246 | 66de733b | blueswir1 | .init = vger_init, |
1247 | c9b1ae2c | blueswir1 | .use_scsi = 1,
|
1248 | a526a31c | blueswir1 | }; |
1249 | a526a31c | blueswir1 | |
1250 | f80f9ec9 | Anthony Liguori | static QEMUMachine ss_lx_machine = {
|
1251 | 66de733b | blueswir1 | .name = "LX",
|
1252 | 66de733b | blueswir1 | .desc = "Sun4m platform, SPARCstation LX",
|
1253 | 66de733b | blueswir1 | .init = ss_lx_init, |
1254 | c9b1ae2c | blueswir1 | .use_scsi = 1,
|
1255 | a526a31c | blueswir1 | }; |
1256 | a526a31c | blueswir1 | |
1257 | f80f9ec9 | Anthony Liguori | static QEMUMachine ss4_machine = {
|
1258 | 66de733b | blueswir1 | .name = "SS-4",
|
1259 | 66de733b | blueswir1 | .desc = "Sun4m platform, SPARCstation 4",
|
1260 | 66de733b | blueswir1 | .init = ss4_init, |
1261 | c9b1ae2c | blueswir1 | .use_scsi = 1,
|
1262 | a526a31c | blueswir1 | }; |
1263 | a526a31c | blueswir1 | |
1264 | f80f9ec9 | Anthony Liguori | static QEMUMachine scls_machine = {
|
1265 | 66de733b | blueswir1 | .name = "SPARCClassic",
|
1266 | 66de733b | blueswir1 | .desc = "Sun4m platform, SPARCClassic",
|
1267 | 66de733b | blueswir1 | .init = scls_init, |
1268 | c9b1ae2c | blueswir1 | .use_scsi = 1,
|
1269 | a526a31c | blueswir1 | }; |
1270 | a526a31c | blueswir1 | |
1271 | f80f9ec9 | Anthony Liguori | static QEMUMachine sbook_machine = {
|
1272 | 66de733b | blueswir1 | .name = "SPARCbook",
|
1273 | 66de733b | blueswir1 | .desc = "Sun4m platform, SPARCbook",
|
1274 | 66de733b | blueswir1 | .init = sbook_init, |
1275 | c9b1ae2c | blueswir1 | .use_scsi = 1,
|
1276 | a526a31c | blueswir1 | }; |
1277 | a526a31c | blueswir1 | |
1278 | 7d85892b | blueswir1 | static const struct sun4d_hwdef sun4d_hwdefs[] = { |
1279 | 7d85892b | blueswir1 | /* SS-1000 */
|
1280 | 7d85892b | blueswir1 | { |
1281 | 7d85892b | blueswir1 | .iounit_bases = { |
1282 | 7d85892b | blueswir1 | 0xfe0200000ULL,
|
1283 | 7d85892b | blueswir1 | 0xfe1200000ULL,
|
1284 | 7d85892b | blueswir1 | 0xfe2200000ULL,
|
1285 | 7d85892b | blueswir1 | 0xfe3200000ULL,
|
1286 | 7d85892b | blueswir1 | -1,
|
1287 | 7d85892b | blueswir1 | }, |
1288 | 7d85892b | blueswir1 | .tcx_base = 0x820000000ULL,
|
1289 | 7d85892b | blueswir1 | .slavio_base = 0xf00000000ULL,
|
1290 | 7d85892b | blueswir1 | .ms_kb_base = 0xf00240000ULL,
|
1291 | 7d85892b | blueswir1 | .serial_base = 0xf00200000ULL,
|
1292 | 7d85892b | blueswir1 | .nvram_base = 0xf00280000ULL,
|
1293 | 7d85892b | blueswir1 | .counter_base = 0xf00300000ULL,
|
1294 | 7d85892b | blueswir1 | .espdma_base = 0x800081000ULL,
|
1295 | 7d85892b | blueswir1 | .esp_base = 0x800080000ULL,
|
1296 | 7d85892b | blueswir1 | .ledma_base = 0x800040000ULL,
|
1297 | 7d85892b | blueswir1 | .le_base = 0x800060000ULL,
|
1298 | 7d85892b | blueswir1 | .sbi_base = 0xf02800000ULL,
|
1299 | 905fdcb5 | blueswir1 | .nvram_machine_id = 0x80,
|
1300 | 905fdcb5 | blueswir1 | .machine_id = ss1000_id, |
1301 | 7d85892b | blueswir1 | .iounit_version = 0x03000000,
|
1302 | 6ef05b95 | blueswir1 | .max_mem = 0xf00000000ULL,
|
1303 | 7d85892b | blueswir1 | .default_cpu_model = "TI SuperSparc II",
|
1304 | 7d85892b | blueswir1 | }, |
1305 | 7d85892b | blueswir1 | /* SS-2000 */
|
1306 | 7d85892b | blueswir1 | { |
1307 | 7d85892b | blueswir1 | .iounit_bases = { |
1308 | 7d85892b | blueswir1 | 0xfe0200000ULL,
|
1309 | 7d85892b | blueswir1 | 0xfe1200000ULL,
|
1310 | 7d85892b | blueswir1 | 0xfe2200000ULL,
|
1311 | 7d85892b | blueswir1 | 0xfe3200000ULL,
|
1312 | 7d85892b | blueswir1 | 0xfe4200000ULL,
|
1313 | 7d85892b | blueswir1 | }, |
1314 | 7d85892b | blueswir1 | .tcx_base = 0x820000000ULL,
|
1315 | 7d85892b | blueswir1 | .slavio_base = 0xf00000000ULL,
|
1316 | 7d85892b | blueswir1 | .ms_kb_base = 0xf00240000ULL,
|
1317 | 7d85892b | blueswir1 | .serial_base = 0xf00200000ULL,
|
1318 | 7d85892b | blueswir1 | .nvram_base = 0xf00280000ULL,
|
1319 | 7d85892b | blueswir1 | .counter_base = 0xf00300000ULL,
|
1320 | 7d85892b | blueswir1 | .espdma_base = 0x800081000ULL,
|
1321 | 7d85892b | blueswir1 | .esp_base = 0x800080000ULL,
|
1322 | 7d85892b | blueswir1 | .ledma_base = 0x800040000ULL,
|
1323 | 7d85892b | blueswir1 | .le_base = 0x800060000ULL,
|
1324 | 7d85892b | blueswir1 | .sbi_base = 0xf02800000ULL,
|
1325 | 905fdcb5 | blueswir1 | .nvram_machine_id = 0x80,
|
1326 | 905fdcb5 | blueswir1 | .machine_id = ss2000_id, |
1327 | 7d85892b | blueswir1 | .iounit_version = 0x03000000,
|
1328 | 6ef05b95 | blueswir1 | .max_mem = 0xf00000000ULL,
|
1329 | 7d85892b | blueswir1 | .default_cpu_model = "TI SuperSparc II",
|
1330 | 7d85892b | blueswir1 | }, |
1331 | 7d85892b | blueswir1 | }; |
1332 | 7d85892b | blueswir1 | |
1333 | 4b48bf05 | Blue Swirl | static DeviceState *sbi_init(target_phys_addr_t addr, qemu_irq **parent_irq)
|
1334 | 4b48bf05 | Blue Swirl | { |
1335 | 4b48bf05 | Blue Swirl | DeviceState *dev; |
1336 | 4b48bf05 | Blue Swirl | SysBusDevice *s; |
1337 | 4b48bf05 | Blue Swirl | unsigned int i; |
1338 | 4b48bf05 | Blue Swirl | |
1339 | 4b48bf05 | Blue Swirl | dev = qdev_create(NULL, "sbi"); |
1340 | 4b48bf05 | Blue Swirl | qdev_init(dev); |
1341 | 4b48bf05 | Blue Swirl | |
1342 | 4b48bf05 | Blue Swirl | s = sysbus_from_qdev(dev); |
1343 | 4b48bf05 | Blue Swirl | |
1344 | 4b48bf05 | Blue Swirl | for (i = 0; i < MAX_CPUS; i++) { |
1345 | 4b48bf05 | Blue Swirl | sysbus_connect_irq(s, i, *parent_irq[i]); |
1346 | 4b48bf05 | Blue Swirl | } |
1347 | 4b48bf05 | Blue Swirl | |
1348 | 4b48bf05 | Blue Swirl | sysbus_mmio_map(s, 0, addr);
|
1349 | 4b48bf05 | Blue Swirl | |
1350 | 4b48bf05 | Blue Swirl | return dev;
|
1351 | 4b48bf05 | Blue Swirl | } |
1352 | 4b48bf05 | Blue Swirl | |
1353 | 6ef05b95 | blueswir1 | static void sun4d_hw_init(const struct sun4d_hwdef *hwdef, ram_addr_t RAM_size, |
1354 | 7d85892b | blueswir1 | const char *boot_device, |
1355 | 3023f332 | aliguori | const char *kernel_filename, |
1356 | 7d85892b | blueswir1 | const char *kernel_cmdline, |
1357 | 7d85892b | blueswir1 | const char *initrd_filename, const char *cpu_model) |
1358 | 7d85892b | blueswir1 | { |
1359 | 666713c0 | Blue Swirl | CPUState *envs[MAX_CPUS]; |
1360 | 7d85892b | blueswir1 | unsigned int i; |
1361 | 7fc06735 | Blue Swirl | void *iounits[MAX_IOUNITS], *espdma, *ledma, *nvram;
|
1362 | 7fc06735 | Blue Swirl | qemu_irq *cpu_irqs[MAX_CPUS], sbi_irq[32], sbi_cpu_irq[MAX_CPUS],
|
1363 | 6f6260c7 | Blue Swirl | espdma_irq, ledma_irq; |
1364 | 74ff8d90 | Blue Swirl | qemu_irq esp_reset; |
1365 | 5c6602c5 | blueswir1 | unsigned long kernel_size; |
1366 | 3cce6243 | blueswir1 | void *fw_cfg;
|
1367 | 7fc06735 | Blue Swirl | DeviceState *dev; |
1368 | 7d85892b | blueswir1 | |
1369 | 7d85892b | blueswir1 | /* init CPUs */
|
1370 | 7d85892b | blueswir1 | if (!cpu_model)
|
1371 | 7d85892b | blueswir1 | cpu_model = hwdef->default_cpu_model; |
1372 | 7d85892b | blueswir1 | |
1373 | 666713c0 | Blue Swirl | for(i = 0; i < smp_cpus; i++) { |
1374 | 666713c0 | Blue Swirl | envs[i] = cpu_devinit(cpu_model, i, hwdef->slavio_base, &cpu_irqs[i]); |
1375 | 7d85892b | blueswir1 | } |
1376 | 7d85892b | blueswir1 | |
1377 | 7d85892b | blueswir1 | for (i = smp_cpus; i < MAX_CPUS; i++)
|
1378 | 7d85892b | blueswir1 | cpu_irqs[i] = qemu_allocate_irqs(dummy_cpu_set_irq, NULL, MAX_PILS);
|
1379 | 7d85892b | blueswir1 | |
1380 | 7d85892b | blueswir1 | /* set up devices */
|
1381 | a350db85 | Blue Swirl | ram_init(0, RAM_size, hwdef->max_mem);
|
1382 | a350db85 | Blue Swirl | |
1383 | f48f6569 | Blue Swirl | prom_init(hwdef->slavio_base, bios_name); |
1384 | f48f6569 | Blue Swirl | |
1385 | 7fc06735 | Blue Swirl | dev = sbi_init(hwdef->sbi_base, cpu_irqs); |
1386 | 7fc06735 | Blue Swirl | |
1387 | 7fc06735 | Blue Swirl | for (i = 0; i < 32; i++) { |
1388 | 7fc06735 | Blue Swirl | sbi_irq[i] = qdev_get_gpio_in(dev, i); |
1389 | 7fc06735 | Blue Swirl | } |
1390 | 7fc06735 | Blue Swirl | for (i = 0; i < MAX_CPUS; i++) { |
1391 | 7fc06735 | Blue Swirl | sbi_cpu_irq[i] = qdev_get_gpio_in(dev, 32 + i);
|
1392 | 7fc06735 | Blue Swirl | } |
1393 | 7d85892b | blueswir1 | |
1394 | 7d85892b | blueswir1 | for (i = 0; i < MAX_IOUNITS; i++) |
1395 | 7d85892b | blueswir1 | if (hwdef->iounit_bases[i] != (target_phys_addr_t)-1) |
1396 | ff403da6 | blueswir1 | iounits[i] = iommu_init(hwdef->iounit_bases[i], |
1397 | ff403da6 | blueswir1 | hwdef->iounit_version, |
1398 | c533e0b3 | Blue Swirl | sbi_irq[0]);
|
1399 | 7d85892b | blueswir1 | |
1400 | c533e0b3 | Blue Swirl | espdma = sparc32_dma_init(hwdef->espdma_base, sbi_irq[3],
|
1401 | 74ff8d90 | Blue Swirl | iounits[0], &espdma_irq);
|
1402 | 7d85892b | blueswir1 | |
1403 | c533e0b3 | Blue Swirl | ledma = sparc32_dma_init(hwdef->ledma_base, sbi_irq[4],
|
1404 | 74ff8d90 | Blue Swirl | iounits[0], &ledma_irq);
|
1405 | 7d85892b | blueswir1 | |
1406 | 7d85892b | blueswir1 | if (graphic_depth != 8 && graphic_depth != 24) { |
1407 | 7d85892b | blueswir1 | fprintf(stderr, "qemu: Unsupported depth: %d\n", graphic_depth);
|
1408 | 7d85892b | blueswir1 | exit (1);
|
1409 | 7d85892b | blueswir1 | } |
1410 | d95d8f1c | Blue Swirl | tcx_init(hwdef->tcx_base, 0x00100000, graphic_width, graphic_height,
|
1411 | dc828ca1 | pbrook | graphic_depth); |
1412 | 7d85892b | blueswir1 | |
1413 | 74ff8d90 | Blue Swirl | lance_init(&nd_table[0], hwdef->le_base, ledma, ledma_irq);
|
1414 | 7d85892b | blueswir1 | |
1415 | d95d8f1c | Blue Swirl | nvram = m48t59_init(sbi_irq[0], hwdef->nvram_base, 0, 0x2000, 8); |
1416 | 7d85892b | blueswir1 | |
1417 | c533e0b3 | Blue Swirl | slavio_timer_init_all(hwdef->counter_base, sbi_irq[10], sbi_cpu_irq, smp_cpus);
|
1418 | 7d85892b | blueswir1 | |
1419 | c533e0b3 | Blue Swirl | slavio_serial_ms_kbd_init(hwdef->ms_kb_base, sbi_irq[12],
|
1420 | 993fbfdb | Anthony Liguori | display_type == DT_NOGRAPHIC, ESCC_CLOCK, 1);
|
1421 | 7d85892b | blueswir1 | // Slavio TTYA (base+4, Linux ttyS0) is the first Qemu serial device
|
1422 | 7d85892b | blueswir1 | // Slavio TTYB (base+0, Linux ttyS1) is the second Qemu serial device
|
1423 | c533e0b3 | Blue Swirl | escc_init(hwdef->serial_base, sbi_irq[12], sbi_irq[12], |
1424 | aeeb69c7 | aurel32 | serial_hds[0], serial_hds[1], ESCC_CLOCK, 1); |
1425 | 7d85892b | blueswir1 | |
1426 | 7d85892b | blueswir1 | if (drive_get_max_bus(IF_SCSI) > 0) { |
1427 | 7d85892b | blueswir1 | fprintf(stderr, "qemu: too many SCSI bus\n");
|
1428 | 7d85892b | blueswir1 | exit(1);
|
1429 | 7d85892b | blueswir1 | } |
1430 | 7d85892b | blueswir1 | |
1431 | 74ff8d90 | Blue Swirl | esp_reset = qdev_get_gpio_in(espdma, 0);
|
1432 | cfb9de9c | Paul Brook | esp_init(hwdef->esp_base, 2,
|
1433 | cfb9de9c | Paul Brook | espdma_memory_read, espdma_memory_write, |
1434 | 74ff8d90 | Blue Swirl | espdma, espdma_irq, &esp_reset); |
1435 | 7d85892b | blueswir1 | |
1436 | 293f78bc | blueswir1 | kernel_size = sun4m_load_kernel(kernel_filename, initrd_filename, |
1437 | 293f78bc | blueswir1 | RAM_size); |
1438 | 7d85892b | blueswir1 | |
1439 | 7d85892b | blueswir1 | nvram_init(nvram, (uint8_t *)&nd_table[0].macaddr, kernel_cmdline,
|
1440 | 7d85892b | blueswir1 | boot_device, RAM_size, kernel_size, graphic_width, |
1441 | 905fdcb5 | blueswir1 | graphic_height, graphic_depth, hwdef->nvram_machine_id, |
1442 | 905fdcb5 | blueswir1 | "Sun4d");
|
1443 | 3cce6243 | blueswir1 | |
1444 | 3cce6243 | blueswir1 | fw_cfg = fw_cfg_init(0, 0, CFG_ADDR, CFG_ADDR + 2); |
1445 | 3cce6243 | blueswir1 | fw_cfg_add_i32(fw_cfg, FW_CFG_ID, 1);
|
1446 | 905fdcb5 | blueswir1 | fw_cfg_add_i64(fw_cfg, FW_CFG_RAM_SIZE, (uint64_t)ram_size); |
1447 | 905fdcb5 | blueswir1 | fw_cfg_add_i16(fw_cfg, FW_CFG_MACHINE_ID, hwdef->machine_id); |
1448 | 513f789f | blueswir1 | fw_cfg_add_i16(fw_cfg, FW_CFG_SUN4M_DEPTH, graphic_depth); |
1449 | 513f789f | blueswir1 | fw_cfg_add_i32(fw_cfg, FW_CFG_KERNEL_ADDR, KERNEL_LOAD_ADDR); |
1450 | 513f789f | blueswir1 | fw_cfg_add_i32(fw_cfg, FW_CFG_KERNEL_SIZE, kernel_size); |
1451 | 513f789f | blueswir1 | if (kernel_cmdline) {
|
1452 | 513f789f | blueswir1 | fw_cfg_add_i32(fw_cfg, FW_CFG_KERNEL_CMDLINE, CMDLINE_ADDR); |
1453 | 513f789f | blueswir1 | pstrcpy_targphys(CMDLINE_ADDR, TARGET_PAGE_SIZE, kernel_cmdline); |
1454 | 513f789f | blueswir1 | } else {
|
1455 | 513f789f | blueswir1 | fw_cfg_add_i32(fw_cfg, FW_CFG_KERNEL_CMDLINE, 0);
|
1456 | 513f789f | blueswir1 | } |
1457 | 513f789f | blueswir1 | fw_cfg_add_i32(fw_cfg, FW_CFG_INITRD_ADDR, INITRD_LOAD_ADDR); |
1458 | 513f789f | blueswir1 | fw_cfg_add_i32(fw_cfg, FW_CFG_INITRD_SIZE, 0); // not used |
1459 | 513f789f | blueswir1 | fw_cfg_add_i16(fw_cfg, FW_CFG_BOOT_DEVICE, boot_device[0]);
|
1460 | 513f789f | blueswir1 | qemu_register_boot_set(fw_cfg_boot_set, fw_cfg); |
1461 | 7d85892b | blueswir1 | } |
1462 | 7d85892b | blueswir1 | |
1463 | 7d85892b | blueswir1 | /* SPARCserver 1000 hardware initialisation */
|
1464 | fbe1b595 | Paul Brook | static void ss1000_init(ram_addr_t RAM_size, |
1465 | 3023f332 | aliguori | const char *boot_device, |
1466 | 7d85892b | blueswir1 | const char *kernel_filename, const char *kernel_cmdline, |
1467 | 7d85892b | blueswir1 | const char *initrd_filename, const char *cpu_model) |
1468 | 7d85892b | blueswir1 | { |
1469 | 3023f332 | aliguori | sun4d_hw_init(&sun4d_hwdefs[0], RAM_size, boot_device, kernel_filename,
|
1470 | 7d85892b | blueswir1 | kernel_cmdline, initrd_filename, cpu_model); |
1471 | 7d85892b | blueswir1 | } |
1472 | 7d85892b | blueswir1 | |
1473 | 7d85892b | blueswir1 | /* SPARCcenter 2000 hardware initialisation */
|
1474 | fbe1b595 | Paul Brook | static void ss2000_init(ram_addr_t RAM_size, |
1475 | 3023f332 | aliguori | const char *boot_device, |
1476 | 7d85892b | blueswir1 | const char *kernel_filename, const char *kernel_cmdline, |
1477 | 7d85892b | blueswir1 | const char *initrd_filename, const char *cpu_model) |
1478 | 7d85892b | blueswir1 | { |
1479 | 3023f332 | aliguori | sun4d_hw_init(&sun4d_hwdefs[1], RAM_size, boot_device, kernel_filename,
|
1480 | 7d85892b | blueswir1 | kernel_cmdline, initrd_filename, cpu_model); |
1481 | 7d85892b | blueswir1 | } |
1482 | 7d85892b | blueswir1 | |
1483 | f80f9ec9 | Anthony Liguori | static QEMUMachine ss1000_machine = {
|
1484 | 66de733b | blueswir1 | .name = "SS-1000",
|
1485 | 66de733b | blueswir1 | .desc = "Sun4d platform, SPARCserver 1000",
|
1486 | 66de733b | blueswir1 | .init = ss1000_init, |
1487 | c9b1ae2c | blueswir1 | .use_scsi = 1,
|
1488 | 1bcee014 | blueswir1 | .max_cpus = 8,
|
1489 | 7d85892b | blueswir1 | }; |
1490 | 7d85892b | blueswir1 | |
1491 | f80f9ec9 | Anthony Liguori | static QEMUMachine ss2000_machine = {
|
1492 | 66de733b | blueswir1 | .name = "SS-2000",
|
1493 | 66de733b | blueswir1 | .desc = "Sun4d platform, SPARCcenter 2000",
|
1494 | 66de733b | blueswir1 | .init = ss2000_init, |
1495 | c9b1ae2c | blueswir1 | .use_scsi = 1,
|
1496 | 1bcee014 | blueswir1 | .max_cpus = 20,
|
1497 | 7d85892b | blueswir1 | }; |
1498 | 8137cde8 | blueswir1 | |
1499 | 8137cde8 | blueswir1 | static const struct sun4c_hwdef sun4c_hwdefs[] = { |
1500 | 8137cde8 | blueswir1 | /* SS-2 */
|
1501 | 8137cde8 | blueswir1 | { |
1502 | 8137cde8 | blueswir1 | .iommu_base = 0xf8000000,
|
1503 | 8137cde8 | blueswir1 | .tcx_base = 0xfe000000,
|
1504 | 8137cde8 | blueswir1 | .slavio_base = 0xf6000000,
|
1505 | 8137cde8 | blueswir1 | .intctl_base = 0xf5000000,
|
1506 | 8137cde8 | blueswir1 | .counter_base = 0xf3000000,
|
1507 | 8137cde8 | blueswir1 | .ms_kb_base = 0xf0000000,
|
1508 | 8137cde8 | blueswir1 | .serial_base = 0xf1000000,
|
1509 | 8137cde8 | blueswir1 | .nvram_base = 0xf2000000,
|
1510 | 8137cde8 | blueswir1 | .fd_base = 0xf7200000,
|
1511 | 8137cde8 | blueswir1 | .dma_base = 0xf8400000,
|
1512 | 8137cde8 | blueswir1 | .esp_base = 0xf8800000,
|
1513 | 8137cde8 | blueswir1 | .le_base = 0xf8c00000,
|
1514 | 8137cde8 | blueswir1 | .aux1_base = 0xf7400003,
|
1515 | 8137cde8 | blueswir1 | .nvram_machine_id = 0x55,
|
1516 | 8137cde8 | blueswir1 | .machine_id = ss2_id, |
1517 | 8137cde8 | blueswir1 | .max_mem = 0x10000000,
|
1518 | 8137cde8 | blueswir1 | .default_cpu_model = "Cypress CY7C601",
|
1519 | 8137cde8 | blueswir1 | }, |
1520 | 8137cde8 | blueswir1 | }; |
1521 | 8137cde8 | blueswir1 | |
1522 | 4b48bf05 | Blue Swirl | static DeviceState *sun4c_intctl_init(target_phys_addr_t addr,
|
1523 | 4b48bf05 | Blue Swirl | qemu_irq *parent_irq) |
1524 | 4b48bf05 | Blue Swirl | { |
1525 | 4b48bf05 | Blue Swirl | DeviceState *dev; |
1526 | 4b48bf05 | Blue Swirl | SysBusDevice *s; |
1527 | 4b48bf05 | Blue Swirl | unsigned int i; |
1528 | 4b48bf05 | Blue Swirl | |
1529 | 4b48bf05 | Blue Swirl | dev = qdev_create(NULL, "sun4c_intctl"); |
1530 | 4b48bf05 | Blue Swirl | qdev_init(dev); |
1531 | 4b48bf05 | Blue Swirl | |
1532 | 4b48bf05 | Blue Swirl | s = sysbus_from_qdev(dev); |
1533 | 4b48bf05 | Blue Swirl | |
1534 | 4b48bf05 | Blue Swirl | for (i = 0; i < MAX_PILS; i++) { |
1535 | 4b48bf05 | Blue Swirl | sysbus_connect_irq(s, i, parent_irq[i]); |
1536 | 4b48bf05 | Blue Swirl | } |
1537 | 4b48bf05 | Blue Swirl | sysbus_mmio_map(s, 0, addr);
|
1538 | 4b48bf05 | Blue Swirl | |
1539 | 4b48bf05 | Blue Swirl | return dev;
|
1540 | 4b48bf05 | Blue Swirl | } |
1541 | 4b48bf05 | Blue Swirl | |
1542 | 8137cde8 | blueswir1 | static void sun4c_hw_init(const struct sun4c_hwdef *hwdef, ram_addr_t RAM_size, |
1543 | 8137cde8 | blueswir1 | const char *boot_device, |
1544 | 3023f332 | aliguori | const char *kernel_filename, |
1545 | 8137cde8 | blueswir1 | const char *kernel_cmdline, |
1546 | 8137cde8 | blueswir1 | const char *initrd_filename, const char *cpu_model) |
1547 | 8137cde8 | blueswir1 | { |
1548 | 8137cde8 | blueswir1 | CPUState *env; |
1549 | cfb9de9c | Paul Brook | void *iommu, *espdma, *ledma, *nvram;
|
1550 | e32cba29 | Blue Swirl | qemu_irq *cpu_irqs, slavio_irq[8], espdma_irq, ledma_irq;
|
1551 | 74ff8d90 | Blue Swirl | qemu_irq esp_reset; |
1552 | 2582cfa0 | Blue Swirl | qemu_irq fdc_tc; |
1553 | 5c6602c5 | blueswir1 | unsigned long kernel_size; |
1554 | 8137cde8 | blueswir1 | BlockDriverState *fd[MAX_FD]; |
1555 | 8137cde8 | blueswir1 | void *fw_cfg;
|
1556 | e32cba29 | Blue Swirl | DeviceState *dev; |
1557 | e32cba29 | Blue Swirl | unsigned int i; |
1558 | 751c6a17 | Gerd Hoffmann | DriveInfo *dinfo; |
1559 | 8137cde8 | blueswir1 | |
1560 | 8137cde8 | blueswir1 | /* init CPU */
|
1561 | 8137cde8 | blueswir1 | if (!cpu_model)
|
1562 | 8137cde8 | blueswir1 | cpu_model = hwdef->default_cpu_model; |
1563 | 8137cde8 | blueswir1 | |
1564 | 666713c0 | Blue Swirl | env = cpu_devinit(cpu_model, 0, hwdef->slavio_base, &cpu_irqs);
|
1565 | 8137cde8 | blueswir1 | |
1566 | 8137cde8 | blueswir1 | /* set up devices */
|
1567 | a350db85 | Blue Swirl | ram_init(0, RAM_size, hwdef->max_mem);
|
1568 | a350db85 | Blue Swirl | |
1569 | f48f6569 | Blue Swirl | prom_init(hwdef->slavio_base, bios_name); |
1570 | f48f6569 | Blue Swirl | |
1571 | e32cba29 | Blue Swirl | dev = sun4c_intctl_init(hwdef->intctl_base, cpu_irqs); |
1572 | e32cba29 | Blue Swirl | |
1573 | e32cba29 | Blue Swirl | for (i = 0; i < 8; i++) { |
1574 | e32cba29 | Blue Swirl | slavio_irq[i] = qdev_get_gpio_in(dev, i); |
1575 | e32cba29 | Blue Swirl | } |
1576 | 8137cde8 | blueswir1 | |
1577 | 8137cde8 | blueswir1 | iommu = iommu_init(hwdef->iommu_base, hwdef->iommu_version, |
1578 | c533e0b3 | Blue Swirl | slavio_irq[1]);
|
1579 | 8137cde8 | blueswir1 | |
1580 | c533e0b3 | Blue Swirl | espdma = sparc32_dma_init(hwdef->dma_base, slavio_irq[2],
|
1581 | 74ff8d90 | Blue Swirl | iommu, &espdma_irq); |
1582 | 8137cde8 | blueswir1 | |
1583 | 8137cde8 | blueswir1 | ledma = sparc32_dma_init(hwdef->dma_base + 16ULL,
|
1584 | 74ff8d90 | Blue Swirl | slavio_irq[3], iommu, &ledma_irq);
|
1585 | 8137cde8 | blueswir1 | |
1586 | 8137cde8 | blueswir1 | if (graphic_depth != 8 && graphic_depth != 24) { |
1587 | 8137cde8 | blueswir1 | fprintf(stderr, "qemu: Unsupported depth: %d\n", graphic_depth);
|
1588 | 8137cde8 | blueswir1 | exit (1);
|
1589 | 8137cde8 | blueswir1 | } |
1590 | d95d8f1c | Blue Swirl | tcx_init(hwdef->tcx_base, 0x00100000, graphic_width, graphic_height,
|
1591 | dc828ca1 | pbrook | graphic_depth); |
1592 | 8137cde8 | blueswir1 | |
1593 | 74ff8d90 | Blue Swirl | lance_init(&nd_table[0], hwdef->le_base, ledma, ledma_irq);
|
1594 | 8137cde8 | blueswir1 | |
1595 | d95d8f1c | Blue Swirl | nvram = m48t59_init(slavio_irq[0], hwdef->nvram_base, 0, 0x800, 2); |
1596 | 8137cde8 | blueswir1 | |
1597 | c533e0b3 | Blue Swirl | slavio_serial_ms_kbd_init(hwdef->ms_kb_base, slavio_irq[1],
|
1598 | 993fbfdb | Anthony Liguori | display_type == DT_NOGRAPHIC, ESCC_CLOCK, 1);
|
1599 | 8137cde8 | blueswir1 | // Slavio TTYA (base+4, Linux ttyS0) is the first Qemu serial device
|
1600 | 8137cde8 | blueswir1 | // Slavio TTYB (base+0, Linux ttyS1) is the second Qemu serial device
|
1601 | c533e0b3 | Blue Swirl | escc_init(hwdef->serial_base, slavio_irq[1],
|
1602 | c533e0b3 | Blue Swirl | slavio_irq[1], serial_hds[0], serial_hds[1], |
1603 | aeeb69c7 | aurel32 | ESCC_CLOCK, 1);
|
1604 | 8137cde8 | blueswir1 | |
1605 | b2b6f6ec | Blue Swirl | slavio_misc_init(0, hwdef->aux1_base, 0, slavio_irq[1], fdc_tc); |
1606 | 8137cde8 | blueswir1 | |
1607 | 8137cde8 | blueswir1 | if (hwdef->fd_base != (target_phys_addr_t)-1) { |
1608 | 8137cde8 | blueswir1 | /* there is zero or one floppy drive */
|
1609 | ce802585 | blueswir1 | memset(fd, 0, sizeof(fd)); |
1610 | 751c6a17 | Gerd Hoffmann | dinfo = drive_get(IF_FLOPPY, 0, 0); |
1611 | 751c6a17 | Gerd Hoffmann | if (dinfo)
|
1612 | 751c6a17 | Gerd Hoffmann | fd[0] = dinfo->bdrv;
|
1613 | 8137cde8 | blueswir1 | |
1614 | c533e0b3 | Blue Swirl | sun4m_fdctrl_init(slavio_irq[1], hwdef->fd_base, fd,
|
1615 | 2582cfa0 | Blue Swirl | &fdc_tc); |
1616 | 8137cde8 | blueswir1 | } |
1617 | 8137cde8 | blueswir1 | |
1618 | 8137cde8 | blueswir1 | if (drive_get_max_bus(IF_SCSI) > 0) { |
1619 | 8137cde8 | blueswir1 | fprintf(stderr, "qemu: too many SCSI bus\n");
|
1620 | 8137cde8 | blueswir1 | exit(1);
|
1621 | 8137cde8 | blueswir1 | } |
1622 | 8137cde8 | blueswir1 | |
1623 | 74ff8d90 | Blue Swirl | esp_reset = qdev_get_gpio_in(espdma, 0);
|
1624 | cfb9de9c | Paul Brook | esp_init(hwdef->esp_base, 2,
|
1625 | cfb9de9c | Paul Brook | espdma_memory_read, espdma_memory_write, |
1626 | 74ff8d90 | Blue Swirl | espdma, espdma_irq, &esp_reset); |
1627 | 8137cde8 | blueswir1 | |
1628 | 8137cde8 | blueswir1 | kernel_size = sun4m_load_kernel(kernel_filename, initrd_filename, |
1629 | 8137cde8 | blueswir1 | RAM_size); |
1630 | 8137cde8 | blueswir1 | |
1631 | 8137cde8 | blueswir1 | nvram_init(nvram, (uint8_t *)&nd_table[0].macaddr, kernel_cmdline,
|
1632 | 8137cde8 | blueswir1 | boot_device, RAM_size, kernel_size, graphic_width, |
1633 | 8137cde8 | blueswir1 | graphic_height, graphic_depth, hwdef->nvram_machine_id, |
1634 | 8137cde8 | blueswir1 | "Sun4c");
|
1635 | 8137cde8 | blueswir1 | |
1636 | 8137cde8 | blueswir1 | fw_cfg = fw_cfg_init(0, 0, CFG_ADDR, CFG_ADDR + 2); |
1637 | 8137cde8 | blueswir1 | fw_cfg_add_i32(fw_cfg, FW_CFG_ID, 1);
|
1638 | 8137cde8 | blueswir1 | fw_cfg_add_i64(fw_cfg, FW_CFG_RAM_SIZE, (uint64_t)ram_size); |
1639 | 8137cde8 | blueswir1 | fw_cfg_add_i16(fw_cfg, FW_CFG_MACHINE_ID, hwdef->machine_id); |
1640 | 513f789f | blueswir1 | fw_cfg_add_i16(fw_cfg, FW_CFG_SUN4M_DEPTH, graphic_depth); |
1641 | 513f789f | blueswir1 | fw_cfg_add_i32(fw_cfg, FW_CFG_KERNEL_ADDR, KERNEL_LOAD_ADDR); |
1642 | 513f789f | blueswir1 | fw_cfg_add_i32(fw_cfg, FW_CFG_KERNEL_SIZE, kernel_size); |
1643 | 513f789f | blueswir1 | if (kernel_cmdline) {
|
1644 | 513f789f | blueswir1 | fw_cfg_add_i32(fw_cfg, FW_CFG_KERNEL_CMDLINE, CMDLINE_ADDR); |
1645 | 513f789f | blueswir1 | pstrcpy_targphys(CMDLINE_ADDR, TARGET_PAGE_SIZE, kernel_cmdline); |
1646 | 513f789f | blueswir1 | } else {
|
1647 | 513f789f | blueswir1 | fw_cfg_add_i32(fw_cfg, FW_CFG_KERNEL_CMDLINE, 0);
|
1648 | 513f789f | blueswir1 | } |
1649 | 513f789f | blueswir1 | fw_cfg_add_i32(fw_cfg, FW_CFG_INITRD_ADDR, INITRD_LOAD_ADDR); |
1650 | 513f789f | blueswir1 | fw_cfg_add_i32(fw_cfg, FW_CFG_INITRD_SIZE, 0); // not used |
1651 | 513f789f | blueswir1 | fw_cfg_add_i16(fw_cfg, FW_CFG_BOOT_DEVICE, boot_device[0]);
|
1652 | 513f789f | blueswir1 | qemu_register_boot_set(fw_cfg_boot_set, fw_cfg); |
1653 | 8137cde8 | blueswir1 | } |
1654 | 8137cde8 | blueswir1 | |
1655 | 8137cde8 | blueswir1 | /* SPARCstation 2 hardware initialisation */
|
1656 | fbe1b595 | Paul Brook | static void ss2_init(ram_addr_t RAM_size, |
1657 | 3023f332 | aliguori | const char *boot_device, |
1658 | 8137cde8 | blueswir1 | const char *kernel_filename, const char *kernel_cmdline, |
1659 | 8137cde8 | blueswir1 | const char *initrd_filename, const char *cpu_model) |
1660 | 8137cde8 | blueswir1 | { |
1661 | 3023f332 | aliguori | sun4c_hw_init(&sun4c_hwdefs[0], RAM_size, boot_device, kernel_filename,
|
1662 | 8137cde8 | blueswir1 | kernel_cmdline, initrd_filename, cpu_model); |
1663 | 8137cde8 | blueswir1 | } |
1664 | 8137cde8 | blueswir1 | |
1665 | f80f9ec9 | Anthony Liguori | static QEMUMachine ss2_machine = {
|
1666 | 8137cde8 | blueswir1 | .name = "SS-2",
|
1667 | 8137cde8 | blueswir1 | .desc = "Sun4c platform, SPARCstation 2",
|
1668 | 8137cde8 | blueswir1 | .init = ss2_init, |
1669 | 8137cde8 | blueswir1 | .use_scsi = 1,
|
1670 | 8137cde8 | blueswir1 | }; |
1671 | f80f9ec9 | Anthony Liguori | |
1672 | f80f9ec9 | Anthony Liguori | static void ss2_machine_init(void) |
1673 | f80f9ec9 | Anthony Liguori | { |
1674 | f80f9ec9 | Anthony Liguori | qemu_register_machine(&ss5_machine); |
1675 | f80f9ec9 | Anthony Liguori | qemu_register_machine(&ss10_machine); |
1676 | f80f9ec9 | Anthony Liguori | qemu_register_machine(&ss600mp_machine); |
1677 | f80f9ec9 | Anthony Liguori | qemu_register_machine(&ss20_machine); |
1678 | f80f9ec9 | Anthony Liguori | qemu_register_machine(&voyager_machine); |
1679 | f80f9ec9 | Anthony Liguori | qemu_register_machine(&ss_lx_machine); |
1680 | f80f9ec9 | Anthony Liguori | qemu_register_machine(&ss4_machine); |
1681 | f80f9ec9 | Anthony Liguori | qemu_register_machine(&scls_machine); |
1682 | f80f9ec9 | Anthony Liguori | qemu_register_machine(&sbook_machine); |
1683 | f80f9ec9 | Anthony Liguori | qemu_register_machine(&ss1000_machine); |
1684 | f80f9ec9 | Anthony Liguori | qemu_register_machine(&ss2000_machine); |
1685 | f80f9ec9 | Anthony Liguori | qemu_register_machine(&ss2_machine); |
1686 | f80f9ec9 | Anthony Liguori | } |
1687 | f80f9ec9 | Anthony Liguori | |
1688 | f80f9ec9 | Anthony Liguori | machine_init(ss2_machine_init); |