root / hw / sun4m.c @ 4b816985
History | View | Annotate | Download (51.6 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 | 9d07d757 | Paul Brook | qdev_set_netdev(dev, nd); |
377 | 9d07d757 | Paul Brook | qdev_set_prop_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 | 9d07d757 | Paul Brook | *reset = qdev_get_irq_sink(dev, 0);
|
383 | 9d07d757 | Paul Brook | } |
384 | 9d07d757 | Paul Brook | |
385 | 8137cde8 | blueswir1 | static void sun4m_hw_init(const struct sun4m_hwdef *hwdef, ram_addr_t RAM_size, |
386 | 3ebf5aaf | blueswir1 | const char *boot_device, |
387 | 3023f332 | aliguori | const char *kernel_filename, |
388 | 3ebf5aaf | blueswir1 | const char *kernel_cmdline, |
389 | 3ebf5aaf | blueswir1 | const char *initrd_filename, const char *cpu_model) |
390 | 36cd9210 | blueswir1 | |
391 | 420557e8 | bellard | { |
392 | ba3c64fb | bellard | CPUState *env, *envs[MAX_CPUS]; |
393 | 713c45fa | bellard | unsigned int i; |
394 | cfb9de9c | Paul Brook | void *iommu, *espdma, *ledma, *nvram;
|
395 | b3a23197 | blueswir1 | qemu_irq *cpu_irqs[MAX_CPUS], *slavio_irq, *slavio_cpu_irq, |
396 | d7edfd27 | blueswir1 | *espdma_irq, *ledma_irq; |
397 | 2d069bab | blueswir1 | qemu_irq *esp_reset, *le_reset; |
398 | 2be17ebd | blueswir1 | qemu_irq *fdc_tc; |
399 | 6d0c293d | blueswir1 | qemu_irq *cpu_halt; |
400 | dc828ca1 | pbrook | ram_addr_t ram_offset, prom_offset, idreg_offset; |
401 | 5c6602c5 | blueswir1 | unsigned long kernel_size; |
402 | 3ebf5aaf | blueswir1 | int ret;
|
403 | 3ebf5aaf | blueswir1 | char buf[1024]; |
404 | e4bcb14c | ths | BlockDriverState *fd[MAX_FD]; |
405 | 22548760 | blueswir1 | int drive_index;
|
406 | 3cce6243 | blueswir1 | void *fw_cfg;
|
407 | 420557e8 | bellard | |
408 | ba3c64fb | bellard | /* init CPUs */
|
409 | 3ebf5aaf | blueswir1 | if (!cpu_model)
|
410 | 3ebf5aaf | blueswir1 | cpu_model = hwdef->default_cpu_model; |
411 | b3a23197 | blueswir1 | |
412 | ba3c64fb | bellard | for(i = 0; i < smp_cpus; i++) { |
413 | aaed909a | bellard | env = cpu_init(cpu_model); |
414 | aaed909a | bellard | if (!env) {
|
415 | 8e82c6a8 | blueswir1 | fprintf(stderr, "qemu: Unable to find Sparc CPU definition\n");
|
416 | aaed909a | bellard | exit(1);
|
417 | aaed909a | bellard | } |
418 | aaed909a | bellard | cpu_sparc_set_id(env, i); |
419 | ba3c64fb | bellard | envs[i] = env; |
420 | 3d29fbef | blueswir1 | if (i == 0) { |
421 | 3d29fbef | blueswir1 | qemu_register_reset(main_cpu_reset, env); |
422 | 3d29fbef | blueswir1 | } else {
|
423 | 3d29fbef | blueswir1 | qemu_register_reset(secondary_cpu_reset, env); |
424 | ba3c64fb | bellard | env->halted = 1;
|
425 | 3d29fbef | blueswir1 | } |
426 | b3a23197 | blueswir1 | cpu_irqs[i] = qemu_allocate_irqs(cpu_set_irq, envs[i], MAX_PILS); |
427 | 3ebf5aaf | blueswir1 | env->prom_addr = hwdef->slavio_base; |
428 | ba3c64fb | bellard | } |
429 | b3a23197 | blueswir1 | |
430 | b3a23197 | blueswir1 | for (i = smp_cpus; i < MAX_CPUS; i++)
|
431 | b3a23197 | blueswir1 | cpu_irqs[i] = qemu_allocate_irqs(dummy_cpu_set_irq, NULL, MAX_PILS);
|
432 | b3a23197 | blueswir1 | |
433 | 3ebf5aaf | blueswir1 | |
434 | 420557e8 | bellard | /* allocate RAM */
|
435 | 3ebf5aaf | blueswir1 | if ((uint64_t)RAM_size > hwdef->max_mem) {
|
436 | 77f193da | blueswir1 | fprintf(stderr, |
437 | 77f193da | blueswir1 | "qemu: Too much memory for this machine: %d, maximum %d\n",
|
438 | 6ef05b95 | blueswir1 | (unsigned int)(RAM_size / (1024 * 1024)), |
439 | 3ebf5aaf | blueswir1 | (unsigned int)(hwdef->max_mem / (1024 * 1024))); |
440 | 3ebf5aaf | blueswir1 | exit(1);
|
441 | 3ebf5aaf | blueswir1 | } |
442 | 5c6602c5 | blueswir1 | ram_offset = qemu_ram_alloc(RAM_size); |
443 | 5c6602c5 | blueswir1 | cpu_register_physical_memory(0, RAM_size, ram_offset);
|
444 | 420557e8 | bellard | |
445 | 3ebf5aaf | blueswir1 | /* load boot prom */
|
446 | 5c6602c5 | blueswir1 | prom_offset = qemu_ram_alloc(PROM_SIZE_MAX); |
447 | 3ebf5aaf | blueswir1 | cpu_register_physical_memory(hwdef->slavio_base, |
448 | 3ebf5aaf | blueswir1 | (PROM_SIZE_MAX + TARGET_PAGE_SIZE - 1) &
|
449 | 3ebf5aaf | blueswir1 | TARGET_PAGE_MASK, |
450 | 3ebf5aaf | blueswir1 | prom_offset | IO_MEM_ROM); |
451 | 3ebf5aaf | blueswir1 | |
452 | 3ebf5aaf | blueswir1 | if (bios_name == NULL) |
453 | 3ebf5aaf | blueswir1 | bios_name = PROM_FILENAME; |
454 | 3ebf5aaf | blueswir1 | snprintf(buf, sizeof(buf), "%s/%s", bios_dir, bios_name); |
455 | 3ebf5aaf | blueswir1 | ret = load_elf(buf, hwdef->slavio_base - PROM_VADDR, NULL, NULL, NULL); |
456 | 3ebf5aaf | blueswir1 | if (ret < 0 || ret > PROM_SIZE_MAX) |
457 | e01f4a1c | blueswir1 | ret = load_image_targphys(buf, hwdef->slavio_base, PROM_SIZE_MAX); |
458 | 3ebf5aaf | blueswir1 | if (ret < 0 || ret > PROM_SIZE_MAX) { |
459 | 3ebf5aaf | blueswir1 | fprintf(stderr, "qemu: could not load prom '%s'\n",
|
460 | 3ebf5aaf | blueswir1 | buf); |
461 | 3ebf5aaf | blueswir1 | exit(1);
|
462 | 3ebf5aaf | blueswir1 | } |
463 | 3ebf5aaf | blueswir1 | |
464 | 3ebf5aaf | blueswir1 | /* set up devices */
|
465 | 36cd9210 | blueswir1 | slavio_intctl = slavio_intctl_init(hwdef->intctl_base, |
466 | 5dcb6b91 | blueswir1 | hwdef->intctl_base + 0x10000ULL,
|
467 | d537cf6c | pbrook | &hwdef->intbit_to_level[0],
|
468 | d7edfd27 | blueswir1 | &slavio_irq, &slavio_cpu_irq, |
469 | b3a23197 | blueswir1 | cpu_irqs, |
470 | d7edfd27 | blueswir1 | hwdef->clock_irq); |
471 | b3a23197 | blueswir1 | |
472 | fe096129 | blueswir1 | if (hwdef->idreg_base) {
|
473 | 293f78bc | blueswir1 | static const uint8_t idreg_data[] = { 0xfe, 0x81, 0x01, 0x03 }; |
474 | 4c2485de | blueswir1 | |
475 | 5c6602c5 | blueswir1 | idreg_offset = qemu_ram_alloc(sizeof(idreg_data));
|
476 | 293f78bc | blueswir1 | cpu_register_physical_memory(hwdef->idreg_base, sizeof(idreg_data),
|
477 | 5c6602c5 | blueswir1 | idreg_offset | IO_MEM_ROM); |
478 | 293f78bc | blueswir1 | cpu_physical_memory_write_rom(hwdef->idreg_base, idreg_data, |
479 | 293f78bc | blueswir1 | sizeof(idreg_data));
|
480 | 4c2485de | blueswir1 | } |
481 | 4c2485de | blueswir1 | |
482 | ff403da6 | blueswir1 | iommu = iommu_init(hwdef->iommu_base, hwdef->iommu_version, |
483 | ff403da6 | blueswir1 | slavio_irq[hwdef->me_irq]); |
484 | ff403da6 | blueswir1 | |
485 | 5aca8c3b | blueswir1 | espdma = sparc32_dma_init(hwdef->dma_base, slavio_irq[hwdef->esp_irq], |
486 | 2d069bab | blueswir1 | iommu, &espdma_irq, &esp_reset); |
487 | 2d069bab | blueswir1 | |
488 | 5aca8c3b | blueswir1 | ledma = sparc32_dma_init(hwdef->dma_base + 16ULL,
|
489 | 2d069bab | blueswir1 | slavio_irq[hwdef->le_irq], iommu, &ledma_irq, |
490 | 2d069bab | blueswir1 | &le_reset); |
491 | ba3c64fb | bellard | |
492 | eee0b836 | blueswir1 | if (graphic_depth != 8 && graphic_depth != 24) { |
493 | eee0b836 | blueswir1 | fprintf(stderr, "qemu: Unsupported depth: %d\n", graphic_depth);
|
494 | eee0b836 | blueswir1 | exit (1);
|
495 | eee0b836 | blueswir1 | } |
496 | dc828ca1 | pbrook | tcx_init(hwdef->tcx_base, hwdef->vram_size, graphic_width, graphic_height, |
497 | dc828ca1 | pbrook | graphic_depth); |
498 | dbe06e18 | blueswir1 | |
499 | 0ae18cee | aliguori | lance_init(&nd_table[0], hwdef->le_base, ledma, *ledma_irq, le_reset);
|
500 | dbe06e18 | blueswir1 | |
501 | d537cf6c | pbrook | nvram = m48t59_init(slavio_irq[0], hwdef->nvram_base, 0, |
502 | d537cf6c | pbrook | hwdef->nvram_size, 8);
|
503 | 81732d19 | blueswir1 | |
504 | 81732d19 | blueswir1 | slavio_timer_init_all(hwdef->counter_base, slavio_irq[hwdef->clock1_irq], |
505 | 19f8e5dd | blueswir1 | slavio_cpu_irq, smp_cpus); |
506 | 81732d19 | blueswir1 | |
507 | 577390ff | blueswir1 | slavio_serial_ms_kbd_init(hwdef->ms_kb_base, slavio_irq[hwdef->ms_kb_irq], |
508 | b4ed08e0 | blueswir1 | nographic, ESCC_CLOCK, 1);
|
509 | b81b3b10 | bellard | // Slavio TTYA (base+4, Linux ttyS0) is the first Qemu serial device
|
510 | b81b3b10 | bellard | // Slavio TTYB (base+0, Linux ttyS1) is the second Qemu serial device
|
511 | aeeb69c7 | aurel32 | escc_init(hwdef->serial_base, slavio_irq[hwdef->ser_irq], slavio_irq[hwdef->ser_irq], |
512 | aeeb69c7 | aurel32 | serial_hds[0], serial_hds[1], ESCC_CLOCK, 1); |
513 | 741402f9 | blueswir1 | |
514 | 6d0c293d | blueswir1 | cpu_halt = qemu_allocate_irqs(cpu_halt_signal, NULL, 1); |
515 | 2be17ebd | blueswir1 | slavio_misc = slavio_misc_init(hwdef->slavio_base, hwdef->apc_base, |
516 | 2be17ebd | blueswir1 | hwdef->aux1_base, hwdef->aux2_base, |
517 | 6d0c293d | blueswir1 | slavio_irq[hwdef->me_irq], cpu_halt[0],
|
518 | 2be17ebd | blueswir1 | &fdc_tc); |
519 | 2be17ebd | blueswir1 | |
520 | fe096129 | blueswir1 | if (hwdef->fd_base) {
|
521 | e4bcb14c | ths | /* there is zero or one floppy drive */
|
522 | 309e60bd | blueswir1 | memset(fd, 0, sizeof(fd)); |
523 | 22548760 | blueswir1 | drive_index = drive_get_index(IF_FLOPPY, 0, 0); |
524 | 22548760 | blueswir1 | if (drive_index != -1) |
525 | 22548760 | blueswir1 | fd[0] = drives_table[drive_index].bdrv;
|
526 | 2d069bab | blueswir1 | |
527 | 2be17ebd | blueswir1 | sun4m_fdctrl_init(slavio_irq[hwdef->fd_irq], hwdef->fd_base, fd, |
528 | 2be17ebd | blueswir1 | fdc_tc); |
529 | e4bcb14c | ths | } |
530 | e4bcb14c | ths | |
531 | e4bcb14c | ths | if (drive_get_max_bus(IF_SCSI) > 0) { |
532 | e4bcb14c | ths | fprintf(stderr, "qemu: too many SCSI bus\n");
|
533 | e4bcb14c | ths | exit(1);
|
534 | e4bcb14c | ths | } |
535 | e4bcb14c | ths | |
536 | cfb9de9c | Paul Brook | esp_init(hwdef->esp_base, 2,
|
537 | cfb9de9c | Paul Brook | espdma_memory_read, espdma_memory_write, |
538 | cfb9de9c | Paul Brook | espdma, *espdma_irq, esp_reset); |
539 | f1587550 | ths | |
540 | fe096129 | blueswir1 | if (hwdef->cs_base)
|
541 | 803b3c7b | blueswir1 | cs_init(hwdef->cs_base, hwdef->cs_irq, slavio_intctl); |
542 | b3ceef24 | blueswir1 | |
543 | 293f78bc | blueswir1 | kernel_size = sun4m_load_kernel(kernel_filename, initrd_filename, |
544 | 293f78bc | blueswir1 | RAM_size); |
545 | 36cd9210 | blueswir1 | |
546 | 36cd9210 | blueswir1 | nvram_init(nvram, (uint8_t *)&nd_table[0].macaddr, kernel_cmdline,
|
547 | b3ceef24 | blueswir1 | boot_device, RAM_size, kernel_size, graphic_width, |
548 | 905fdcb5 | blueswir1 | graphic_height, graphic_depth, hwdef->nvram_machine_id, |
549 | 905fdcb5 | blueswir1 | "Sun4m");
|
550 | 7eb0c8e8 | blueswir1 | |
551 | fe096129 | blueswir1 | if (hwdef->ecc_base)
|
552 | e42c20b4 | blueswir1 | ecc_init(hwdef->ecc_base, slavio_irq[hwdef->ecc_irq], |
553 | e42c20b4 | blueswir1 | hwdef->ecc_version); |
554 | 3cce6243 | blueswir1 | |
555 | 3cce6243 | blueswir1 | fw_cfg = fw_cfg_init(0, 0, CFG_ADDR, CFG_ADDR + 2); |
556 | 3cce6243 | blueswir1 | fw_cfg_add_i32(fw_cfg, FW_CFG_ID, 1);
|
557 | 905fdcb5 | blueswir1 | fw_cfg_add_i64(fw_cfg, FW_CFG_RAM_SIZE, (uint64_t)ram_size); |
558 | 905fdcb5 | blueswir1 | fw_cfg_add_i16(fw_cfg, FW_CFG_MACHINE_ID, hwdef->machine_id); |
559 | fbfcf955 | blueswir1 | fw_cfg_add_i16(fw_cfg, FW_CFG_SUN4M_DEPTH, graphic_depth); |
560 | 513f789f | blueswir1 | fw_cfg_add_i32(fw_cfg, FW_CFG_KERNEL_ADDR, KERNEL_LOAD_ADDR); |
561 | 513f789f | blueswir1 | fw_cfg_add_i32(fw_cfg, FW_CFG_KERNEL_SIZE, kernel_size); |
562 | 513f789f | blueswir1 | if (kernel_cmdline) {
|
563 | 513f789f | blueswir1 | fw_cfg_add_i32(fw_cfg, FW_CFG_KERNEL_CMDLINE, CMDLINE_ADDR); |
564 | 513f789f | blueswir1 | pstrcpy_targphys(CMDLINE_ADDR, TARGET_PAGE_SIZE, kernel_cmdline); |
565 | 513f789f | blueswir1 | } else {
|
566 | 513f789f | blueswir1 | fw_cfg_add_i32(fw_cfg, FW_CFG_KERNEL_CMDLINE, 0);
|
567 | 513f789f | blueswir1 | } |
568 | 513f789f | blueswir1 | fw_cfg_add_i32(fw_cfg, FW_CFG_INITRD_ADDR, INITRD_LOAD_ADDR); |
569 | 513f789f | blueswir1 | fw_cfg_add_i32(fw_cfg, FW_CFG_INITRD_SIZE, 0); // not used |
570 | 513f789f | blueswir1 | fw_cfg_add_i16(fw_cfg, FW_CFG_BOOT_DEVICE, boot_device[0]);
|
571 | 513f789f | blueswir1 | qemu_register_boot_set(fw_cfg_boot_set, fw_cfg); |
572 | 36cd9210 | blueswir1 | } |
573 | 36cd9210 | blueswir1 | |
574 | 905fdcb5 | blueswir1 | enum {
|
575 | 905fdcb5 | blueswir1 | ss2_id = 0,
|
576 | 905fdcb5 | blueswir1 | ss5_id = 32,
|
577 | 905fdcb5 | blueswir1 | vger_id, |
578 | 905fdcb5 | blueswir1 | lx_id, |
579 | 905fdcb5 | blueswir1 | ss4_id, |
580 | 905fdcb5 | blueswir1 | scls_id, |
581 | 905fdcb5 | blueswir1 | sbook_id, |
582 | 905fdcb5 | blueswir1 | ss10_id = 64,
|
583 | 905fdcb5 | blueswir1 | ss20_id, |
584 | 905fdcb5 | blueswir1 | ss600mp_id, |
585 | 905fdcb5 | blueswir1 | ss1000_id = 96,
|
586 | 905fdcb5 | blueswir1 | ss2000_id, |
587 | 905fdcb5 | blueswir1 | }; |
588 | 905fdcb5 | blueswir1 | |
589 | 8137cde8 | blueswir1 | static const struct sun4m_hwdef sun4m_hwdefs[] = { |
590 | 36cd9210 | blueswir1 | /* SS-5 */
|
591 | 36cd9210 | blueswir1 | { |
592 | 36cd9210 | blueswir1 | .iommu_base = 0x10000000,
|
593 | 36cd9210 | blueswir1 | .tcx_base = 0x50000000,
|
594 | 36cd9210 | blueswir1 | .cs_base = 0x6c000000,
|
595 | 384ccb5d | blueswir1 | .slavio_base = 0x70000000,
|
596 | 36cd9210 | blueswir1 | .ms_kb_base = 0x71000000,
|
597 | 36cd9210 | blueswir1 | .serial_base = 0x71100000,
|
598 | 36cd9210 | blueswir1 | .nvram_base = 0x71200000,
|
599 | 36cd9210 | blueswir1 | .fd_base = 0x71400000,
|
600 | 36cd9210 | blueswir1 | .counter_base = 0x71d00000,
|
601 | 36cd9210 | blueswir1 | .intctl_base = 0x71e00000,
|
602 | 4c2485de | blueswir1 | .idreg_base = 0x78000000,
|
603 | 36cd9210 | blueswir1 | .dma_base = 0x78400000,
|
604 | 36cd9210 | blueswir1 | .esp_base = 0x78800000,
|
605 | 36cd9210 | blueswir1 | .le_base = 0x78c00000,
|
606 | 127fc407 | blueswir1 | .apc_base = 0x6a000000,
|
607 | 0019ad53 | blueswir1 | .aux1_base = 0x71900000,
|
608 | 0019ad53 | blueswir1 | .aux2_base = 0x71910000,
|
609 | 36cd9210 | blueswir1 | .vram_size = 0x00100000,
|
610 | 36cd9210 | blueswir1 | .nvram_size = 0x2000,
|
611 | 36cd9210 | blueswir1 | .esp_irq = 18,
|
612 | 36cd9210 | blueswir1 | .le_irq = 16,
|
613 | e3a79bca | blueswir1 | .clock_irq = 7,
|
614 | 36cd9210 | blueswir1 | .clock1_irq = 19,
|
615 | 36cd9210 | blueswir1 | .ms_kb_irq = 14,
|
616 | 36cd9210 | blueswir1 | .ser_irq = 15,
|
617 | 36cd9210 | blueswir1 | .fd_irq = 22,
|
618 | 36cd9210 | blueswir1 | .me_irq = 30,
|
619 | 36cd9210 | blueswir1 | .cs_irq = 5,
|
620 | 905fdcb5 | blueswir1 | .nvram_machine_id = 0x80,
|
621 | 905fdcb5 | blueswir1 | .machine_id = ss5_id, |
622 | cf3102ac | blueswir1 | .iommu_version = 0x05000000,
|
623 | e0353fe2 | blueswir1 | .intbit_to_level = { |
624 | f930d07e | blueswir1 | 2, 3, 5, 7, 9, 11, 0, 14, 3, 5, 7, 9, 11, 13, 12, 12, |
625 | f930d07e | blueswir1 | 6, 0, 4, 10, 8, 0, 11, 0, 0, 0, 0, 0, 15, 0, 15, 0, |
626 | e0353fe2 | blueswir1 | }, |
627 | 3ebf5aaf | blueswir1 | .max_mem = 0x10000000,
|
628 | 3ebf5aaf | blueswir1 | .default_cpu_model = "Fujitsu MB86904",
|
629 | e0353fe2 | blueswir1 | }, |
630 | e0353fe2 | blueswir1 | /* SS-10 */
|
631 | e0353fe2 | blueswir1 | { |
632 | 5dcb6b91 | blueswir1 | .iommu_base = 0xfe0000000ULL,
|
633 | 5dcb6b91 | blueswir1 | .tcx_base = 0xe20000000ULL,
|
634 | 5dcb6b91 | blueswir1 | .slavio_base = 0xff0000000ULL,
|
635 | 5dcb6b91 | blueswir1 | .ms_kb_base = 0xff1000000ULL,
|
636 | 5dcb6b91 | blueswir1 | .serial_base = 0xff1100000ULL,
|
637 | 5dcb6b91 | blueswir1 | .nvram_base = 0xff1200000ULL,
|
638 | 5dcb6b91 | blueswir1 | .fd_base = 0xff1700000ULL,
|
639 | 5dcb6b91 | blueswir1 | .counter_base = 0xff1300000ULL,
|
640 | 5dcb6b91 | blueswir1 | .intctl_base = 0xff1400000ULL,
|
641 | 4c2485de | blueswir1 | .idreg_base = 0xef0000000ULL,
|
642 | 5dcb6b91 | blueswir1 | .dma_base = 0xef0400000ULL,
|
643 | 5dcb6b91 | blueswir1 | .esp_base = 0xef0800000ULL,
|
644 | 5dcb6b91 | blueswir1 | .le_base = 0xef0c00000ULL,
|
645 | 0019ad53 | blueswir1 | .apc_base = 0xefa000000ULL, // XXX should not exist |
646 | 127fc407 | blueswir1 | .aux1_base = 0xff1800000ULL,
|
647 | 127fc407 | blueswir1 | .aux2_base = 0xff1a01000ULL,
|
648 | 7eb0c8e8 | blueswir1 | .ecc_base = 0xf00000000ULL,
|
649 | 7eb0c8e8 | blueswir1 | .ecc_version = 0x10000000, // version 0, implementation 1 |
650 | e0353fe2 | blueswir1 | .vram_size = 0x00100000,
|
651 | e0353fe2 | blueswir1 | .nvram_size = 0x2000,
|
652 | e0353fe2 | blueswir1 | .esp_irq = 18,
|
653 | e0353fe2 | blueswir1 | .le_irq = 16,
|
654 | e3a79bca | blueswir1 | .clock_irq = 7,
|
655 | e0353fe2 | blueswir1 | .clock1_irq = 19,
|
656 | e0353fe2 | blueswir1 | .ms_kb_irq = 14,
|
657 | e0353fe2 | blueswir1 | .ser_irq = 15,
|
658 | e0353fe2 | blueswir1 | .fd_irq = 22,
|
659 | e0353fe2 | blueswir1 | .me_irq = 30,
|
660 | e42c20b4 | blueswir1 | .ecc_irq = 28,
|
661 | 905fdcb5 | blueswir1 | .nvram_machine_id = 0x72,
|
662 | 905fdcb5 | blueswir1 | .machine_id = ss10_id, |
663 | 7fbfb139 | blueswir1 | .iommu_version = 0x03000000,
|
664 | e0353fe2 | blueswir1 | .intbit_to_level = { |
665 | f930d07e | blueswir1 | 2, 3, 5, 7, 9, 11, 0, 14, 3, 5, 7, 9, 11, 13, 12, 12, |
666 | f930d07e | blueswir1 | 6, 0, 4, 10, 8, 0, 11, 0, 0, 0, 0, 0, 15, 0, 15, 0, |
667 | e0353fe2 | blueswir1 | }, |
668 | 6ef05b95 | blueswir1 | .max_mem = 0xf00000000ULL,
|
669 | 3ebf5aaf | blueswir1 | .default_cpu_model = "TI SuperSparc II",
|
670 | 36cd9210 | blueswir1 | }, |
671 | 6a3b9cc9 | blueswir1 | /* SS-600MP */
|
672 | 6a3b9cc9 | blueswir1 | { |
673 | 6a3b9cc9 | blueswir1 | .iommu_base = 0xfe0000000ULL,
|
674 | 6a3b9cc9 | blueswir1 | .tcx_base = 0xe20000000ULL,
|
675 | 6a3b9cc9 | blueswir1 | .slavio_base = 0xff0000000ULL,
|
676 | 6a3b9cc9 | blueswir1 | .ms_kb_base = 0xff1000000ULL,
|
677 | 6a3b9cc9 | blueswir1 | .serial_base = 0xff1100000ULL,
|
678 | 6a3b9cc9 | blueswir1 | .nvram_base = 0xff1200000ULL,
|
679 | 6a3b9cc9 | blueswir1 | .counter_base = 0xff1300000ULL,
|
680 | 6a3b9cc9 | blueswir1 | .intctl_base = 0xff1400000ULL,
|
681 | 6a3b9cc9 | blueswir1 | .dma_base = 0xef0081000ULL,
|
682 | 6a3b9cc9 | blueswir1 | .esp_base = 0xef0080000ULL,
|
683 | 6a3b9cc9 | blueswir1 | .le_base = 0xef0060000ULL,
|
684 | 0019ad53 | blueswir1 | .apc_base = 0xefa000000ULL, // XXX should not exist |
685 | 127fc407 | blueswir1 | .aux1_base = 0xff1800000ULL,
|
686 | 127fc407 | blueswir1 | .aux2_base = 0xff1a01000ULL, // XXX should not exist |
687 | 7eb0c8e8 | blueswir1 | .ecc_base = 0xf00000000ULL,
|
688 | 7eb0c8e8 | blueswir1 | .ecc_version = 0x00000000, // version 0, implementation 0 |
689 | 6a3b9cc9 | blueswir1 | .vram_size = 0x00100000,
|
690 | 6a3b9cc9 | blueswir1 | .nvram_size = 0x2000,
|
691 | 6a3b9cc9 | blueswir1 | .esp_irq = 18,
|
692 | 6a3b9cc9 | blueswir1 | .le_irq = 16,
|
693 | e3a79bca | blueswir1 | .clock_irq = 7,
|
694 | 6a3b9cc9 | blueswir1 | .clock1_irq = 19,
|
695 | 6a3b9cc9 | blueswir1 | .ms_kb_irq = 14,
|
696 | 6a3b9cc9 | blueswir1 | .ser_irq = 15,
|
697 | 6a3b9cc9 | blueswir1 | .fd_irq = 22,
|
698 | 6a3b9cc9 | blueswir1 | .me_irq = 30,
|
699 | e42c20b4 | blueswir1 | .ecc_irq = 28,
|
700 | 905fdcb5 | blueswir1 | .nvram_machine_id = 0x71,
|
701 | 905fdcb5 | blueswir1 | .machine_id = ss600mp_id, |
702 | 7fbfb139 | blueswir1 | .iommu_version = 0x01000000,
|
703 | 6a3b9cc9 | blueswir1 | .intbit_to_level = { |
704 | 6a3b9cc9 | blueswir1 | 2, 3, 5, 7, 9, 11, 0, 14, 3, 5, 7, 9, 11, 13, 12, 12, |
705 | 6a3b9cc9 | blueswir1 | 6, 0, 4, 10, 8, 0, 11, 0, 0, 0, 0, 0, 15, 0, 15, 0, |
706 | 6a3b9cc9 | blueswir1 | }, |
707 | 6ef05b95 | blueswir1 | .max_mem = 0xf00000000ULL,
|
708 | 3ebf5aaf | blueswir1 | .default_cpu_model = "TI SuperSparc II",
|
709 | 6a3b9cc9 | blueswir1 | }, |
710 | ae40972f | blueswir1 | /* SS-20 */
|
711 | ae40972f | blueswir1 | { |
712 | ae40972f | blueswir1 | .iommu_base = 0xfe0000000ULL,
|
713 | ae40972f | blueswir1 | .tcx_base = 0xe20000000ULL,
|
714 | ae40972f | blueswir1 | .slavio_base = 0xff0000000ULL,
|
715 | ae40972f | blueswir1 | .ms_kb_base = 0xff1000000ULL,
|
716 | ae40972f | blueswir1 | .serial_base = 0xff1100000ULL,
|
717 | ae40972f | blueswir1 | .nvram_base = 0xff1200000ULL,
|
718 | ae40972f | blueswir1 | .fd_base = 0xff1700000ULL,
|
719 | ae40972f | blueswir1 | .counter_base = 0xff1300000ULL,
|
720 | ae40972f | blueswir1 | .intctl_base = 0xff1400000ULL,
|
721 | 4c2485de | blueswir1 | .idreg_base = 0xef0000000ULL,
|
722 | ae40972f | blueswir1 | .dma_base = 0xef0400000ULL,
|
723 | ae40972f | blueswir1 | .esp_base = 0xef0800000ULL,
|
724 | ae40972f | blueswir1 | .le_base = 0xef0c00000ULL,
|
725 | 0019ad53 | blueswir1 | .apc_base = 0xefa000000ULL, // XXX should not exist |
726 | 577d8dd4 | blueswir1 | .aux1_base = 0xff1800000ULL,
|
727 | 577d8dd4 | blueswir1 | .aux2_base = 0xff1a01000ULL,
|
728 | ae40972f | blueswir1 | .ecc_base = 0xf00000000ULL,
|
729 | ae40972f | blueswir1 | .ecc_version = 0x20000000, // version 0, implementation 2 |
730 | ae40972f | blueswir1 | .vram_size = 0x00100000,
|
731 | ae40972f | blueswir1 | .nvram_size = 0x2000,
|
732 | ae40972f | blueswir1 | .esp_irq = 18,
|
733 | ae40972f | blueswir1 | .le_irq = 16,
|
734 | e3a79bca | blueswir1 | .clock_irq = 7,
|
735 | ae40972f | blueswir1 | .clock1_irq = 19,
|
736 | ae40972f | blueswir1 | .ms_kb_irq = 14,
|
737 | ae40972f | blueswir1 | .ser_irq = 15,
|
738 | ae40972f | blueswir1 | .fd_irq = 22,
|
739 | ae40972f | blueswir1 | .me_irq = 30,
|
740 | e42c20b4 | blueswir1 | .ecc_irq = 28,
|
741 | 905fdcb5 | blueswir1 | .nvram_machine_id = 0x72,
|
742 | 905fdcb5 | blueswir1 | .machine_id = ss20_id, |
743 | ae40972f | blueswir1 | .iommu_version = 0x13000000,
|
744 | ae40972f | blueswir1 | .intbit_to_level = { |
745 | ae40972f | blueswir1 | 2, 3, 5, 7, 9, 11, 0, 14, 3, 5, 7, 9, 11, 13, 12, 12, |
746 | ae40972f | blueswir1 | 6, 0, 4, 10, 8, 0, 11, 0, 0, 0, 0, 0, 15, 0, 15, 0, |
747 | ae40972f | blueswir1 | }, |
748 | 6ef05b95 | blueswir1 | .max_mem = 0xf00000000ULL,
|
749 | ae40972f | blueswir1 | .default_cpu_model = "TI SuperSparc II",
|
750 | ae40972f | blueswir1 | }, |
751 | a526a31c | blueswir1 | /* Voyager */
|
752 | a526a31c | blueswir1 | { |
753 | a526a31c | blueswir1 | .iommu_base = 0x10000000,
|
754 | a526a31c | blueswir1 | .tcx_base = 0x50000000,
|
755 | a526a31c | blueswir1 | .slavio_base = 0x70000000,
|
756 | a526a31c | blueswir1 | .ms_kb_base = 0x71000000,
|
757 | a526a31c | blueswir1 | .serial_base = 0x71100000,
|
758 | a526a31c | blueswir1 | .nvram_base = 0x71200000,
|
759 | a526a31c | blueswir1 | .fd_base = 0x71400000,
|
760 | a526a31c | blueswir1 | .counter_base = 0x71d00000,
|
761 | a526a31c | blueswir1 | .intctl_base = 0x71e00000,
|
762 | a526a31c | blueswir1 | .idreg_base = 0x78000000,
|
763 | a526a31c | blueswir1 | .dma_base = 0x78400000,
|
764 | a526a31c | blueswir1 | .esp_base = 0x78800000,
|
765 | a526a31c | blueswir1 | .le_base = 0x78c00000,
|
766 | a526a31c | blueswir1 | .apc_base = 0x71300000, // pmc |
767 | a526a31c | blueswir1 | .aux1_base = 0x71900000,
|
768 | a526a31c | blueswir1 | .aux2_base = 0x71910000,
|
769 | a526a31c | blueswir1 | .vram_size = 0x00100000,
|
770 | a526a31c | blueswir1 | .nvram_size = 0x2000,
|
771 | a526a31c | blueswir1 | .esp_irq = 18,
|
772 | a526a31c | blueswir1 | .le_irq = 16,
|
773 | a526a31c | blueswir1 | .clock_irq = 7,
|
774 | a526a31c | blueswir1 | .clock1_irq = 19,
|
775 | a526a31c | blueswir1 | .ms_kb_irq = 14,
|
776 | a526a31c | blueswir1 | .ser_irq = 15,
|
777 | a526a31c | blueswir1 | .fd_irq = 22,
|
778 | a526a31c | blueswir1 | .me_irq = 30,
|
779 | 905fdcb5 | blueswir1 | .nvram_machine_id = 0x80,
|
780 | 905fdcb5 | blueswir1 | .machine_id = vger_id, |
781 | a526a31c | blueswir1 | .iommu_version = 0x05000000,
|
782 | a526a31c | blueswir1 | .intbit_to_level = { |
783 | a526a31c | blueswir1 | 2, 3, 5, 7, 9, 11, 0, 14, 3, 5, 7, 9, 11, 13, 12, 12, |
784 | a526a31c | blueswir1 | 6, 0, 4, 10, 8, 0, 11, 0, 0, 0, 0, 0, 15, 0, 15, 0, |
785 | a526a31c | blueswir1 | }, |
786 | a526a31c | blueswir1 | .max_mem = 0x10000000,
|
787 | a526a31c | blueswir1 | .default_cpu_model = "Fujitsu MB86904",
|
788 | a526a31c | blueswir1 | }, |
789 | a526a31c | blueswir1 | /* LX */
|
790 | a526a31c | blueswir1 | { |
791 | a526a31c | blueswir1 | .iommu_base = 0x10000000,
|
792 | a526a31c | blueswir1 | .tcx_base = 0x50000000,
|
793 | a526a31c | blueswir1 | .slavio_base = 0x70000000,
|
794 | a526a31c | blueswir1 | .ms_kb_base = 0x71000000,
|
795 | a526a31c | blueswir1 | .serial_base = 0x71100000,
|
796 | a526a31c | blueswir1 | .nvram_base = 0x71200000,
|
797 | a526a31c | blueswir1 | .fd_base = 0x71400000,
|
798 | a526a31c | blueswir1 | .counter_base = 0x71d00000,
|
799 | a526a31c | blueswir1 | .intctl_base = 0x71e00000,
|
800 | a526a31c | blueswir1 | .idreg_base = 0x78000000,
|
801 | a526a31c | blueswir1 | .dma_base = 0x78400000,
|
802 | a526a31c | blueswir1 | .esp_base = 0x78800000,
|
803 | a526a31c | blueswir1 | .le_base = 0x78c00000,
|
804 | a526a31c | blueswir1 | .aux1_base = 0x71900000,
|
805 | a526a31c | blueswir1 | .aux2_base = 0x71910000,
|
806 | a526a31c | blueswir1 | .vram_size = 0x00100000,
|
807 | a526a31c | blueswir1 | .nvram_size = 0x2000,
|
808 | a526a31c | blueswir1 | .esp_irq = 18,
|
809 | a526a31c | blueswir1 | .le_irq = 16,
|
810 | a526a31c | blueswir1 | .clock_irq = 7,
|
811 | a526a31c | blueswir1 | .clock1_irq = 19,
|
812 | a526a31c | blueswir1 | .ms_kb_irq = 14,
|
813 | a526a31c | blueswir1 | .ser_irq = 15,
|
814 | a526a31c | blueswir1 | .fd_irq = 22,
|
815 | a526a31c | blueswir1 | .me_irq = 30,
|
816 | 905fdcb5 | blueswir1 | .nvram_machine_id = 0x80,
|
817 | 905fdcb5 | blueswir1 | .machine_id = lx_id, |
818 | a526a31c | blueswir1 | .iommu_version = 0x04000000,
|
819 | a526a31c | blueswir1 | .intbit_to_level = { |
820 | a526a31c | blueswir1 | 2, 3, 5, 7, 9, 11, 0, 14, 3, 5, 7, 9, 11, 13, 12, 12, |
821 | a526a31c | blueswir1 | 6, 0, 4, 10, 8, 0, 11, 0, 0, 0, 0, 0, 15, 0, 15, 0, |
822 | a526a31c | blueswir1 | }, |
823 | a526a31c | blueswir1 | .max_mem = 0x10000000,
|
824 | a526a31c | blueswir1 | .default_cpu_model = "TI MicroSparc I",
|
825 | a526a31c | blueswir1 | }, |
826 | a526a31c | blueswir1 | /* SS-4 */
|
827 | a526a31c | blueswir1 | { |
828 | a526a31c | blueswir1 | .iommu_base = 0x10000000,
|
829 | a526a31c | blueswir1 | .tcx_base = 0x50000000,
|
830 | a526a31c | blueswir1 | .cs_base = 0x6c000000,
|
831 | a526a31c | blueswir1 | .slavio_base = 0x70000000,
|
832 | a526a31c | blueswir1 | .ms_kb_base = 0x71000000,
|
833 | a526a31c | blueswir1 | .serial_base = 0x71100000,
|
834 | a526a31c | blueswir1 | .nvram_base = 0x71200000,
|
835 | a526a31c | blueswir1 | .fd_base = 0x71400000,
|
836 | a526a31c | blueswir1 | .counter_base = 0x71d00000,
|
837 | a526a31c | blueswir1 | .intctl_base = 0x71e00000,
|
838 | a526a31c | blueswir1 | .idreg_base = 0x78000000,
|
839 | a526a31c | blueswir1 | .dma_base = 0x78400000,
|
840 | a526a31c | blueswir1 | .esp_base = 0x78800000,
|
841 | a526a31c | blueswir1 | .le_base = 0x78c00000,
|
842 | a526a31c | blueswir1 | .apc_base = 0x6a000000,
|
843 | a526a31c | blueswir1 | .aux1_base = 0x71900000,
|
844 | a526a31c | blueswir1 | .aux2_base = 0x71910000,
|
845 | a526a31c | blueswir1 | .vram_size = 0x00100000,
|
846 | a526a31c | blueswir1 | .nvram_size = 0x2000,
|
847 | a526a31c | blueswir1 | .esp_irq = 18,
|
848 | a526a31c | blueswir1 | .le_irq = 16,
|
849 | a526a31c | blueswir1 | .clock_irq = 7,
|
850 | a526a31c | blueswir1 | .clock1_irq = 19,
|
851 | a526a31c | blueswir1 | .ms_kb_irq = 14,
|
852 | a526a31c | blueswir1 | .ser_irq = 15,
|
853 | a526a31c | blueswir1 | .fd_irq = 22,
|
854 | a526a31c | blueswir1 | .me_irq = 30,
|
855 | a526a31c | blueswir1 | .cs_irq = 5,
|
856 | 905fdcb5 | blueswir1 | .nvram_machine_id = 0x80,
|
857 | 905fdcb5 | blueswir1 | .machine_id = ss4_id, |
858 | a526a31c | blueswir1 | .iommu_version = 0x05000000,
|
859 | a526a31c | blueswir1 | .intbit_to_level = { |
860 | a526a31c | blueswir1 | 2, 3, 5, 7, 9, 11, 0, 14, 3, 5, 7, 9, 11, 13, 12, 12, |
861 | a526a31c | blueswir1 | 6, 0, 4, 10, 8, 0, 11, 0, 0, 0, 0, 0, 15, 0, 15, 0, |
862 | a526a31c | blueswir1 | }, |
863 | a526a31c | blueswir1 | .max_mem = 0x10000000,
|
864 | a526a31c | blueswir1 | .default_cpu_model = "Fujitsu MB86904",
|
865 | a526a31c | blueswir1 | }, |
866 | a526a31c | blueswir1 | /* SPARCClassic */
|
867 | a526a31c | blueswir1 | { |
868 | a526a31c | blueswir1 | .iommu_base = 0x10000000,
|
869 | a526a31c | blueswir1 | .tcx_base = 0x50000000,
|
870 | a526a31c | blueswir1 | .slavio_base = 0x70000000,
|
871 | a526a31c | blueswir1 | .ms_kb_base = 0x71000000,
|
872 | a526a31c | blueswir1 | .serial_base = 0x71100000,
|
873 | a526a31c | blueswir1 | .nvram_base = 0x71200000,
|
874 | a526a31c | blueswir1 | .fd_base = 0x71400000,
|
875 | a526a31c | blueswir1 | .counter_base = 0x71d00000,
|
876 | a526a31c | blueswir1 | .intctl_base = 0x71e00000,
|
877 | a526a31c | blueswir1 | .idreg_base = 0x78000000,
|
878 | a526a31c | blueswir1 | .dma_base = 0x78400000,
|
879 | a526a31c | blueswir1 | .esp_base = 0x78800000,
|
880 | a526a31c | blueswir1 | .le_base = 0x78c00000,
|
881 | a526a31c | blueswir1 | .apc_base = 0x6a000000,
|
882 | a526a31c | blueswir1 | .aux1_base = 0x71900000,
|
883 | a526a31c | blueswir1 | .aux2_base = 0x71910000,
|
884 | a526a31c | blueswir1 | .vram_size = 0x00100000,
|
885 | a526a31c | blueswir1 | .nvram_size = 0x2000,
|
886 | a526a31c | blueswir1 | .esp_irq = 18,
|
887 | a526a31c | blueswir1 | .le_irq = 16,
|
888 | a526a31c | blueswir1 | .clock_irq = 7,
|
889 | a526a31c | blueswir1 | .clock1_irq = 19,
|
890 | a526a31c | blueswir1 | .ms_kb_irq = 14,
|
891 | a526a31c | blueswir1 | .ser_irq = 15,
|
892 | a526a31c | blueswir1 | .fd_irq = 22,
|
893 | a526a31c | blueswir1 | .me_irq = 30,
|
894 | 905fdcb5 | blueswir1 | .nvram_machine_id = 0x80,
|
895 | 905fdcb5 | blueswir1 | .machine_id = scls_id, |
896 | a526a31c | blueswir1 | .iommu_version = 0x05000000,
|
897 | a526a31c | blueswir1 | .intbit_to_level = { |
898 | a526a31c | blueswir1 | 2, 3, 5, 7, 9, 11, 0, 14, 3, 5, 7, 9, 11, 13, 12, 12, |
899 | a526a31c | blueswir1 | 6, 0, 4, 10, 8, 0, 11, 0, 0, 0, 0, 0, 15, 0, 15, 0, |
900 | a526a31c | blueswir1 | }, |
901 | a526a31c | blueswir1 | .max_mem = 0x10000000,
|
902 | a526a31c | blueswir1 | .default_cpu_model = "TI MicroSparc I",
|
903 | a526a31c | blueswir1 | }, |
904 | a526a31c | blueswir1 | /* SPARCbook */
|
905 | a526a31c | blueswir1 | { |
906 | a526a31c | blueswir1 | .iommu_base = 0x10000000,
|
907 | a526a31c | blueswir1 | .tcx_base = 0x50000000, // XXX |
908 | a526a31c | blueswir1 | .slavio_base = 0x70000000,
|
909 | a526a31c | blueswir1 | .ms_kb_base = 0x71000000,
|
910 | a526a31c | blueswir1 | .serial_base = 0x71100000,
|
911 | a526a31c | blueswir1 | .nvram_base = 0x71200000,
|
912 | a526a31c | blueswir1 | .fd_base = 0x71400000,
|
913 | a526a31c | blueswir1 | .counter_base = 0x71d00000,
|
914 | a526a31c | blueswir1 | .intctl_base = 0x71e00000,
|
915 | a526a31c | blueswir1 | .idreg_base = 0x78000000,
|
916 | a526a31c | blueswir1 | .dma_base = 0x78400000,
|
917 | a526a31c | blueswir1 | .esp_base = 0x78800000,
|
918 | a526a31c | blueswir1 | .le_base = 0x78c00000,
|
919 | a526a31c | blueswir1 | .apc_base = 0x6a000000,
|
920 | a526a31c | blueswir1 | .aux1_base = 0x71900000,
|
921 | a526a31c | blueswir1 | .aux2_base = 0x71910000,
|
922 | a526a31c | blueswir1 | .vram_size = 0x00100000,
|
923 | a526a31c | blueswir1 | .nvram_size = 0x2000,
|
924 | a526a31c | blueswir1 | .esp_irq = 18,
|
925 | a526a31c | blueswir1 | .le_irq = 16,
|
926 | a526a31c | blueswir1 | .clock_irq = 7,
|
927 | a526a31c | blueswir1 | .clock1_irq = 19,
|
928 | a526a31c | blueswir1 | .ms_kb_irq = 14,
|
929 | a526a31c | blueswir1 | .ser_irq = 15,
|
930 | a526a31c | blueswir1 | .fd_irq = 22,
|
931 | a526a31c | blueswir1 | .me_irq = 30,
|
932 | 905fdcb5 | blueswir1 | .nvram_machine_id = 0x80,
|
933 | 905fdcb5 | blueswir1 | .machine_id = sbook_id, |
934 | a526a31c | blueswir1 | .iommu_version = 0x05000000,
|
935 | a526a31c | blueswir1 | .intbit_to_level = { |
936 | a526a31c | blueswir1 | 2, 3, 5, 7, 9, 11, 0, 14, 3, 5, 7, 9, 11, 13, 12, 12, |
937 | a526a31c | blueswir1 | 6, 0, 4, 10, 8, 0, 11, 0, 0, 0, 0, 0, 15, 0, 15, 0, |
938 | a526a31c | blueswir1 | }, |
939 | a526a31c | blueswir1 | .max_mem = 0x10000000,
|
940 | a526a31c | blueswir1 | .default_cpu_model = "TI MicroSparc I",
|
941 | a526a31c | blueswir1 | }, |
942 | 36cd9210 | blueswir1 | }; |
943 | 36cd9210 | blueswir1 | |
944 | 36cd9210 | blueswir1 | /* SPARCstation 5 hardware initialisation */
|
945 | fbe1b595 | Paul Brook | static void ss5_init(ram_addr_t RAM_size, |
946 | 3023f332 | aliguori | const char *boot_device, |
947 | b881c2c6 | blueswir1 | const char *kernel_filename, const char *kernel_cmdline, |
948 | b881c2c6 | blueswir1 | const char *initrd_filename, const char *cpu_model) |
949 | 36cd9210 | blueswir1 | { |
950 | 3023f332 | aliguori | sun4m_hw_init(&sun4m_hwdefs[0], RAM_size, boot_device, kernel_filename,
|
951 | 3ebf5aaf | blueswir1 | kernel_cmdline, initrd_filename, cpu_model); |
952 | 420557e8 | bellard | } |
953 | c0e564d5 | bellard | |
954 | e0353fe2 | blueswir1 | /* SPARCstation 10 hardware initialisation */
|
955 | fbe1b595 | Paul Brook | static void ss10_init(ram_addr_t RAM_size, |
956 | 3023f332 | aliguori | const char *boot_device, |
957 | b881c2c6 | blueswir1 | const char *kernel_filename, const char *kernel_cmdline, |
958 | b881c2c6 | blueswir1 | const char *initrd_filename, const char *cpu_model) |
959 | e0353fe2 | blueswir1 | { |
960 | 3023f332 | aliguori | sun4m_hw_init(&sun4m_hwdefs[1], RAM_size, boot_device, kernel_filename,
|
961 | 3ebf5aaf | blueswir1 | kernel_cmdline, initrd_filename, cpu_model); |
962 | e0353fe2 | blueswir1 | } |
963 | e0353fe2 | blueswir1 | |
964 | 6a3b9cc9 | blueswir1 | /* SPARCserver 600MP hardware initialisation */
|
965 | fbe1b595 | Paul Brook | static void ss600mp_init(ram_addr_t RAM_size, |
966 | 3023f332 | aliguori | const char *boot_device, |
967 | 77f193da | blueswir1 | const char *kernel_filename, |
968 | 77f193da | blueswir1 | const char *kernel_cmdline, |
969 | 6a3b9cc9 | blueswir1 | const char *initrd_filename, const char *cpu_model) |
970 | 6a3b9cc9 | blueswir1 | { |
971 | 3023f332 | aliguori | sun4m_hw_init(&sun4m_hwdefs[2], RAM_size, boot_device, kernel_filename,
|
972 | 3ebf5aaf | blueswir1 | kernel_cmdline, initrd_filename, cpu_model); |
973 | 6a3b9cc9 | blueswir1 | } |
974 | 6a3b9cc9 | blueswir1 | |
975 | ae40972f | blueswir1 | /* SPARCstation 20 hardware initialisation */
|
976 | fbe1b595 | Paul Brook | static void ss20_init(ram_addr_t RAM_size, |
977 | 3023f332 | aliguori | const char *boot_device, |
978 | ae40972f | blueswir1 | const char *kernel_filename, const char *kernel_cmdline, |
979 | ae40972f | blueswir1 | const char *initrd_filename, const char *cpu_model) |
980 | ae40972f | blueswir1 | { |
981 | 3023f332 | aliguori | sun4m_hw_init(&sun4m_hwdefs[3], RAM_size, boot_device, kernel_filename,
|
982 | ee76f82e | blueswir1 | kernel_cmdline, initrd_filename, cpu_model); |
983 | ee76f82e | blueswir1 | } |
984 | ee76f82e | blueswir1 | |
985 | a526a31c | blueswir1 | /* SPARCstation Voyager hardware initialisation */
|
986 | fbe1b595 | Paul Brook | static void vger_init(ram_addr_t RAM_size, |
987 | 3023f332 | aliguori | const char *boot_device, |
988 | a526a31c | blueswir1 | const char *kernel_filename, const char *kernel_cmdline, |
989 | a526a31c | blueswir1 | const char *initrd_filename, const char *cpu_model) |
990 | a526a31c | blueswir1 | { |
991 | 3023f332 | aliguori | sun4m_hw_init(&sun4m_hwdefs[4], RAM_size, boot_device, kernel_filename,
|
992 | a526a31c | blueswir1 | kernel_cmdline, initrd_filename, cpu_model); |
993 | a526a31c | blueswir1 | } |
994 | a526a31c | blueswir1 | |
995 | a526a31c | blueswir1 | /* SPARCstation LX hardware initialisation */
|
996 | fbe1b595 | Paul Brook | static void ss_lx_init(ram_addr_t RAM_size, |
997 | 3023f332 | aliguori | const char *boot_device, |
998 | a526a31c | blueswir1 | const char *kernel_filename, const char *kernel_cmdline, |
999 | a526a31c | blueswir1 | const char *initrd_filename, const char *cpu_model) |
1000 | a526a31c | blueswir1 | { |
1001 | 3023f332 | aliguori | sun4m_hw_init(&sun4m_hwdefs[5], RAM_size, boot_device, kernel_filename,
|
1002 | a526a31c | blueswir1 | kernel_cmdline, initrd_filename, cpu_model); |
1003 | a526a31c | blueswir1 | } |
1004 | a526a31c | blueswir1 | |
1005 | a526a31c | blueswir1 | /* SPARCstation 4 hardware initialisation */
|
1006 | fbe1b595 | Paul Brook | static void ss4_init(ram_addr_t RAM_size, |
1007 | 3023f332 | aliguori | const char *boot_device, |
1008 | a526a31c | blueswir1 | const char *kernel_filename, const char *kernel_cmdline, |
1009 | a526a31c | blueswir1 | const char *initrd_filename, const char *cpu_model) |
1010 | a526a31c | blueswir1 | { |
1011 | 3023f332 | aliguori | sun4m_hw_init(&sun4m_hwdefs[6], RAM_size, boot_device, kernel_filename,
|
1012 | a526a31c | blueswir1 | kernel_cmdline, initrd_filename, cpu_model); |
1013 | a526a31c | blueswir1 | } |
1014 | a526a31c | blueswir1 | |
1015 | a526a31c | blueswir1 | /* SPARCClassic hardware initialisation */
|
1016 | fbe1b595 | Paul Brook | static void scls_init(ram_addr_t RAM_size, |
1017 | 3023f332 | aliguori | const char *boot_device, |
1018 | a526a31c | blueswir1 | const char *kernel_filename, const char *kernel_cmdline, |
1019 | a526a31c | blueswir1 | const char *initrd_filename, const char *cpu_model) |
1020 | a526a31c | blueswir1 | { |
1021 | 3023f332 | aliguori | sun4m_hw_init(&sun4m_hwdefs[7], RAM_size, boot_device, kernel_filename,
|
1022 | a526a31c | blueswir1 | kernel_cmdline, initrd_filename, cpu_model); |
1023 | a526a31c | blueswir1 | } |
1024 | a526a31c | blueswir1 | |
1025 | a526a31c | blueswir1 | /* SPARCbook hardware initialisation */
|
1026 | fbe1b595 | Paul Brook | static void sbook_init(ram_addr_t RAM_size, |
1027 | 3023f332 | aliguori | const char *boot_device, |
1028 | a526a31c | blueswir1 | const char *kernel_filename, const char *kernel_cmdline, |
1029 | a526a31c | blueswir1 | const char *initrd_filename, const char *cpu_model) |
1030 | a526a31c | blueswir1 | { |
1031 | 3023f332 | aliguori | sun4m_hw_init(&sun4m_hwdefs[8], RAM_size, boot_device, kernel_filename,
|
1032 | a526a31c | blueswir1 | kernel_cmdline, initrd_filename, cpu_model); |
1033 | a526a31c | blueswir1 | } |
1034 | a526a31c | blueswir1 | |
1035 | 36cd9210 | blueswir1 | QEMUMachine ss5_machine = { |
1036 | 66de733b | blueswir1 | .name = "SS-5",
|
1037 | 66de733b | blueswir1 | .desc = "Sun4m platform, SPARCstation 5",
|
1038 | 66de733b | blueswir1 | .init = ss5_init, |
1039 | c9b1ae2c | blueswir1 | .use_scsi = 1,
|
1040 | c0e564d5 | bellard | }; |
1041 | e0353fe2 | blueswir1 | |
1042 | e0353fe2 | blueswir1 | QEMUMachine ss10_machine = { |
1043 | 66de733b | blueswir1 | .name = "SS-10",
|
1044 | 66de733b | blueswir1 | .desc = "Sun4m platform, SPARCstation 10",
|
1045 | 66de733b | blueswir1 | .init = ss10_init, |
1046 | c9b1ae2c | blueswir1 | .use_scsi = 1,
|
1047 | 1bcee014 | blueswir1 | .max_cpus = 4,
|
1048 | e0353fe2 | blueswir1 | }; |
1049 | 6a3b9cc9 | blueswir1 | |
1050 | 6a3b9cc9 | blueswir1 | QEMUMachine ss600mp_machine = { |
1051 | 66de733b | blueswir1 | .name = "SS-600MP",
|
1052 | 66de733b | blueswir1 | .desc = "Sun4m platform, SPARCserver 600MP",
|
1053 | 66de733b | blueswir1 | .init = ss600mp_init, |
1054 | c9b1ae2c | blueswir1 | .use_scsi = 1,
|
1055 | 1bcee014 | blueswir1 | .max_cpus = 4,
|
1056 | 6a3b9cc9 | blueswir1 | }; |
1057 | ae40972f | blueswir1 | |
1058 | ae40972f | blueswir1 | QEMUMachine ss20_machine = { |
1059 | 66de733b | blueswir1 | .name = "SS-20",
|
1060 | 66de733b | blueswir1 | .desc = "Sun4m platform, SPARCstation 20",
|
1061 | 66de733b | blueswir1 | .init = ss20_init, |
1062 | c9b1ae2c | blueswir1 | .use_scsi = 1,
|
1063 | 1bcee014 | blueswir1 | .max_cpus = 4,
|
1064 | ae40972f | blueswir1 | }; |
1065 | ae40972f | blueswir1 | |
1066 | a526a31c | blueswir1 | QEMUMachine voyager_machine = { |
1067 | 66de733b | blueswir1 | .name = "Voyager",
|
1068 | 66de733b | blueswir1 | .desc = "Sun4m platform, SPARCstation Voyager",
|
1069 | 66de733b | blueswir1 | .init = vger_init, |
1070 | c9b1ae2c | blueswir1 | .use_scsi = 1,
|
1071 | a526a31c | blueswir1 | }; |
1072 | a526a31c | blueswir1 | |
1073 | a526a31c | blueswir1 | QEMUMachine ss_lx_machine = { |
1074 | 66de733b | blueswir1 | .name = "LX",
|
1075 | 66de733b | blueswir1 | .desc = "Sun4m platform, SPARCstation LX",
|
1076 | 66de733b | blueswir1 | .init = ss_lx_init, |
1077 | c9b1ae2c | blueswir1 | .use_scsi = 1,
|
1078 | a526a31c | blueswir1 | }; |
1079 | a526a31c | blueswir1 | |
1080 | a526a31c | blueswir1 | QEMUMachine ss4_machine = { |
1081 | 66de733b | blueswir1 | .name = "SS-4",
|
1082 | 66de733b | blueswir1 | .desc = "Sun4m platform, SPARCstation 4",
|
1083 | 66de733b | blueswir1 | .init = ss4_init, |
1084 | c9b1ae2c | blueswir1 | .use_scsi = 1,
|
1085 | a526a31c | blueswir1 | }; |
1086 | a526a31c | blueswir1 | |
1087 | a526a31c | blueswir1 | QEMUMachine scls_machine = { |
1088 | 66de733b | blueswir1 | .name = "SPARCClassic",
|
1089 | 66de733b | blueswir1 | .desc = "Sun4m platform, SPARCClassic",
|
1090 | 66de733b | blueswir1 | .init = scls_init, |
1091 | c9b1ae2c | blueswir1 | .use_scsi = 1,
|
1092 | a526a31c | blueswir1 | }; |
1093 | a526a31c | blueswir1 | |
1094 | a526a31c | blueswir1 | QEMUMachine sbook_machine = { |
1095 | 66de733b | blueswir1 | .name = "SPARCbook",
|
1096 | 66de733b | blueswir1 | .desc = "Sun4m platform, SPARCbook",
|
1097 | 66de733b | blueswir1 | .init = sbook_init, |
1098 | c9b1ae2c | blueswir1 | .use_scsi = 1,
|
1099 | a526a31c | blueswir1 | }; |
1100 | a526a31c | blueswir1 | |
1101 | 7d85892b | blueswir1 | static const struct sun4d_hwdef sun4d_hwdefs[] = { |
1102 | 7d85892b | blueswir1 | /* SS-1000 */
|
1103 | 7d85892b | blueswir1 | { |
1104 | 7d85892b | blueswir1 | .iounit_bases = { |
1105 | 7d85892b | blueswir1 | 0xfe0200000ULL,
|
1106 | 7d85892b | blueswir1 | 0xfe1200000ULL,
|
1107 | 7d85892b | blueswir1 | 0xfe2200000ULL,
|
1108 | 7d85892b | blueswir1 | 0xfe3200000ULL,
|
1109 | 7d85892b | blueswir1 | -1,
|
1110 | 7d85892b | blueswir1 | }, |
1111 | 7d85892b | blueswir1 | .tcx_base = 0x820000000ULL,
|
1112 | 7d85892b | blueswir1 | .slavio_base = 0xf00000000ULL,
|
1113 | 7d85892b | blueswir1 | .ms_kb_base = 0xf00240000ULL,
|
1114 | 7d85892b | blueswir1 | .serial_base = 0xf00200000ULL,
|
1115 | 7d85892b | blueswir1 | .nvram_base = 0xf00280000ULL,
|
1116 | 7d85892b | blueswir1 | .counter_base = 0xf00300000ULL,
|
1117 | 7d85892b | blueswir1 | .espdma_base = 0x800081000ULL,
|
1118 | 7d85892b | blueswir1 | .esp_base = 0x800080000ULL,
|
1119 | 7d85892b | blueswir1 | .ledma_base = 0x800040000ULL,
|
1120 | 7d85892b | blueswir1 | .le_base = 0x800060000ULL,
|
1121 | 7d85892b | blueswir1 | .sbi_base = 0xf02800000ULL,
|
1122 | c1d00dc0 | blueswir1 | .vram_size = 0x00100000,
|
1123 | 7d85892b | blueswir1 | .nvram_size = 0x2000,
|
1124 | 7d85892b | blueswir1 | .esp_irq = 3,
|
1125 | 7d85892b | blueswir1 | .le_irq = 4,
|
1126 | 7d85892b | blueswir1 | .clock_irq = 14,
|
1127 | 7d85892b | blueswir1 | .clock1_irq = 10,
|
1128 | 7d85892b | blueswir1 | .ms_kb_irq = 12,
|
1129 | 7d85892b | blueswir1 | .ser_irq = 12,
|
1130 | 905fdcb5 | blueswir1 | .nvram_machine_id = 0x80,
|
1131 | 905fdcb5 | blueswir1 | .machine_id = ss1000_id, |
1132 | 7d85892b | blueswir1 | .iounit_version = 0x03000000,
|
1133 | 6ef05b95 | blueswir1 | .max_mem = 0xf00000000ULL,
|
1134 | 7d85892b | blueswir1 | .default_cpu_model = "TI SuperSparc II",
|
1135 | 7d85892b | blueswir1 | }, |
1136 | 7d85892b | blueswir1 | /* SS-2000 */
|
1137 | 7d85892b | blueswir1 | { |
1138 | 7d85892b | blueswir1 | .iounit_bases = { |
1139 | 7d85892b | blueswir1 | 0xfe0200000ULL,
|
1140 | 7d85892b | blueswir1 | 0xfe1200000ULL,
|
1141 | 7d85892b | blueswir1 | 0xfe2200000ULL,
|
1142 | 7d85892b | blueswir1 | 0xfe3200000ULL,
|
1143 | 7d85892b | blueswir1 | 0xfe4200000ULL,
|
1144 | 7d85892b | blueswir1 | }, |
1145 | 7d85892b | blueswir1 | .tcx_base = 0x820000000ULL,
|
1146 | 7d85892b | blueswir1 | .slavio_base = 0xf00000000ULL,
|
1147 | 7d85892b | blueswir1 | .ms_kb_base = 0xf00240000ULL,
|
1148 | 7d85892b | blueswir1 | .serial_base = 0xf00200000ULL,
|
1149 | 7d85892b | blueswir1 | .nvram_base = 0xf00280000ULL,
|
1150 | 7d85892b | blueswir1 | .counter_base = 0xf00300000ULL,
|
1151 | 7d85892b | blueswir1 | .espdma_base = 0x800081000ULL,
|
1152 | 7d85892b | blueswir1 | .esp_base = 0x800080000ULL,
|
1153 | 7d85892b | blueswir1 | .ledma_base = 0x800040000ULL,
|
1154 | 7d85892b | blueswir1 | .le_base = 0x800060000ULL,
|
1155 | 7d85892b | blueswir1 | .sbi_base = 0xf02800000ULL,
|
1156 | c1d00dc0 | blueswir1 | .vram_size = 0x00100000,
|
1157 | 7d85892b | blueswir1 | .nvram_size = 0x2000,
|
1158 | 7d85892b | blueswir1 | .esp_irq = 3,
|
1159 | 7d85892b | blueswir1 | .le_irq = 4,
|
1160 | 7d85892b | blueswir1 | .clock_irq = 14,
|
1161 | 7d85892b | blueswir1 | .clock1_irq = 10,
|
1162 | 7d85892b | blueswir1 | .ms_kb_irq = 12,
|
1163 | 7d85892b | blueswir1 | .ser_irq = 12,
|
1164 | 905fdcb5 | blueswir1 | .nvram_machine_id = 0x80,
|
1165 | 905fdcb5 | blueswir1 | .machine_id = ss2000_id, |
1166 | 7d85892b | blueswir1 | .iounit_version = 0x03000000,
|
1167 | 6ef05b95 | blueswir1 | .max_mem = 0xf00000000ULL,
|
1168 | 7d85892b | blueswir1 | .default_cpu_model = "TI SuperSparc II",
|
1169 | 7d85892b | blueswir1 | }, |
1170 | 7d85892b | blueswir1 | }; |
1171 | 7d85892b | blueswir1 | |
1172 | 6ef05b95 | blueswir1 | static void sun4d_hw_init(const struct sun4d_hwdef *hwdef, ram_addr_t RAM_size, |
1173 | 7d85892b | blueswir1 | const char *boot_device, |
1174 | 3023f332 | aliguori | const char *kernel_filename, |
1175 | 7d85892b | blueswir1 | const char *kernel_cmdline, |
1176 | 7d85892b | blueswir1 | const char *initrd_filename, const char *cpu_model) |
1177 | 7d85892b | blueswir1 | { |
1178 | 7d85892b | blueswir1 | CPUState *env, *envs[MAX_CPUS]; |
1179 | 7d85892b | blueswir1 | unsigned int i; |
1180 | cfb9de9c | Paul Brook | void *iounits[MAX_IOUNITS], *espdma, *ledma, *nvram, *sbi;
|
1181 | 7d85892b | blueswir1 | qemu_irq *cpu_irqs[MAX_CPUS], *sbi_irq, *sbi_cpu_irq, |
1182 | 7d85892b | blueswir1 | *espdma_irq, *ledma_irq; |
1183 | 7d85892b | blueswir1 | qemu_irq *esp_reset, *le_reset; |
1184 | dc828ca1 | pbrook | ram_addr_t ram_offset, prom_offset; |
1185 | 5c6602c5 | blueswir1 | unsigned long kernel_size; |
1186 | 7d85892b | blueswir1 | int ret;
|
1187 | 7d85892b | blueswir1 | char buf[1024]; |
1188 | 3cce6243 | blueswir1 | void *fw_cfg;
|
1189 | 7d85892b | blueswir1 | |
1190 | 7d85892b | blueswir1 | /* init CPUs */
|
1191 | 7d85892b | blueswir1 | if (!cpu_model)
|
1192 | 7d85892b | blueswir1 | cpu_model = hwdef->default_cpu_model; |
1193 | 7d85892b | blueswir1 | |
1194 | 7d85892b | blueswir1 | for (i = 0; i < smp_cpus; i++) { |
1195 | 7d85892b | blueswir1 | env = cpu_init(cpu_model); |
1196 | 7d85892b | blueswir1 | if (!env) {
|
1197 | 8e82c6a8 | blueswir1 | fprintf(stderr, "qemu: Unable to find Sparc CPU definition\n");
|
1198 | 7d85892b | blueswir1 | exit(1);
|
1199 | 7d85892b | blueswir1 | } |
1200 | 7d85892b | blueswir1 | cpu_sparc_set_id(env, i); |
1201 | 7d85892b | blueswir1 | envs[i] = env; |
1202 | 7d85892b | blueswir1 | if (i == 0) { |
1203 | 7d85892b | blueswir1 | qemu_register_reset(main_cpu_reset, env); |
1204 | 7d85892b | blueswir1 | } else {
|
1205 | 7d85892b | blueswir1 | qemu_register_reset(secondary_cpu_reset, env); |
1206 | 7d85892b | blueswir1 | env->halted = 1;
|
1207 | 7d85892b | blueswir1 | } |
1208 | 7d85892b | blueswir1 | cpu_irqs[i] = qemu_allocate_irqs(cpu_set_irq, envs[i], MAX_PILS); |
1209 | 7d85892b | blueswir1 | env->prom_addr = hwdef->slavio_base; |
1210 | 7d85892b | blueswir1 | } |
1211 | 7d85892b | blueswir1 | |
1212 | 7d85892b | blueswir1 | for (i = smp_cpus; i < MAX_CPUS; i++)
|
1213 | 7d85892b | blueswir1 | cpu_irqs[i] = qemu_allocate_irqs(dummy_cpu_set_irq, NULL, MAX_PILS);
|
1214 | 7d85892b | blueswir1 | |
1215 | 7d85892b | blueswir1 | /* allocate RAM */
|
1216 | 7d85892b | blueswir1 | if ((uint64_t)RAM_size > hwdef->max_mem) {
|
1217 | 77f193da | blueswir1 | fprintf(stderr, |
1218 | 77f193da | blueswir1 | "qemu: Too much memory for this machine: %d, maximum %d\n",
|
1219 | 6ef05b95 | blueswir1 | (unsigned int)(RAM_size / (1024 * 1024)), |
1220 | 7d85892b | blueswir1 | (unsigned int)(hwdef->max_mem / (1024 * 1024))); |
1221 | 7d85892b | blueswir1 | exit(1);
|
1222 | 7d85892b | blueswir1 | } |
1223 | 5c6602c5 | blueswir1 | ram_offset = qemu_ram_alloc(RAM_size); |
1224 | 5c6602c5 | blueswir1 | cpu_register_physical_memory(0, RAM_size, ram_offset);
|
1225 | 7d85892b | blueswir1 | |
1226 | 7d85892b | blueswir1 | /* load boot prom */
|
1227 | 5c6602c5 | blueswir1 | prom_offset = qemu_ram_alloc(PROM_SIZE_MAX); |
1228 | 7d85892b | blueswir1 | cpu_register_physical_memory(hwdef->slavio_base, |
1229 | 7d85892b | blueswir1 | (PROM_SIZE_MAX + TARGET_PAGE_SIZE - 1) &
|
1230 | 7d85892b | blueswir1 | TARGET_PAGE_MASK, |
1231 | 7d85892b | blueswir1 | prom_offset | IO_MEM_ROM); |
1232 | 7d85892b | blueswir1 | |
1233 | 7d85892b | blueswir1 | if (bios_name == NULL) |
1234 | 7d85892b | blueswir1 | bios_name = PROM_FILENAME; |
1235 | 7d85892b | blueswir1 | snprintf(buf, sizeof(buf), "%s/%s", bios_dir, bios_name); |
1236 | 7d85892b | blueswir1 | ret = load_elf(buf, hwdef->slavio_base - PROM_VADDR, NULL, NULL, NULL); |
1237 | 7d85892b | blueswir1 | if (ret < 0 || ret > PROM_SIZE_MAX) |
1238 | e01f4a1c | blueswir1 | ret = load_image_targphys(buf, hwdef->slavio_base, PROM_SIZE_MAX); |
1239 | 7d85892b | blueswir1 | if (ret < 0 || ret > PROM_SIZE_MAX) { |
1240 | 7d85892b | blueswir1 | fprintf(stderr, "qemu: could not load prom '%s'\n",
|
1241 | 7d85892b | blueswir1 | buf); |
1242 | 7d85892b | blueswir1 | exit(1);
|
1243 | 7d85892b | blueswir1 | } |
1244 | 7d85892b | blueswir1 | |
1245 | 7d85892b | blueswir1 | /* set up devices */
|
1246 | 7d85892b | blueswir1 | sbi = sbi_init(hwdef->sbi_base, &sbi_irq, &sbi_cpu_irq, cpu_irqs); |
1247 | 7d85892b | blueswir1 | |
1248 | 7d85892b | blueswir1 | for (i = 0; i < MAX_IOUNITS; i++) |
1249 | 7d85892b | blueswir1 | if (hwdef->iounit_bases[i] != (target_phys_addr_t)-1) |
1250 | ff403da6 | blueswir1 | iounits[i] = iommu_init(hwdef->iounit_bases[i], |
1251 | ff403da6 | blueswir1 | hwdef->iounit_version, |
1252 | ff403da6 | blueswir1 | sbi_irq[hwdef->me_irq]); |
1253 | 7d85892b | blueswir1 | |
1254 | 7d85892b | blueswir1 | espdma = sparc32_dma_init(hwdef->espdma_base, sbi_irq[hwdef->esp_irq], |
1255 | 7d85892b | blueswir1 | iounits[0], &espdma_irq, &esp_reset);
|
1256 | 7d85892b | blueswir1 | |
1257 | 7d85892b | blueswir1 | ledma = sparc32_dma_init(hwdef->ledma_base, sbi_irq[hwdef->le_irq], |
1258 | 7d85892b | blueswir1 | iounits[0], &ledma_irq, &le_reset);
|
1259 | 7d85892b | blueswir1 | |
1260 | 7d85892b | blueswir1 | if (graphic_depth != 8 && graphic_depth != 24) { |
1261 | 7d85892b | blueswir1 | fprintf(stderr, "qemu: Unsupported depth: %d\n", graphic_depth);
|
1262 | 7d85892b | blueswir1 | exit (1);
|
1263 | 7d85892b | blueswir1 | } |
1264 | dc828ca1 | pbrook | tcx_init(hwdef->tcx_base, hwdef->vram_size, graphic_width, graphic_height, |
1265 | dc828ca1 | pbrook | graphic_depth); |
1266 | 7d85892b | blueswir1 | |
1267 | 0ae18cee | aliguori | lance_init(&nd_table[0], hwdef->le_base, ledma, *ledma_irq, le_reset);
|
1268 | 7d85892b | blueswir1 | |
1269 | 7d85892b | blueswir1 | nvram = m48t59_init(sbi_irq[0], hwdef->nvram_base, 0, |
1270 | 7d85892b | blueswir1 | hwdef->nvram_size, 8);
|
1271 | 7d85892b | blueswir1 | |
1272 | 7d85892b | blueswir1 | slavio_timer_init_all(hwdef->counter_base, sbi_irq[hwdef->clock1_irq], |
1273 | 7d85892b | blueswir1 | sbi_cpu_irq, smp_cpus); |
1274 | 7d85892b | blueswir1 | |
1275 | 7d85892b | blueswir1 | slavio_serial_ms_kbd_init(hwdef->ms_kb_base, sbi_irq[hwdef->ms_kb_irq], |
1276 | b4ed08e0 | blueswir1 | nographic, ESCC_CLOCK, 1);
|
1277 | 7d85892b | blueswir1 | // Slavio TTYA (base+4, Linux ttyS0) is the first Qemu serial device
|
1278 | 7d85892b | blueswir1 | // Slavio TTYB (base+0, Linux ttyS1) is the second Qemu serial device
|
1279 | aeeb69c7 | aurel32 | escc_init(hwdef->serial_base, sbi_irq[hwdef->ser_irq], sbi_irq[hwdef->ser_irq], |
1280 | aeeb69c7 | aurel32 | serial_hds[0], serial_hds[1], ESCC_CLOCK, 1); |
1281 | 7d85892b | blueswir1 | |
1282 | 7d85892b | blueswir1 | if (drive_get_max_bus(IF_SCSI) > 0) { |
1283 | 7d85892b | blueswir1 | fprintf(stderr, "qemu: too many SCSI bus\n");
|
1284 | 7d85892b | blueswir1 | exit(1);
|
1285 | 7d85892b | blueswir1 | } |
1286 | 7d85892b | blueswir1 | |
1287 | cfb9de9c | Paul Brook | esp_init(hwdef->esp_base, 2,
|
1288 | cfb9de9c | Paul Brook | espdma_memory_read, espdma_memory_write, |
1289 | cfb9de9c | Paul Brook | espdma, *espdma_irq, esp_reset); |
1290 | 7d85892b | blueswir1 | |
1291 | 293f78bc | blueswir1 | kernel_size = sun4m_load_kernel(kernel_filename, initrd_filename, |
1292 | 293f78bc | blueswir1 | RAM_size); |
1293 | 7d85892b | blueswir1 | |
1294 | 7d85892b | blueswir1 | nvram_init(nvram, (uint8_t *)&nd_table[0].macaddr, kernel_cmdline,
|
1295 | 7d85892b | blueswir1 | boot_device, RAM_size, kernel_size, graphic_width, |
1296 | 905fdcb5 | blueswir1 | graphic_height, graphic_depth, hwdef->nvram_machine_id, |
1297 | 905fdcb5 | blueswir1 | "Sun4d");
|
1298 | 3cce6243 | blueswir1 | |
1299 | 3cce6243 | blueswir1 | fw_cfg = fw_cfg_init(0, 0, CFG_ADDR, CFG_ADDR + 2); |
1300 | 3cce6243 | blueswir1 | fw_cfg_add_i32(fw_cfg, FW_CFG_ID, 1);
|
1301 | 905fdcb5 | blueswir1 | fw_cfg_add_i64(fw_cfg, FW_CFG_RAM_SIZE, (uint64_t)ram_size); |
1302 | 905fdcb5 | blueswir1 | fw_cfg_add_i16(fw_cfg, FW_CFG_MACHINE_ID, hwdef->machine_id); |
1303 | 513f789f | blueswir1 | fw_cfg_add_i16(fw_cfg, FW_CFG_SUN4M_DEPTH, graphic_depth); |
1304 | 513f789f | blueswir1 | fw_cfg_add_i32(fw_cfg, FW_CFG_KERNEL_ADDR, KERNEL_LOAD_ADDR); |
1305 | 513f789f | blueswir1 | fw_cfg_add_i32(fw_cfg, FW_CFG_KERNEL_SIZE, kernel_size); |
1306 | 513f789f | blueswir1 | if (kernel_cmdline) {
|
1307 | 513f789f | blueswir1 | fw_cfg_add_i32(fw_cfg, FW_CFG_KERNEL_CMDLINE, CMDLINE_ADDR); |
1308 | 513f789f | blueswir1 | pstrcpy_targphys(CMDLINE_ADDR, TARGET_PAGE_SIZE, kernel_cmdline); |
1309 | 513f789f | blueswir1 | } else {
|
1310 | 513f789f | blueswir1 | fw_cfg_add_i32(fw_cfg, FW_CFG_KERNEL_CMDLINE, 0);
|
1311 | 513f789f | blueswir1 | } |
1312 | 513f789f | blueswir1 | fw_cfg_add_i32(fw_cfg, FW_CFG_INITRD_ADDR, INITRD_LOAD_ADDR); |
1313 | 513f789f | blueswir1 | fw_cfg_add_i32(fw_cfg, FW_CFG_INITRD_SIZE, 0); // not used |
1314 | 513f789f | blueswir1 | fw_cfg_add_i16(fw_cfg, FW_CFG_BOOT_DEVICE, boot_device[0]);
|
1315 | 513f789f | blueswir1 | qemu_register_boot_set(fw_cfg_boot_set, fw_cfg); |
1316 | 7d85892b | blueswir1 | } |
1317 | 7d85892b | blueswir1 | |
1318 | 7d85892b | blueswir1 | /* SPARCserver 1000 hardware initialisation */
|
1319 | fbe1b595 | Paul Brook | static void ss1000_init(ram_addr_t RAM_size, |
1320 | 3023f332 | aliguori | const char *boot_device, |
1321 | 7d85892b | blueswir1 | const char *kernel_filename, const char *kernel_cmdline, |
1322 | 7d85892b | blueswir1 | const char *initrd_filename, const char *cpu_model) |
1323 | 7d85892b | blueswir1 | { |
1324 | 3023f332 | aliguori | sun4d_hw_init(&sun4d_hwdefs[0], RAM_size, boot_device, kernel_filename,
|
1325 | 7d85892b | blueswir1 | kernel_cmdline, initrd_filename, cpu_model); |
1326 | 7d85892b | blueswir1 | } |
1327 | 7d85892b | blueswir1 | |
1328 | 7d85892b | blueswir1 | /* SPARCcenter 2000 hardware initialisation */
|
1329 | fbe1b595 | Paul Brook | static void ss2000_init(ram_addr_t RAM_size, |
1330 | 3023f332 | aliguori | const char *boot_device, |
1331 | 7d85892b | blueswir1 | const char *kernel_filename, const char *kernel_cmdline, |
1332 | 7d85892b | blueswir1 | const char *initrd_filename, const char *cpu_model) |
1333 | 7d85892b | blueswir1 | { |
1334 | 3023f332 | aliguori | sun4d_hw_init(&sun4d_hwdefs[1], RAM_size, boot_device, kernel_filename,
|
1335 | 7d85892b | blueswir1 | kernel_cmdline, initrd_filename, cpu_model); |
1336 | 7d85892b | blueswir1 | } |
1337 | 7d85892b | blueswir1 | |
1338 | 7d85892b | blueswir1 | QEMUMachine ss1000_machine = { |
1339 | 66de733b | blueswir1 | .name = "SS-1000",
|
1340 | 66de733b | blueswir1 | .desc = "Sun4d platform, SPARCserver 1000",
|
1341 | 66de733b | blueswir1 | .init = ss1000_init, |
1342 | c9b1ae2c | blueswir1 | .use_scsi = 1,
|
1343 | 1bcee014 | blueswir1 | .max_cpus = 8,
|
1344 | 7d85892b | blueswir1 | }; |
1345 | 7d85892b | blueswir1 | |
1346 | 7d85892b | blueswir1 | QEMUMachine ss2000_machine = { |
1347 | 66de733b | blueswir1 | .name = "SS-2000",
|
1348 | 66de733b | blueswir1 | .desc = "Sun4d platform, SPARCcenter 2000",
|
1349 | 66de733b | blueswir1 | .init = ss2000_init, |
1350 | c9b1ae2c | blueswir1 | .use_scsi = 1,
|
1351 | 1bcee014 | blueswir1 | .max_cpus = 20,
|
1352 | 7d85892b | blueswir1 | }; |
1353 | 8137cde8 | blueswir1 | |
1354 | 8137cde8 | blueswir1 | static const struct sun4c_hwdef sun4c_hwdefs[] = { |
1355 | 8137cde8 | blueswir1 | /* SS-2 */
|
1356 | 8137cde8 | blueswir1 | { |
1357 | 8137cde8 | blueswir1 | .iommu_base = 0xf8000000,
|
1358 | 8137cde8 | blueswir1 | .tcx_base = 0xfe000000,
|
1359 | 8137cde8 | blueswir1 | .slavio_base = 0xf6000000,
|
1360 | 8137cde8 | blueswir1 | .intctl_base = 0xf5000000,
|
1361 | 8137cde8 | blueswir1 | .counter_base = 0xf3000000,
|
1362 | 8137cde8 | blueswir1 | .ms_kb_base = 0xf0000000,
|
1363 | 8137cde8 | blueswir1 | .serial_base = 0xf1000000,
|
1364 | 8137cde8 | blueswir1 | .nvram_base = 0xf2000000,
|
1365 | 8137cde8 | blueswir1 | .fd_base = 0xf7200000,
|
1366 | 8137cde8 | blueswir1 | .dma_base = 0xf8400000,
|
1367 | 8137cde8 | blueswir1 | .esp_base = 0xf8800000,
|
1368 | 8137cde8 | blueswir1 | .le_base = 0xf8c00000,
|
1369 | 8137cde8 | blueswir1 | .aux1_base = 0xf7400003,
|
1370 | 8137cde8 | blueswir1 | .vram_size = 0x00100000,
|
1371 | 8137cde8 | blueswir1 | .nvram_size = 0x800,
|
1372 | 8137cde8 | blueswir1 | .esp_irq = 2,
|
1373 | 8137cde8 | blueswir1 | .le_irq = 3,
|
1374 | 8137cde8 | blueswir1 | .clock_irq = 5,
|
1375 | 8137cde8 | blueswir1 | .clock1_irq = 7,
|
1376 | 8137cde8 | blueswir1 | .ms_kb_irq = 1,
|
1377 | 8137cde8 | blueswir1 | .ser_irq = 1,
|
1378 | 8137cde8 | blueswir1 | .fd_irq = 1,
|
1379 | 8137cde8 | blueswir1 | .me_irq = 1,
|
1380 | 8137cde8 | blueswir1 | .nvram_machine_id = 0x55,
|
1381 | 8137cde8 | blueswir1 | .machine_id = ss2_id, |
1382 | 8137cde8 | blueswir1 | .max_mem = 0x10000000,
|
1383 | 8137cde8 | blueswir1 | .default_cpu_model = "Cypress CY7C601",
|
1384 | 8137cde8 | blueswir1 | }, |
1385 | 8137cde8 | blueswir1 | }; |
1386 | 8137cde8 | blueswir1 | |
1387 | 8137cde8 | blueswir1 | static void sun4c_hw_init(const struct sun4c_hwdef *hwdef, ram_addr_t RAM_size, |
1388 | 8137cde8 | blueswir1 | const char *boot_device, |
1389 | 3023f332 | aliguori | const char *kernel_filename, |
1390 | 8137cde8 | blueswir1 | const char *kernel_cmdline, |
1391 | 8137cde8 | blueswir1 | const char *initrd_filename, const char *cpu_model) |
1392 | 8137cde8 | blueswir1 | { |
1393 | 8137cde8 | blueswir1 | CPUState *env; |
1394 | cfb9de9c | Paul Brook | void *iommu, *espdma, *ledma, *nvram;
|
1395 | 8137cde8 | blueswir1 | qemu_irq *cpu_irqs, *slavio_irq, *espdma_irq, *ledma_irq; |
1396 | 8137cde8 | blueswir1 | qemu_irq *esp_reset, *le_reset; |
1397 | 8137cde8 | blueswir1 | qemu_irq *fdc_tc; |
1398 | dc828ca1 | pbrook | ram_addr_t ram_offset, prom_offset; |
1399 | 5c6602c5 | blueswir1 | unsigned long kernel_size; |
1400 | 8137cde8 | blueswir1 | int ret;
|
1401 | 8137cde8 | blueswir1 | char buf[1024]; |
1402 | 8137cde8 | blueswir1 | BlockDriverState *fd[MAX_FD]; |
1403 | 8137cde8 | blueswir1 | int drive_index;
|
1404 | 8137cde8 | blueswir1 | void *fw_cfg;
|
1405 | 8137cde8 | blueswir1 | |
1406 | 8137cde8 | blueswir1 | /* init CPU */
|
1407 | 8137cde8 | blueswir1 | if (!cpu_model)
|
1408 | 8137cde8 | blueswir1 | cpu_model = hwdef->default_cpu_model; |
1409 | 8137cde8 | blueswir1 | |
1410 | 8137cde8 | blueswir1 | env = cpu_init(cpu_model); |
1411 | 8137cde8 | blueswir1 | if (!env) {
|
1412 | 8137cde8 | blueswir1 | fprintf(stderr, "qemu: Unable to find Sparc CPU definition\n");
|
1413 | 8137cde8 | blueswir1 | exit(1);
|
1414 | 8137cde8 | blueswir1 | } |
1415 | 8137cde8 | blueswir1 | |
1416 | 8137cde8 | blueswir1 | cpu_sparc_set_id(env, 0);
|
1417 | 8137cde8 | blueswir1 | |
1418 | 8137cde8 | blueswir1 | qemu_register_reset(main_cpu_reset, env); |
1419 | 8137cde8 | blueswir1 | cpu_irqs = qemu_allocate_irqs(cpu_set_irq, env, MAX_PILS); |
1420 | 8137cde8 | blueswir1 | env->prom_addr = hwdef->slavio_base; |
1421 | 8137cde8 | blueswir1 | |
1422 | 8137cde8 | blueswir1 | /* allocate RAM */
|
1423 | 8137cde8 | blueswir1 | if ((uint64_t)RAM_size > hwdef->max_mem) {
|
1424 | 8137cde8 | blueswir1 | fprintf(stderr, |
1425 | 8137cde8 | blueswir1 | "qemu: Too much memory for this machine: %d, maximum %d\n",
|
1426 | 8137cde8 | blueswir1 | (unsigned int)(RAM_size / (1024 * 1024)), |
1427 | 8137cde8 | blueswir1 | (unsigned int)(hwdef->max_mem / (1024 * 1024))); |
1428 | 8137cde8 | blueswir1 | exit(1);
|
1429 | 8137cde8 | blueswir1 | } |
1430 | 5c6602c5 | blueswir1 | ram_offset = qemu_ram_alloc(RAM_size); |
1431 | 5c6602c5 | blueswir1 | cpu_register_physical_memory(0, RAM_size, ram_offset);
|
1432 | 8137cde8 | blueswir1 | |
1433 | 8137cde8 | blueswir1 | /* load boot prom */
|
1434 | 5c6602c5 | blueswir1 | prom_offset = qemu_ram_alloc(PROM_SIZE_MAX); |
1435 | 8137cde8 | blueswir1 | cpu_register_physical_memory(hwdef->slavio_base, |
1436 | 8137cde8 | blueswir1 | (PROM_SIZE_MAX + TARGET_PAGE_SIZE - 1) &
|
1437 | 8137cde8 | blueswir1 | TARGET_PAGE_MASK, |
1438 | 8137cde8 | blueswir1 | prom_offset | IO_MEM_ROM); |
1439 | 8137cde8 | blueswir1 | |
1440 | 8137cde8 | blueswir1 | if (bios_name == NULL) |
1441 | 8137cde8 | blueswir1 | bios_name = PROM_FILENAME; |
1442 | 8137cde8 | blueswir1 | snprintf(buf, sizeof(buf), "%s/%s", bios_dir, bios_name); |
1443 | 8137cde8 | blueswir1 | ret = load_elf(buf, hwdef->slavio_base - PROM_VADDR, NULL, NULL, NULL); |
1444 | 8137cde8 | blueswir1 | if (ret < 0 || ret > PROM_SIZE_MAX) |
1445 | 8137cde8 | blueswir1 | ret = load_image_targphys(buf, hwdef->slavio_base, PROM_SIZE_MAX); |
1446 | 8137cde8 | blueswir1 | if (ret < 0 || ret > PROM_SIZE_MAX) { |
1447 | 8137cde8 | blueswir1 | fprintf(stderr, "qemu: could not load prom '%s'\n",
|
1448 | 8137cde8 | blueswir1 | buf); |
1449 | 8137cde8 | blueswir1 | exit(1);
|
1450 | 8137cde8 | blueswir1 | } |
1451 | 8137cde8 | blueswir1 | |
1452 | 8137cde8 | blueswir1 | /* set up devices */
|
1453 | 8137cde8 | blueswir1 | slavio_intctl = sun4c_intctl_init(hwdef->intctl_base, |
1454 | 8137cde8 | blueswir1 | &slavio_irq, cpu_irqs); |
1455 | 8137cde8 | blueswir1 | |
1456 | 8137cde8 | blueswir1 | iommu = iommu_init(hwdef->iommu_base, hwdef->iommu_version, |
1457 | 8137cde8 | blueswir1 | slavio_irq[hwdef->me_irq]); |
1458 | 8137cde8 | blueswir1 | |
1459 | 8137cde8 | blueswir1 | espdma = sparc32_dma_init(hwdef->dma_base, slavio_irq[hwdef->esp_irq], |
1460 | 8137cde8 | blueswir1 | iommu, &espdma_irq, &esp_reset); |
1461 | 8137cde8 | blueswir1 | |
1462 | 8137cde8 | blueswir1 | ledma = sparc32_dma_init(hwdef->dma_base + 16ULL,
|
1463 | 8137cde8 | blueswir1 | slavio_irq[hwdef->le_irq], iommu, &ledma_irq, |
1464 | 8137cde8 | blueswir1 | &le_reset); |
1465 | 8137cde8 | blueswir1 | |
1466 | 8137cde8 | blueswir1 | if (graphic_depth != 8 && graphic_depth != 24) { |
1467 | 8137cde8 | blueswir1 | fprintf(stderr, "qemu: Unsupported depth: %d\n", graphic_depth);
|
1468 | 8137cde8 | blueswir1 | exit (1);
|
1469 | 8137cde8 | blueswir1 | } |
1470 | dc828ca1 | pbrook | tcx_init(hwdef->tcx_base, hwdef->vram_size, graphic_width, graphic_height, |
1471 | dc828ca1 | pbrook | graphic_depth); |
1472 | 8137cde8 | blueswir1 | |
1473 | 0ae18cee | aliguori | lance_init(&nd_table[0], hwdef->le_base, ledma, *ledma_irq, le_reset);
|
1474 | 8137cde8 | blueswir1 | |
1475 | 8137cde8 | blueswir1 | nvram = m48t59_init(slavio_irq[0], hwdef->nvram_base, 0, |
1476 | 8137cde8 | blueswir1 | hwdef->nvram_size, 2);
|
1477 | 8137cde8 | blueswir1 | |
1478 | 8137cde8 | blueswir1 | slavio_serial_ms_kbd_init(hwdef->ms_kb_base, slavio_irq[hwdef->ms_kb_irq], |
1479 | b4ed08e0 | blueswir1 | nographic, ESCC_CLOCK, 1);
|
1480 | 8137cde8 | blueswir1 | // Slavio TTYA (base+4, Linux ttyS0) is the first Qemu serial device
|
1481 | 8137cde8 | blueswir1 | // Slavio TTYB (base+0, Linux ttyS1) is the second Qemu serial device
|
1482 | aeeb69c7 | aurel32 | escc_init(hwdef->serial_base, slavio_irq[hwdef->ser_irq], |
1483 | aeeb69c7 | aurel32 | slavio_irq[hwdef->ser_irq], serial_hds[0], serial_hds[1], |
1484 | aeeb69c7 | aurel32 | ESCC_CLOCK, 1);
|
1485 | 8137cde8 | blueswir1 | |
1486 | fe096129 | blueswir1 | slavio_misc = slavio_misc_init(0, 0, hwdef->aux1_base, 0, |
1487 | 6d0c293d | blueswir1 | slavio_irq[hwdef->me_irq], NULL, &fdc_tc);
|
1488 | 8137cde8 | blueswir1 | |
1489 | 8137cde8 | blueswir1 | if (hwdef->fd_base != (target_phys_addr_t)-1) { |
1490 | 8137cde8 | blueswir1 | /* there is zero or one floppy drive */
|
1491 | ce802585 | blueswir1 | memset(fd, 0, sizeof(fd)); |
1492 | 8137cde8 | blueswir1 | drive_index = drive_get_index(IF_FLOPPY, 0, 0); |
1493 | 8137cde8 | blueswir1 | if (drive_index != -1) |
1494 | 8137cde8 | blueswir1 | fd[0] = drives_table[drive_index].bdrv;
|
1495 | 8137cde8 | blueswir1 | |
1496 | 8137cde8 | blueswir1 | sun4m_fdctrl_init(slavio_irq[hwdef->fd_irq], hwdef->fd_base, fd, |
1497 | 8137cde8 | blueswir1 | fdc_tc); |
1498 | 8137cde8 | blueswir1 | } |
1499 | 8137cde8 | blueswir1 | |
1500 | 8137cde8 | blueswir1 | if (drive_get_max_bus(IF_SCSI) > 0) { |
1501 | 8137cde8 | blueswir1 | fprintf(stderr, "qemu: too many SCSI bus\n");
|
1502 | 8137cde8 | blueswir1 | exit(1);
|
1503 | 8137cde8 | blueswir1 | } |
1504 | 8137cde8 | blueswir1 | |
1505 | cfb9de9c | Paul Brook | esp_init(hwdef->esp_base, 2,
|
1506 | cfb9de9c | Paul Brook | espdma_memory_read, espdma_memory_write, |
1507 | cfb9de9c | Paul Brook | espdma, *espdma_irq, esp_reset); |
1508 | 8137cde8 | blueswir1 | |
1509 | 8137cde8 | blueswir1 | kernel_size = sun4m_load_kernel(kernel_filename, initrd_filename, |
1510 | 8137cde8 | blueswir1 | RAM_size); |
1511 | 8137cde8 | blueswir1 | |
1512 | 8137cde8 | blueswir1 | nvram_init(nvram, (uint8_t *)&nd_table[0].macaddr, kernel_cmdline,
|
1513 | 8137cde8 | blueswir1 | boot_device, RAM_size, kernel_size, graphic_width, |
1514 | 8137cde8 | blueswir1 | graphic_height, graphic_depth, hwdef->nvram_machine_id, |
1515 | 8137cde8 | blueswir1 | "Sun4c");
|
1516 | 8137cde8 | blueswir1 | |
1517 | 8137cde8 | blueswir1 | fw_cfg = fw_cfg_init(0, 0, CFG_ADDR, CFG_ADDR + 2); |
1518 | 8137cde8 | blueswir1 | fw_cfg_add_i32(fw_cfg, FW_CFG_ID, 1);
|
1519 | 8137cde8 | blueswir1 | fw_cfg_add_i64(fw_cfg, FW_CFG_RAM_SIZE, (uint64_t)ram_size); |
1520 | 8137cde8 | blueswir1 | fw_cfg_add_i16(fw_cfg, FW_CFG_MACHINE_ID, hwdef->machine_id); |
1521 | 513f789f | blueswir1 | fw_cfg_add_i16(fw_cfg, FW_CFG_SUN4M_DEPTH, graphic_depth); |
1522 | 513f789f | blueswir1 | fw_cfg_add_i32(fw_cfg, FW_CFG_KERNEL_ADDR, KERNEL_LOAD_ADDR); |
1523 | 513f789f | blueswir1 | fw_cfg_add_i32(fw_cfg, FW_CFG_KERNEL_SIZE, kernel_size); |
1524 | 513f789f | blueswir1 | if (kernel_cmdline) {
|
1525 | 513f789f | blueswir1 | fw_cfg_add_i32(fw_cfg, FW_CFG_KERNEL_CMDLINE, CMDLINE_ADDR); |
1526 | 513f789f | blueswir1 | pstrcpy_targphys(CMDLINE_ADDR, TARGET_PAGE_SIZE, kernel_cmdline); |
1527 | 513f789f | blueswir1 | } else {
|
1528 | 513f789f | blueswir1 | fw_cfg_add_i32(fw_cfg, FW_CFG_KERNEL_CMDLINE, 0);
|
1529 | 513f789f | blueswir1 | } |
1530 | 513f789f | blueswir1 | fw_cfg_add_i32(fw_cfg, FW_CFG_INITRD_ADDR, INITRD_LOAD_ADDR); |
1531 | 513f789f | blueswir1 | fw_cfg_add_i32(fw_cfg, FW_CFG_INITRD_SIZE, 0); // not used |
1532 | 513f789f | blueswir1 | fw_cfg_add_i16(fw_cfg, FW_CFG_BOOT_DEVICE, boot_device[0]);
|
1533 | 513f789f | blueswir1 | qemu_register_boot_set(fw_cfg_boot_set, fw_cfg); |
1534 | 8137cde8 | blueswir1 | } |
1535 | 8137cde8 | blueswir1 | |
1536 | 8137cde8 | blueswir1 | /* SPARCstation 2 hardware initialisation */
|
1537 | fbe1b595 | Paul Brook | static void ss2_init(ram_addr_t RAM_size, |
1538 | 3023f332 | aliguori | const char *boot_device, |
1539 | 8137cde8 | blueswir1 | const char *kernel_filename, const char *kernel_cmdline, |
1540 | 8137cde8 | blueswir1 | const char *initrd_filename, const char *cpu_model) |
1541 | 8137cde8 | blueswir1 | { |
1542 | 3023f332 | aliguori | sun4c_hw_init(&sun4c_hwdefs[0], RAM_size, boot_device, kernel_filename,
|
1543 | 8137cde8 | blueswir1 | kernel_cmdline, initrd_filename, cpu_model); |
1544 | 8137cde8 | blueswir1 | } |
1545 | 8137cde8 | blueswir1 | |
1546 | 8137cde8 | blueswir1 | QEMUMachine ss2_machine = { |
1547 | 8137cde8 | blueswir1 | .name = "SS-2",
|
1548 | 8137cde8 | blueswir1 | .desc = "Sun4c platform, SPARCstation 2",
|
1549 | 8137cde8 | blueswir1 | .init = ss2_init, |
1550 | 8137cde8 | blueswir1 | .use_scsi = 1,
|
1551 | 8137cde8 | blueswir1 | }; |