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