root / hw / sun4u.c @ 916452df
History | View | Annotate | Download (27 kB)
1 | 3475187d | bellard | /*
|
---|---|---|---|
2 | c7ba218d | blueswir1 | * QEMU Sun4u/Sun4v System Emulator
|
3 | 5fafdf24 | ths | *
|
4 | 3475187d | bellard | * Copyright (c) 2005 Fabrice Bellard
|
5 | 5fafdf24 | ths | *
|
6 | 3475187d | bellard | * Permission is hereby granted, free of charge, to any person obtaining a copy
|
7 | 3475187d | bellard | * of this software and associated documentation files (the "Software"), to deal
|
8 | 3475187d | bellard | * in the Software without restriction, including without limitation the rights
|
9 | 3475187d | bellard | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
10 | 3475187d | bellard | * copies of the Software, and to permit persons to whom the Software is
|
11 | 3475187d | bellard | * furnished to do so, subject to the following conditions:
|
12 | 3475187d | bellard | *
|
13 | 3475187d | bellard | * The above copyright notice and this permission notice shall be included in
|
14 | 3475187d | bellard | * all copies or substantial portions of the Software.
|
15 | 3475187d | bellard | *
|
16 | 3475187d | bellard | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17 | 3475187d | bellard | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18 | 3475187d | bellard | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
19 | 3475187d | bellard | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
20 | 3475187d | bellard | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21 | 3475187d | bellard | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
22 | 3475187d | bellard | * THE SOFTWARE.
|
23 | 3475187d | bellard | */
|
24 | 87ecb68b | pbrook | #include "hw.h" |
25 | 87ecb68b | pbrook | #include "pci.h" |
26 | 18e08a55 | Michael S. Tsirkin | #include "apb_pci.h" |
27 | 87ecb68b | pbrook | #include "pc.h" |
28 | 87ecb68b | pbrook | #include "nvram.h" |
29 | 87ecb68b | pbrook | #include "fdc.h" |
30 | 87ecb68b | pbrook | #include "net.h" |
31 | 87ecb68b | pbrook | #include "qemu-timer.h" |
32 | 87ecb68b | pbrook | #include "sysemu.h" |
33 | 87ecb68b | pbrook | #include "boards.h" |
34 | d2c63fc1 | blueswir1 | #include "firmware_abi.h" |
35 | 3cce6243 | blueswir1 | #include "fw_cfg.h" |
36 | 1baffa46 | Blue Swirl | #include "sysbus.h" |
37 | 977e1244 | Gerd Hoffmann | #include "ide.h" |
38 | ca20cf32 | Blue Swirl | #include "loader.h" |
39 | ca20cf32 | Blue Swirl | #include "elf.h" |
40 | 3475187d | bellard | |
41 | 9d926598 | blueswir1 | //#define DEBUG_IRQ
|
42 | b430a225 | Blue Swirl | //#define DEBUG_EBUS
|
43 | 8f4efc55 | Igor V. Kovalenko | //#define DEBUG_TIMER
|
44 | 9d926598 | blueswir1 | |
45 | 9d926598 | blueswir1 | #ifdef DEBUG_IRQ
|
46 | b430a225 | Blue Swirl | #define CPUIRQ_DPRINTF(fmt, ...) \
|
47 | 001faf32 | Blue Swirl | do { printf("CPUIRQ: " fmt , ## __VA_ARGS__); } while (0) |
48 | 9d926598 | blueswir1 | #else
|
49 | b430a225 | Blue Swirl | #define CPUIRQ_DPRINTF(fmt, ...)
|
50 | b430a225 | Blue Swirl | #endif
|
51 | b430a225 | Blue Swirl | |
52 | b430a225 | Blue Swirl | #ifdef DEBUG_EBUS
|
53 | b430a225 | Blue Swirl | #define EBUS_DPRINTF(fmt, ...) \
|
54 | b430a225 | Blue Swirl | do { printf("EBUS: " fmt , ## __VA_ARGS__); } while (0) |
55 | b430a225 | Blue Swirl | #else
|
56 | b430a225 | Blue Swirl | #define EBUS_DPRINTF(fmt, ...)
|
57 | 9d926598 | blueswir1 | #endif
|
58 | 9d926598 | blueswir1 | |
59 | 8f4efc55 | Igor V. Kovalenko | #ifdef DEBUG_TIMER
|
60 | 8f4efc55 | Igor V. Kovalenko | #define TIMER_DPRINTF(fmt, ...) \
|
61 | 8f4efc55 | Igor V. Kovalenko | do { printf("TIMER: " fmt , ## __VA_ARGS__); } while (0) |
62 | 8f4efc55 | Igor V. Kovalenko | #else
|
63 | 8f4efc55 | Igor V. Kovalenko | #define TIMER_DPRINTF(fmt, ...)
|
64 | 8f4efc55 | Igor V. Kovalenko | #endif
|
65 | 8f4efc55 | Igor V. Kovalenko | |
66 | 83469015 | bellard | #define KERNEL_LOAD_ADDR 0x00404000 |
67 | 83469015 | bellard | #define CMDLINE_ADDR 0x003ff000 |
68 | 83469015 | bellard | #define INITRD_LOAD_ADDR 0x00300000 |
69 | ac2e9d66 | blueswir1 | #define PROM_SIZE_MAX (4 * 1024 * 1024) |
70 | f930d07e | blueswir1 | #define PROM_VADDR 0x000ffd00000ULL |
71 | 83469015 | bellard | #define APB_SPECIAL_BASE 0x1fe00000000ULL |
72 | f930d07e | blueswir1 | #define APB_MEM_BASE 0x1ff00000000ULL |
73 | d63baf92 | Igor V. Kovalenko | #define APB_PCI_IO_BASE (APB_SPECIAL_BASE + 0x02000000ULL) |
74 | f930d07e | blueswir1 | #define PROM_FILENAME "openbios-sparc64" |
75 | 83469015 | bellard | #define NVRAM_SIZE 0x2000 |
76 | e4bcb14c | ths | #define MAX_IDE_BUS 2 |
77 | 3cce6243 | blueswir1 | #define BIOS_CFG_IOPORT 0x510 |
78 | 7589690c | Blue Swirl | #define FW_CFG_SPARC64_WIDTH (FW_CFG_ARCH_LOCAL + 0x00) |
79 | 7589690c | Blue Swirl | #define FW_CFG_SPARC64_HEIGHT (FW_CFG_ARCH_LOCAL + 0x01) |
80 | 7589690c | Blue Swirl | #define FW_CFG_SPARC64_DEPTH (FW_CFG_ARCH_LOCAL + 0x02) |
81 | 3475187d | bellard | |
82 | 9d926598 | blueswir1 | #define MAX_PILS 16 |
83 | 9d926598 | blueswir1 | |
84 | 8fa211e8 | blueswir1 | #define TICK_MAX 0x7fffffffffffffffULL |
85 | 8fa211e8 | blueswir1 | |
86 | c7ba218d | blueswir1 | struct hwdef {
|
87 | c7ba218d | blueswir1 | const char * const default_cpu_model; |
88 | 905fdcb5 | blueswir1 | uint16_t machine_id; |
89 | e87231d4 | blueswir1 | uint64_t prom_addr; |
90 | e87231d4 | blueswir1 | uint64_t console_serial_base; |
91 | c7ba218d | blueswir1 | }; |
92 | c7ba218d | blueswir1 | |
93 | 3475187d | bellard | int DMA_get_channel_mode (int nchan) |
94 | 3475187d | bellard | { |
95 | 3475187d | bellard | return 0; |
96 | 3475187d | bellard | } |
97 | 3475187d | bellard | int DMA_read_memory (int nchan, void *buf, int pos, int size) |
98 | 3475187d | bellard | { |
99 | 3475187d | bellard | return 0; |
100 | 3475187d | bellard | } |
101 | 3475187d | bellard | int DMA_write_memory (int nchan, void *buf, int pos, int size) |
102 | 3475187d | bellard | { |
103 | 3475187d | bellard | return 0; |
104 | 3475187d | bellard | } |
105 | 3475187d | bellard | void DMA_hold_DREQ (int nchan) {} |
106 | 3475187d | bellard | void DMA_release_DREQ (int nchan) {} |
107 | 3475187d | bellard | void DMA_schedule(int nchan) {} |
108 | 4556bd8b | Blue Swirl | |
109 | 4556bd8b | Blue Swirl | void DMA_init(int high_page_enable, qemu_irq *cpu_request_exit) |
110 | 4556bd8b | Blue Swirl | { |
111 | 4556bd8b | Blue Swirl | } |
112 | 4556bd8b | Blue Swirl | |
113 | 3475187d | bellard | void DMA_register_channel (int nchan, |
114 | 3475187d | bellard | DMA_transfer_handler transfer_handler, |
115 | 3475187d | bellard | void *opaque)
|
116 | 3475187d | bellard | { |
117 | 3475187d | bellard | } |
118 | 3475187d | bellard | |
119 | 513f789f | blueswir1 | static int fw_cfg_boot_set(void *opaque, const char *boot_device) |
120 | 81864572 | blueswir1 | { |
121 | 513f789f | blueswir1 | fw_cfg_add_i16(opaque, FW_CFG_BOOT_DEVICE, boot_device[0]);
|
122 | 81864572 | blueswir1 | return 0; |
123 | 81864572 | blueswir1 | } |
124 | 81864572 | blueswir1 | |
125 | 43a34704 | Blue Swirl | static int sun4u_NVRAM_set_params(M48t59State *nvram, uint16_t NVRAM_size, |
126 | 43a34704 | Blue Swirl | const char *arch, ram_addr_t RAM_size, |
127 | 43a34704 | Blue Swirl | const char *boot_devices, |
128 | 43a34704 | Blue Swirl | uint32_t kernel_image, uint32_t kernel_size, |
129 | 43a34704 | Blue Swirl | const char *cmdline, |
130 | 43a34704 | Blue Swirl | uint32_t initrd_image, uint32_t initrd_size, |
131 | 43a34704 | Blue Swirl | uint32_t NVRAM_image, |
132 | 43a34704 | Blue Swirl | int width, int height, int depth, |
133 | 43a34704 | Blue Swirl | const uint8_t *macaddr)
|
134 | 83469015 | bellard | { |
135 | 66508601 | blueswir1 | unsigned int i; |
136 | 66508601 | blueswir1 | uint32_t start, end; |
137 | d2c63fc1 | blueswir1 | uint8_t image[0x1ff0];
|
138 | d2c63fc1 | blueswir1 | struct OpenBIOS_nvpart_v1 *part_header;
|
139 | d2c63fc1 | blueswir1 | |
140 | d2c63fc1 | blueswir1 | memset(image, '\0', sizeof(image)); |
141 | d2c63fc1 | blueswir1 | |
142 | 513f789f | blueswir1 | start = 0;
|
143 | 83469015 | bellard | |
144 | 66508601 | blueswir1 | // OpenBIOS nvram variables
|
145 | 66508601 | blueswir1 | // Variable partition
|
146 | d2c63fc1 | blueswir1 | part_header = (struct OpenBIOS_nvpart_v1 *)&image[start];
|
147 | d2c63fc1 | blueswir1 | part_header->signature = OPENBIOS_PART_SYSTEM; |
148 | 363a37d5 | blueswir1 | pstrcpy(part_header->name, sizeof(part_header->name), "system"); |
149 | 66508601 | blueswir1 | |
150 | d2c63fc1 | blueswir1 | end = start + sizeof(struct OpenBIOS_nvpart_v1); |
151 | 66508601 | blueswir1 | for (i = 0; i < nb_prom_envs; i++) |
152 | d2c63fc1 | blueswir1 | end = OpenBIOS_set_var(image, end, prom_envs[i]); |
153 | d2c63fc1 | blueswir1 | |
154 | d2c63fc1 | blueswir1 | // End marker
|
155 | d2c63fc1 | blueswir1 | image[end++] = '\0';
|
156 | 66508601 | blueswir1 | |
157 | 66508601 | blueswir1 | end = start + ((end - start + 15) & ~15); |
158 | d2c63fc1 | blueswir1 | OpenBIOS_finish_partition(part_header, end - start); |
159 | 66508601 | blueswir1 | |
160 | 66508601 | blueswir1 | // free partition
|
161 | 66508601 | blueswir1 | start = end; |
162 | d2c63fc1 | blueswir1 | part_header = (struct OpenBIOS_nvpart_v1 *)&image[start];
|
163 | d2c63fc1 | blueswir1 | part_header->signature = OPENBIOS_PART_FREE; |
164 | 363a37d5 | blueswir1 | pstrcpy(part_header->name, sizeof(part_header->name), "free"); |
165 | 66508601 | blueswir1 | |
166 | 66508601 | blueswir1 | end = 0x1fd0;
|
167 | d2c63fc1 | blueswir1 | OpenBIOS_finish_partition(part_header, end - start); |
168 | d2c63fc1 | blueswir1 | |
169 | 0d31cb99 | blueswir1 | Sun_init_header((struct Sun_nvram *)&image[0x1fd8], macaddr, 0x80); |
170 | 0d31cb99 | blueswir1 | |
171 | d2c63fc1 | blueswir1 | for (i = 0; i < sizeof(image); i++) |
172 | d2c63fc1 | blueswir1 | m48t59_write(nvram, i, image[i]); |
173 | 66508601 | blueswir1 | |
174 | 83469015 | bellard | return 0; |
175 | 3475187d | bellard | } |
176 | 636aa70a | Blue Swirl | static unsigned long sun4u_load_kernel(const char *kernel_filename, |
177 | 636aa70a | Blue Swirl | const char *initrd_filename, |
178 | c227f099 | Anthony Liguori | ram_addr_t RAM_size, long *initrd_size)
|
179 | 636aa70a | Blue Swirl | { |
180 | 636aa70a | Blue Swirl | int linux_boot;
|
181 | 636aa70a | Blue Swirl | unsigned int i; |
182 | 636aa70a | Blue Swirl | long kernel_size;
|
183 | 6908d9ce | Blue Swirl | uint8_t *ptr; |
184 | 636aa70a | Blue Swirl | |
185 | 636aa70a | Blue Swirl | linux_boot = (kernel_filename != NULL);
|
186 | 636aa70a | Blue Swirl | |
187 | 636aa70a | Blue Swirl | kernel_size = 0;
|
188 | 636aa70a | Blue Swirl | if (linux_boot) {
|
189 | ca20cf32 | Blue Swirl | int bswap_needed;
|
190 | ca20cf32 | Blue Swirl | |
191 | ca20cf32 | Blue Swirl | #ifdef BSWAP_NEEDED
|
192 | ca20cf32 | Blue Swirl | bswap_needed = 1;
|
193 | ca20cf32 | Blue Swirl | #else
|
194 | ca20cf32 | Blue Swirl | bswap_needed = 0;
|
195 | ca20cf32 | Blue Swirl | #endif
|
196 | 409dbce5 | Aurelien Jarno | kernel_size = load_elf(kernel_filename, NULL, NULL, NULL, |
197 | 409dbce5 | Aurelien Jarno | NULL, NULL, 1, ELF_MACHINE, 0); |
198 | 636aa70a | Blue Swirl | if (kernel_size < 0) |
199 | 636aa70a | Blue Swirl | kernel_size = load_aout(kernel_filename, KERNEL_LOAD_ADDR, |
200 | ca20cf32 | Blue Swirl | RAM_size - KERNEL_LOAD_ADDR, bswap_needed, |
201 | ca20cf32 | Blue Swirl | TARGET_PAGE_SIZE); |
202 | 636aa70a | Blue Swirl | if (kernel_size < 0) |
203 | 636aa70a | Blue Swirl | kernel_size = load_image_targphys(kernel_filename, |
204 | 636aa70a | Blue Swirl | KERNEL_LOAD_ADDR, |
205 | 636aa70a | Blue Swirl | RAM_size - KERNEL_LOAD_ADDR); |
206 | 636aa70a | Blue Swirl | if (kernel_size < 0) { |
207 | 636aa70a | Blue Swirl | fprintf(stderr, "qemu: could not load kernel '%s'\n",
|
208 | 636aa70a | Blue Swirl | kernel_filename); |
209 | 636aa70a | Blue Swirl | exit(1);
|
210 | 636aa70a | Blue Swirl | } |
211 | 636aa70a | Blue Swirl | |
212 | 636aa70a | Blue Swirl | /* load initrd */
|
213 | 636aa70a | Blue Swirl | *initrd_size = 0;
|
214 | 636aa70a | Blue Swirl | if (initrd_filename) {
|
215 | 636aa70a | Blue Swirl | *initrd_size = load_image_targphys(initrd_filename, |
216 | 636aa70a | Blue Swirl | INITRD_LOAD_ADDR, |
217 | 636aa70a | Blue Swirl | RAM_size - INITRD_LOAD_ADDR); |
218 | 636aa70a | Blue Swirl | if (*initrd_size < 0) { |
219 | 636aa70a | Blue Swirl | fprintf(stderr, "qemu: could not load initial ram disk '%s'\n",
|
220 | 636aa70a | Blue Swirl | initrd_filename); |
221 | 636aa70a | Blue Swirl | exit(1);
|
222 | 636aa70a | Blue Swirl | } |
223 | 636aa70a | Blue Swirl | } |
224 | 636aa70a | Blue Swirl | if (*initrd_size > 0) { |
225 | 636aa70a | Blue Swirl | for (i = 0; i < 64 * TARGET_PAGE_SIZE; i += TARGET_PAGE_SIZE) { |
226 | 6908d9ce | Blue Swirl | ptr = rom_ptr(KERNEL_LOAD_ADDR + i); |
227 | 6908d9ce | Blue Swirl | if (ldl_p(ptr + 8) == 0x48647253) { /* HdrS */ |
228 | 6908d9ce | Blue Swirl | stl_p(ptr + 24, INITRD_LOAD_ADDR + KERNEL_LOAD_ADDR - 0x4000); |
229 | 6908d9ce | Blue Swirl | stl_p(ptr + 28, *initrd_size);
|
230 | 636aa70a | Blue Swirl | break;
|
231 | 636aa70a | Blue Swirl | } |
232 | 636aa70a | Blue Swirl | } |
233 | 636aa70a | Blue Swirl | } |
234 | 636aa70a | Blue Swirl | } |
235 | 636aa70a | Blue Swirl | return kernel_size;
|
236 | 636aa70a | Blue Swirl | } |
237 | 3475187d | bellard | |
238 | b4950060 | blueswir1 | void pic_info(Monitor *mon)
|
239 | 3475187d | bellard | { |
240 | 3475187d | bellard | } |
241 | 3475187d | bellard | |
242 | b4950060 | blueswir1 | void irq_info(Monitor *mon)
|
243 | 3475187d | bellard | { |
244 | 3475187d | bellard | } |
245 | 3475187d | bellard | |
246 | 9d926598 | blueswir1 | void cpu_check_irqs(CPUState *env)
|
247 | 9d926598 | blueswir1 | { |
248 | d532b26c | Igor V. Kovalenko | uint32_t pil = env->pil_in | |
249 | d532b26c | Igor V. Kovalenko | (env->softint & ~(SOFTINT_TIMER | SOFTINT_STIMER)); |
250 | d532b26c | Igor V. Kovalenko | |
251 | d532b26c | Igor V. Kovalenko | /* check if TM or SM in SOFTINT are set
|
252 | d532b26c | Igor V. Kovalenko | setting these also causes interrupt 14 */
|
253 | d532b26c | Igor V. Kovalenko | if (env->softint & (SOFTINT_TIMER | SOFTINT_STIMER)) {
|
254 | d532b26c | Igor V. Kovalenko | pil |= 1 << 14; |
255 | d532b26c | Igor V. Kovalenko | } |
256 | d532b26c | Igor V. Kovalenko | |
257 | d532b26c | Igor V. Kovalenko | if (!pil) {
|
258 | d532b26c | Igor V. Kovalenko | if (env->interrupt_request & CPU_INTERRUPT_HARD) {
|
259 | d532b26c | Igor V. Kovalenko | CPUIRQ_DPRINTF("Reset CPU IRQ (current interrupt %x)\n",
|
260 | d532b26c | Igor V. Kovalenko | env->interrupt_index); |
261 | d532b26c | Igor V. Kovalenko | env->interrupt_index = 0;
|
262 | d532b26c | Igor V. Kovalenko | cpu_reset_interrupt(env, CPU_INTERRUPT_HARD); |
263 | d532b26c | Igor V. Kovalenko | } |
264 | d532b26c | Igor V. Kovalenko | return;
|
265 | d532b26c | Igor V. Kovalenko | } |
266 | d532b26c | Igor V. Kovalenko | |
267 | d532b26c | Igor V. Kovalenko | if (cpu_interrupts_enabled(env)) {
|
268 | 9d926598 | blueswir1 | |
269 | 9d926598 | blueswir1 | unsigned int i; |
270 | 9d926598 | blueswir1 | |
271 | d532b26c | Igor V. Kovalenko | for (i = 15; i > env->psrpil; i--) { |
272 | 9d926598 | blueswir1 | if (pil & (1 << i)) { |
273 | 9d926598 | blueswir1 | int old_interrupt = env->interrupt_index;
|
274 | d532b26c | Igor V. Kovalenko | int new_interrupt = TT_EXTINT | i;
|
275 | d532b26c | Igor V. Kovalenko | |
276 | d532b26c | Igor V. Kovalenko | if (env->tl > 0 && cpu_tsptr(env)->tt > new_interrupt) { |
277 | d532b26c | Igor V. Kovalenko | CPUIRQ_DPRINTF("Not setting CPU IRQ: TL=%d "
|
278 | d532b26c | Igor V. Kovalenko | "current %x >= pending %x\n",
|
279 | d532b26c | Igor V. Kovalenko | env->tl, cpu_tsptr(env)->tt, new_interrupt); |
280 | d532b26c | Igor V. Kovalenko | } else if (old_interrupt != new_interrupt) { |
281 | d532b26c | Igor V. Kovalenko | env->interrupt_index = new_interrupt; |
282 | d532b26c | Igor V. Kovalenko | CPUIRQ_DPRINTF("Set CPU IRQ %d old=%x new=%x\n", i,
|
283 | d532b26c | Igor V. Kovalenko | old_interrupt, new_interrupt); |
284 | 9d926598 | blueswir1 | cpu_interrupt(env, CPU_INTERRUPT_HARD); |
285 | 9d926598 | blueswir1 | } |
286 | 9d926598 | blueswir1 | break;
|
287 | 9d926598 | blueswir1 | } |
288 | 9d926598 | blueswir1 | } |
289 | d532b26c | Igor V. Kovalenko | } else {
|
290 | d532b26c | Igor V. Kovalenko | CPUIRQ_DPRINTF("Interrupts disabled, pil=%08x pil_in=%08x softint=%08x "
|
291 | d532b26c | Igor V. Kovalenko | "current interrupt %x\n",
|
292 | d532b26c | Igor V. Kovalenko | pil, env->pil_in, env->softint, env->interrupt_index); |
293 | 9d926598 | blueswir1 | } |
294 | 9d926598 | blueswir1 | } |
295 | 9d926598 | blueswir1 | |
296 | 8f4efc55 | Igor V. Kovalenko | static void cpu_kick_irq(CPUState *env) |
297 | 8f4efc55 | Igor V. Kovalenko | { |
298 | 8f4efc55 | Igor V. Kovalenko | env->halted = 0;
|
299 | 8f4efc55 | Igor V. Kovalenko | cpu_check_irqs(env); |
300 | 8f4efc55 | Igor V. Kovalenko | } |
301 | 8f4efc55 | Igor V. Kovalenko | |
302 | 9d926598 | blueswir1 | static void cpu_set_irq(void *opaque, int irq, int level) |
303 | 9d926598 | blueswir1 | { |
304 | 9d926598 | blueswir1 | CPUState *env = opaque; |
305 | 9d926598 | blueswir1 | |
306 | 9d926598 | blueswir1 | if (level) {
|
307 | b430a225 | Blue Swirl | CPUIRQ_DPRINTF("Raise CPU IRQ %d\n", irq);
|
308 | 9d926598 | blueswir1 | env->halted = 0;
|
309 | 9d926598 | blueswir1 | env->pil_in |= 1 << irq;
|
310 | 9d926598 | blueswir1 | cpu_check_irqs(env); |
311 | 9d926598 | blueswir1 | } else {
|
312 | b430a225 | Blue Swirl | CPUIRQ_DPRINTF("Lower CPU IRQ %d\n", irq);
|
313 | 9d926598 | blueswir1 | env->pil_in &= ~(1 << irq);
|
314 | 9d926598 | blueswir1 | cpu_check_irqs(env); |
315 | 9d926598 | blueswir1 | } |
316 | 9d926598 | blueswir1 | } |
317 | 9d926598 | blueswir1 | |
318 | e87231d4 | blueswir1 | typedef struct ResetData { |
319 | e87231d4 | blueswir1 | CPUState *env; |
320 | 44a99354 | Blue Swirl | uint64_t prom_addr; |
321 | e87231d4 | blueswir1 | } ResetData; |
322 | e87231d4 | blueswir1 | |
323 | 8f4efc55 | Igor V. Kovalenko | void cpu_put_timer(QEMUFile *f, CPUTimer *s)
|
324 | 8f4efc55 | Igor V. Kovalenko | { |
325 | 8f4efc55 | Igor V. Kovalenko | qemu_put_be32s(f, &s->frequency); |
326 | 8f4efc55 | Igor V. Kovalenko | qemu_put_be32s(f, &s->disabled); |
327 | 8f4efc55 | Igor V. Kovalenko | qemu_put_be64s(f, &s->disabled_mask); |
328 | 8f4efc55 | Igor V. Kovalenko | qemu_put_sbe64s(f, &s->clock_offset); |
329 | 8f4efc55 | Igor V. Kovalenko | |
330 | 8f4efc55 | Igor V. Kovalenko | qemu_put_timer(f, s->qtimer); |
331 | 8f4efc55 | Igor V. Kovalenko | } |
332 | 8f4efc55 | Igor V. Kovalenko | |
333 | 8f4efc55 | Igor V. Kovalenko | void cpu_get_timer(QEMUFile *f, CPUTimer *s)
|
334 | 8f4efc55 | Igor V. Kovalenko | { |
335 | 8f4efc55 | Igor V. Kovalenko | qemu_get_be32s(f, &s->frequency); |
336 | 8f4efc55 | Igor V. Kovalenko | qemu_get_be32s(f, &s->disabled); |
337 | 8f4efc55 | Igor V. Kovalenko | qemu_get_be64s(f, &s->disabled_mask); |
338 | 8f4efc55 | Igor V. Kovalenko | qemu_get_sbe64s(f, &s->clock_offset); |
339 | 8f4efc55 | Igor V. Kovalenko | |
340 | 8f4efc55 | Igor V. Kovalenko | qemu_get_timer(f, s->qtimer); |
341 | 8f4efc55 | Igor V. Kovalenko | } |
342 | 8f4efc55 | Igor V. Kovalenko | |
343 | 8f4efc55 | Igor V. Kovalenko | static CPUTimer* cpu_timer_create(const char* name, CPUState *env, |
344 | 8f4efc55 | Igor V. Kovalenko | QEMUBHFunc *cb, uint32_t frequency, |
345 | 8f4efc55 | Igor V. Kovalenko | uint64_t disabled_mask) |
346 | 8f4efc55 | Igor V. Kovalenko | { |
347 | 8f4efc55 | Igor V. Kovalenko | CPUTimer *timer = qemu_mallocz(sizeof (CPUTimer));
|
348 | 8f4efc55 | Igor V. Kovalenko | |
349 | 8f4efc55 | Igor V. Kovalenko | timer->name = name; |
350 | 8f4efc55 | Igor V. Kovalenko | timer->frequency = frequency; |
351 | 8f4efc55 | Igor V. Kovalenko | timer->disabled_mask = disabled_mask; |
352 | 8f4efc55 | Igor V. Kovalenko | |
353 | 8f4efc55 | Igor V. Kovalenko | timer->disabled = 1;
|
354 | 8f4efc55 | Igor V. Kovalenko | timer->clock_offset = qemu_get_clock(vm_clock); |
355 | 8f4efc55 | Igor V. Kovalenko | |
356 | 8f4efc55 | Igor V. Kovalenko | timer->qtimer = qemu_new_timer(vm_clock, cb, env); |
357 | 8f4efc55 | Igor V. Kovalenko | |
358 | 8f4efc55 | Igor V. Kovalenko | return timer;
|
359 | 8f4efc55 | Igor V. Kovalenko | } |
360 | 8f4efc55 | Igor V. Kovalenko | |
361 | 8f4efc55 | Igor V. Kovalenko | static void cpu_timer_reset(CPUTimer *timer) |
362 | 8f4efc55 | Igor V. Kovalenko | { |
363 | 8f4efc55 | Igor V. Kovalenko | timer->disabled = 1;
|
364 | 8f4efc55 | Igor V. Kovalenko | timer->clock_offset = qemu_get_clock(vm_clock); |
365 | 8f4efc55 | Igor V. Kovalenko | |
366 | 8f4efc55 | Igor V. Kovalenko | qemu_del_timer(timer->qtimer); |
367 | 8f4efc55 | Igor V. Kovalenko | } |
368 | 8f4efc55 | Igor V. Kovalenko | |
369 | c68ea704 | bellard | static void main_cpu_reset(void *opaque) |
370 | c68ea704 | bellard | { |
371 | e87231d4 | blueswir1 | ResetData *s = (ResetData *)opaque; |
372 | e87231d4 | blueswir1 | CPUState *env = s->env; |
373 | 44a99354 | Blue Swirl | static unsigned int nr_resets; |
374 | 20c9f095 | blueswir1 | |
375 | c68ea704 | bellard | cpu_reset(env); |
376 | 8f4efc55 | Igor V. Kovalenko | |
377 | 8f4efc55 | Igor V. Kovalenko | cpu_timer_reset(env->tick); |
378 | 8f4efc55 | Igor V. Kovalenko | cpu_timer_reset(env->stick); |
379 | 8f4efc55 | Igor V. Kovalenko | cpu_timer_reset(env->hstick); |
380 | 8f4efc55 | Igor V. Kovalenko | |
381 | e87231d4 | blueswir1 | env->gregs[1] = 0; // Memory start |
382 | e87231d4 | blueswir1 | env->gregs[2] = ram_size; // Memory size |
383 | e87231d4 | blueswir1 | env->gregs[3] = 0; // Machine description XXX |
384 | 44a99354 | Blue Swirl | if (nr_resets++ == 0) { |
385 | 44a99354 | Blue Swirl | /* Power on reset */
|
386 | 44a99354 | Blue Swirl | env->pc = s->prom_addr + 0x20ULL;
|
387 | 44a99354 | Blue Swirl | } else {
|
388 | 44a99354 | Blue Swirl | env->pc = s->prom_addr + 0x40ULL;
|
389 | 44a99354 | Blue Swirl | } |
390 | e87231d4 | blueswir1 | env->npc = env->pc + 4;
|
391 | 20c9f095 | blueswir1 | } |
392 | 20c9f095 | blueswir1 | |
393 | 22548760 | blueswir1 | static void tick_irq(void *opaque) |
394 | 20c9f095 | blueswir1 | { |
395 | 20c9f095 | blueswir1 | CPUState *env = opaque; |
396 | 20c9f095 | blueswir1 | |
397 | 8f4efc55 | Igor V. Kovalenko | CPUTimer* timer = env->tick; |
398 | 8f4efc55 | Igor V. Kovalenko | |
399 | 8f4efc55 | Igor V. Kovalenko | if (timer->disabled) {
|
400 | 8f4efc55 | Igor V. Kovalenko | CPUIRQ_DPRINTF("tick_irq: softint disabled\n");
|
401 | 8f4efc55 | Igor V. Kovalenko | return;
|
402 | 8f4efc55 | Igor V. Kovalenko | } else {
|
403 | 8f4efc55 | Igor V. Kovalenko | CPUIRQ_DPRINTF("tick: fire\n");
|
404 | 8fa211e8 | blueswir1 | } |
405 | 8f4efc55 | Igor V. Kovalenko | |
406 | 8f4efc55 | Igor V. Kovalenko | env->softint |= SOFTINT_TIMER; |
407 | 8f4efc55 | Igor V. Kovalenko | cpu_kick_irq(env); |
408 | 20c9f095 | blueswir1 | } |
409 | 20c9f095 | blueswir1 | |
410 | 22548760 | blueswir1 | static void stick_irq(void *opaque) |
411 | 20c9f095 | blueswir1 | { |
412 | 20c9f095 | blueswir1 | CPUState *env = opaque; |
413 | 20c9f095 | blueswir1 | |
414 | 8f4efc55 | Igor V. Kovalenko | CPUTimer* timer = env->stick; |
415 | 8f4efc55 | Igor V. Kovalenko | |
416 | 8f4efc55 | Igor V. Kovalenko | if (timer->disabled) {
|
417 | 8f4efc55 | Igor V. Kovalenko | CPUIRQ_DPRINTF("stick_irq: softint disabled\n");
|
418 | 8f4efc55 | Igor V. Kovalenko | return;
|
419 | 8f4efc55 | Igor V. Kovalenko | } else {
|
420 | 8f4efc55 | Igor V. Kovalenko | CPUIRQ_DPRINTF("stick: fire\n");
|
421 | 8fa211e8 | blueswir1 | } |
422 | 8f4efc55 | Igor V. Kovalenko | |
423 | 8f4efc55 | Igor V. Kovalenko | env->softint |= SOFTINT_STIMER; |
424 | 8f4efc55 | Igor V. Kovalenko | cpu_kick_irq(env); |
425 | 20c9f095 | blueswir1 | } |
426 | 20c9f095 | blueswir1 | |
427 | 22548760 | blueswir1 | static void hstick_irq(void *opaque) |
428 | 20c9f095 | blueswir1 | { |
429 | 20c9f095 | blueswir1 | CPUState *env = opaque; |
430 | 20c9f095 | blueswir1 | |
431 | 8f4efc55 | Igor V. Kovalenko | CPUTimer* timer = env->hstick; |
432 | 8f4efc55 | Igor V. Kovalenko | |
433 | 8f4efc55 | Igor V. Kovalenko | if (timer->disabled) {
|
434 | 8f4efc55 | Igor V. Kovalenko | CPUIRQ_DPRINTF("hstick_irq: softint disabled\n");
|
435 | 8f4efc55 | Igor V. Kovalenko | return;
|
436 | 8f4efc55 | Igor V. Kovalenko | } else {
|
437 | 8f4efc55 | Igor V. Kovalenko | CPUIRQ_DPRINTF("hstick: fire\n");
|
438 | 8fa211e8 | blueswir1 | } |
439 | 8f4efc55 | Igor V. Kovalenko | |
440 | 8f4efc55 | Igor V. Kovalenko | env->softint |= SOFTINT_STIMER; |
441 | 8f4efc55 | Igor V. Kovalenko | cpu_kick_irq(env); |
442 | 8f4efc55 | Igor V. Kovalenko | } |
443 | 8f4efc55 | Igor V. Kovalenko | |
444 | 8f4efc55 | Igor V. Kovalenko | static int64_t cpu_to_timer_ticks(int64_t cpu_ticks, uint32_t frequency)
|
445 | 8f4efc55 | Igor V. Kovalenko | { |
446 | 8f4efc55 | Igor V. Kovalenko | return muldiv64(cpu_ticks, get_ticks_per_sec(), frequency);
|
447 | 8f4efc55 | Igor V. Kovalenko | } |
448 | 8f4efc55 | Igor V. Kovalenko | |
449 | 8f4efc55 | Igor V. Kovalenko | static uint64_t timer_to_cpu_ticks(int64_t timer_ticks, uint32_t frequency)
|
450 | 8f4efc55 | Igor V. Kovalenko | { |
451 | 8f4efc55 | Igor V. Kovalenko | return muldiv64(timer_ticks, frequency, get_ticks_per_sec());
|
452 | c68ea704 | bellard | } |
453 | c68ea704 | bellard | |
454 | 8f4efc55 | Igor V. Kovalenko | void cpu_tick_set_count(CPUTimer *timer, uint64_t count)
|
455 | f4b1a842 | blueswir1 | { |
456 | 8f4efc55 | Igor V. Kovalenko | uint64_t real_count = count & ~timer->disabled_mask; |
457 | 8f4efc55 | Igor V. Kovalenko | uint64_t disabled_bit = count & timer->disabled_mask; |
458 | 8f4efc55 | Igor V. Kovalenko | |
459 | 8f4efc55 | Igor V. Kovalenko | int64_t vm_clock_offset = qemu_get_clock(vm_clock) - |
460 | 8f4efc55 | Igor V. Kovalenko | cpu_to_timer_ticks(real_count, timer->frequency); |
461 | 8f4efc55 | Igor V. Kovalenko | |
462 | 8f4efc55 | Igor V. Kovalenko | TIMER_DPRINTF("%s set_count count=0x%016lx (%s) p=%p\n",
|
463 | 8f4efc55 | Igor V. Kovalenko | timer->name, real_count, |
464 | 8f4efc55 | Igor V. Kovalenko | timer->disabled?"disabled":"enabled", timer); |
465 | 8f4efc55 | Igor V. Kovalenko | |
466 | 8f4efc55 | Igor V. Kovalenko | timer->disabled = disabled_bit ? 1 : 0; |
467 | 8f4efc55 | Igor V. Kovalenko | timer->clock_offset = vm_clock_offset; |
468 | f4b1a842 | blueswir1 | } |
469 | f4b1a842 | blueswir1 | |
470 | 8f4efc55 | Igor V. Kovalenko | uint64_t cpu_tick_get_count(CPUTimer *timer) |
471 | f4b1a842 | blueswir1 | { |
472 | 8f4efc55 | Igor V. Kovalenko | uint64_t real_count = timer_to_cpu_ticks( |
473 | 8f4efc55 | Igor V. Kovalenko | qemu_get_clock(vm_clock) - timer->clock_offset, |
474 | 8f4efc55 | Igor V. Kovalenko | timer->frequency); |
475 | 8f4efc55 | Igor V. Kovalenko | |
476 | 8f4efc55 | Igor V. Kovalenko | TIMER_DPRINTF("%s get_count count=0x%016lx (%s) p=%p\n",
|
477 | 8f4efc55 | Igor V. Kovalenko | timer->name, real_count, |
478 | 8f4efc55 | Igor V. Kovalenko | timer->disabled?"disabled":"enabled", timer); |
479 | 8f4efc55 | Igor V. Kovalenko | |
480 | 8f4efc55 | Igor V. Kovalenko | if (timer->disabled)
|
481 | 8f4efc55 | Igor V. Kovalenko | real_count |= timer->disabled_mask; |
482 | 8f4efc55 | Igor V. Kovalenko | |
483 | 8f4efc55 | Igor V. Kovalenko | return real_count;
|
484 | f4b1a842 | blueswir1 | } |
485 | f4b1a842 | blueswir1 | |
486 | 8f4efc55 | Igor V. Kovalenko | void cpu_tick_set_limit(CPUTimer *timer, uint64_t limit)
|
487 | f4b1a842 | blueswir1 | { |
488 | 8f4efc55 | Igor V. Kovalenko | int64_t now = qemu_get_clock(vm_clock); |
489 | 8f4efc55 | Igor V. Kovalenko | |
490 | 8f4efc55 | Igor V. Kovalenko | uint64_t real_limit = limit & ~timer->disabled_mask; |
491 | 8f4efc55 | Igor V. Kovalenko | timer->disabled = (limit & timer->disabled_mask) ? 1 : 0; |
492 | 8f4efc55 | Igor V. Kovalenko | |
493 | 8f4efc55 | Igor V. Kovalenko | int64_t expires = cpu_to_timer_ticks(real_limit, timer->frequency) + |
494 | 8f4efc55 | Igor V. Kovalenko | timer->clock_offset; |
495 | 8f4efc55 | Igor V. Kovalenko | |
496 | 8f4efc55 | Igor V. Kovalenko | if (expires < now) {
|
497 | 8f4efc55 | Igor V. Kovalenko | expires = now + 1;
|
498 | 8f4efc55 | Igor V. Kovalenko | } |
499 | 8f4efc55 | Igor V. Kovalenko | |
500 | 8f4efc55 | Igor V. Kovalenko | TIMER_DPRINTF("%s set_limit limit=0x%016lx (%s) p=%p "
|
501 | 8f4efc55 | Igor V. Kovalenko | "called with limit=0x%016lx at 0x%016lx (delta=0x%016lx)\n",
|
502 | 8f4efc55 | Igor V. Kovalenko | timer->name, real_limit, |
503 | 8f4efc55 | Igor V. Kovalenko | timer->disabled?"disabled":"enabled", |
504 | 8f4efc55 | Igor V. Kovalenko | timer, limit, |
505 | 8f4efc55 | Igor V. Kovalenko | timer_to_cpu_ticks(now - timer->clock_offset, |
506 | 8f4efc55 | Igor V. Kovalenko | timer->frequency), |
507 | 8f4efc55 | Igor V. Kovalenko | timer_to_cpu_ticks(expires - now, timer->frequency)); |
508 | 8f4efc55 | Igor V. Kovalenko | |
509 | 8f4efc55 | Igor V. Kovalenko | if (!real_limit) {
|
510 | 8f4efc55 | Igor V. Kovalenko | TIMER_DPRINTF("%s set_limit limit=ZERO - not starting timer\n",
|
511 | 8f4efc55 | Igor V. Kovalenko | timer->name); |
512 | 8f4efc55 | Igor V. Kovalenko | qemu_del_timer(timer->qtimer); |
513 | 8f4efc55 | Igor V. Kovalenko | } else if (timer->disabled) { |
514 | 8f4efc55 | Igor V. Kovalenko | qemu_del_timer(timer->qtimer); |
515 | 8f4efc55 | Igor V. Kovalenko | } else {
|
516 | 8f4efc55 | Igor V. Kovalenko | qemu_mod_timer(timer->qtimer, expires); |
517 | 8f4efc55 | Igor V. Kovalenko | } |
518 | f4b1a842 | blueswir1 | } |
519 | f4b1a842 | blueswir1 | |
520 | c190ea07 | blueswir1 | static void ebus_mmio_mapfunc(PCIDevice *pci_dev, int region_num, |
521 | 6e355d90 | Isaku Yamahata | pcibus_t addr, pcibus_t size, int type)
|
522 | c190ea07 | blueswir1 | { |
523 | b430a225 | Blue Swirl | EBUS_DPRINTF("Mapping region %d registers at %" FMT_PCIBUS "\n", |
524 | b430a225 | Blue Swirl | region_num, addr); |
525 | c190ea07 | blueswir1 | switch (region_num) {
|
526 | c190ea07 | blueswir1 | case 0: |
527 | 84108e12 | Blue Swirl | isa_mmio_init(addr, 0x1000000, 1); |
528 | c190ea07 | blueswir1 | break;
|
529 | c190ea07 | blueswir1 | case 1: |
530 | 84108e12 | Blue Swirl | isa_mmio_init(addr, 0x800000, 1); |
531 | c190ea07 | blueswir1 | break;
|
532 | c190ea07 | blueswir1 | } |
533 | c190ea07 | blueswir1 | } |
534 | c190ea07 | blueswir1 | |
535 | 1387fe4a | Blue Swirl | static void dummy_isa_irq_handler(void *opaque, int n, int level) |
536 | 1387fe4a | Blue Swirl | { |
537 | 1387fe4a | Blue Swirl | } |
538 | 1387fe4a | Blue Swirl | |
539 | c190ea07 | blueswir1 | /* EBUS (Eight bit bus) bridge */
|
540 | c190ea07 | blueswir1 | static void |
541 | c190ea07 | blueswir1 | pci_ebus_init(PCIBus *bus, int devfn)
|
542 | c190ea07 | blueswir1 | { |
543 | 1387fe4a | Blue Swirl | qemu_irq *isa_irq; |
544 | 1387fe4a | Blue Swirl | |
545 | 53e3c4f9 | Blue Swirl | pci_create_simple(bus, devfn, "ebus");
|
546 | 1387fe4a | Blue Swirl | isa_irq = qemu_allocate_irqs(dummy_isa_irq_handler, NULL, 16); |
547 | 1387fe4a | Blue Swirl | isa_bus_irqs(isa_irq); |
548 | 53e3c4f9 | Blue Swirl | } |
549 | c190ea07 | blueswir1 | |
550 | 81a322d4 | Gerd Hoffmann | static int |
551 | 53e3c4f9 | Blue Swirl | pci_ebus_init1(PCIDevice *s) |
552 | 53e3c4f9 | Blue Swirl | { |
553 | 0c5b8d83 | Blue Swirl | isa_bus_new(&s->qdev); |
554 | 0c5b8d83 | Blue Swirl | |
555 | deb54399 | aliguori | pci_config_set_vendor_id(s->config, PCI_VENDOR_ID_SUN); |
556 | deb54399 | aliguori | pci_config_set_device_id(s->config, PCI_DEVICE_ID_SUN_EBUS); |
557 | c190ea07 | blueswir1 | s->config[0x04] = 0x06; // command = bus master, pci mem |
558 | c190ea07 | blueswir1 | s->config[0x05] = 0x00; |
559 | c190ea07 | blueswir1 | s->config[0x06] = 0xa0; // status = fast back-to-back, 66MHz, no error |
560 | c190ea07 | blueswir1 | s->config[0x07] = 0x03; // status = medium devsel |
561 | c190ea07 | blueswir1 | s->config[0x08] = 0x01; // revision |
562 | c190ea07 | blueswir1 | s->config[0x09] = 0x00; // programming i/f |
563 | 173a543b | blueswir1 | pci_config_set_class(s->config, PCI_CLASS_BRIDGE_OTHER); |
564 | c190ea07 | blueswir1 | s->config[0x0D] = 0x0a; // latency_timer |
565 | c190ea07 | blueswir1 | |
566 | 0392a017 | Isaku Yamahata | pci_register_bar(s, 0, 0x1000000, PCI_BASE_ADDRESS_SPACE_MEMORY, |
567 | c190ea07 | blueswir1 | ebus_mmio_mapfunc); |
568 | 0392a017 | Isaku Yamahata | pci_register_bar(s, 1, 0x800000, PCI_BASE_ADDRESS_SPACE_MEMORY, |
569 | c190ea07 | blueswir1 | ebus_mmio_mapfunc); |
570 | 81a322d4 | Gerd Hoffmann | return 0; |
571 | c190ea07 | blueswir1 | } |
572 | c190ea07 | blueswir1 | |
573 | 53e3c4f9 | Blue Swirl | static PCIDeviceInfo ebus_info = {
|
574 | 53e3c4f9 | Blue Swirl | .qdev.name = "ebus",
|
575 | 53e3c4f9 | Blue Swirl | .qdev.size = sizeof(PCIDevice),
|
576 | 53e3c4f9 | Blue Swirl | .init = pci_ebus_init1, |
577 | 53e3c4f9 | Blue Swirl | }; |
578 | 53e3c4f9 | Blue Swirl | |
579 | 53e3c4f9 | Blue Swirl | static void pci_ebus_register(void) |
580 | 53e3c4f9 | Blue Swirl | { |
581 | 53e3c4f9 | Blue Swirl | pci_qdev_register(&ebus_info); |
582 | 53e3c4f9 | Blue Swirl | } |
583 | 53e3c4f9 | Blue Swirl | |
584 | 53e3c4f9 | Blue Swirl | device_init(pci_ebus_register); |
585 | 53e3c4f9 | Blue Swirl | |
586 | 409dbce5 | Aurelien Jarno | static uint64_t translate_prom_address(void *opaque, uint64_t addr) |
587 | 409dbce5 | Aurelien Jarno | { |
588 | 409dbce5 | Aurelien Jarno | target_phys_addr_t *base_addr = (target_phys_addr_t *)opaque; |
589 | 409dbce5 | Aurelien Jarno | return addr + *base_addr - PROM_VADDR;
|
590 | 409dbce5 | Aurelien Jarno | } |
591 | 409dbce5 | Aurelien Jarno | |
592 | 1baffa46 | Blue Swirl | /* Boot PROM (OpenBIOS) */
|
593 | c227f099 | Anthony Liguori | static void prom_init(target_phys_addr_t addr, const char *bios_name) |
594 | 1baffa46 | Blue Swirl | { |
595 | 1baffa46 | Blue Swirl | DeviceState *dev; |
596 | 1baffa46 | Blue Swirl | SysBusDevice *s; |
597 | 1baffa46 | Blue Swirl | char *filename;
|
598 | 1baffa46 | Blue Swirl | int ret;
|
599 | 1baffa46 | Blue Swirl | |
600 | 1baffa46 | Blue Swirl | dev = qdev_create(NULL, "openprom"); |
601 | e23a1b33 | Markus Armbruster | qdev_init_nofail(dev); |
602 | 1baffa46 | Blue Swirl | s = sysbus_from_qdev(dev); |
603 | 1baffa46 | Blue Swirl | |
604 | 1baffa46 | Blue Swirl | sysbus_mmio_map(s, 0, addr);
|
605 | 1baffa46 | Blue Swirl | |
606 | 1baffa46 | Blue Swirl | /* load boot prom */
|
607 | 1baffa46 | Blue Swirl | if (bios_name == NULL) { |
608 | 1baffa46 | Blue Swirl | bios_name = PROM_FILENAME; |
609 | 1baffa46 | Blue Swirl | } |
610 | 1baffa46 | Blue Swirl | filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name); |
611 | 1baffa46 | Blue Swirl | if (filename) {
|
612 | 409dbce5 | Aurelien Jarno | ret = load_elf(filename, translate_prom_address, &addr, |
613 | 409dbce5 | Aurelien Jarno | NULL, NULL, NULL, 1, ELF_MACHINE, 0); |
614 | 1baffa46 | Blue Swirl | if (ret < 0 || ret > PROM_SIZE_MAX) { |
615 | 1baffa46 | Blue Swirl | ret = load_image_targphys(filename, addr, PROM_SIZE_MAX); |
616 | 1baffa46 | Blue Swirl | } |
617 | 1baffa46 | Blue Swirl | qemu_free(filename); |
618 | 1baffa46 | Blue Swirl | } else {
|
619 | 1baffa46 | Blue Swirl | ret = -1;
|
620 | 1baffa46 | Blue Swirl | } |
621 | 1baffa46 | Blue Swirl | if (ret < 0 || ret > PROM_SIZE_MAX) { |
622 | 1baffa46 | Blue Swirl | fprintf(stderr, "qemu: could not load prom '%s'\n", bios_name);
|
623 | 1baffa46 | Blue Swirl | exit(1);
|
624 | 1baffa46 | Blue Swirl | } |
625 | 1baffa46 | Blue Swirl | } |
626 | 1baffa46 | Blue Swirl | |
627 | 81a322d4 | Gerd Hoffmann | static int prom_init1(SysBusDevice *dev) |
628 | 1baffa46 | Blue Swirl | { |
629 | c227f099 | Anthony Liguori | ram_addr_t prom_offset; |
630 | 1baffa46 | Blue Swirl | |
631 | 1724f049 | Alex Williamson | prom_offset = qemu_ram_alloc(NULL, "sun4u.prom", PROM_SIZE_MAX); |
632 | 1baffa46 | Blue Swirl | sysbus_init_mmio(dev, PROM_SIZE_MAX, prom_offset | IO_MEM_ROM); |
633 | 81a322d4 | Gerd Hoffmann | return 0; |
634 | 1baffa46 | Blue Swirl | } |
635 | 1baffa46 | Blue Swirl | |
636 | 1baffa46 | Blue Swirl | static SysBusDeviceInfo prom_info = {
|
637 | 1baffa46 | Blue Swirl | .init = prom_init1, |
638 | 1baffa46 | Blue Swirl | .qdev.name = "openprom",
|
639 | 1baffa46 | Blue Swirl | .qdev.size = sizeof(SysBusDevice),
|
640 | 1baffa46 | Blue Swirl | .qdev.props = (Property[]) { |
641 | 1baffa46 | Blue Swirl | {/* end of property list */}
|
642 | 1baffa46 | Blue Swirl | } |
643 | 1baffa46 | Blue Swirl | }; |
644 | 1baffa46 | Blue Swirl | |
645 | 1baffa46 | Blue Swirl | static void prom_register_devices(void) |
646 | 1baffa46 | Blue Swirl | { |
647 | 1baffa46 | Blue Swirl | sysbus_register_withprop(&prom_info); |
648 | 1baffa46 | Blue Swirl | } |
649 | 1baffa46 | Blue Swirl | |
650 | 1baffa46 | Blue Swirl | device_init(prom_register_devices); |
651 | 1baffa46 | Blue Swirl | |
652 | bda42033 | Blue Swirl | |
653 | bda42033 | Blue Swirl | typedef struct RamDevice |
654 | bda42033 | Blue Swirl | { |
655 | bda42033 | Blue Swirl | SysBusDevice busdev; |
656 | 04843626 | Blue Swirl | uint64_t size; |
657 | bda42033 | Blue Swirl | } RamDevice; |
658 | bda42033 | Blue Swirl | |
659 | bda42033 | Blue Swirl | /* System RAM */
|
660 | 81a322d4 | Gerd Hoffmann | static int ram_init1(SysBusDevice *dev) |
661 | bda42033 | Blue Swirl | { |
662 | c227f099 | Anthony Liguori | ram_addr_t RAM_size, ram_offset; |
663 | bda42033 | Blue Swirl | RamDevice *d = FROM_SYSBUS(RamDevice, dev); |
664 | bda42033 | Blue Swirl | |
665 | bda42033 | Blue Swirl | RAM_size = d->size; |
666 | bda42033 | Blue Swirl | |
667 | 1724f049 | Alex Williamson | ram_offset = qemu_ram_alloc(NULL, "sun4u.ram", RAM_size); |
668 | bda42033 | Blue Swirl | sysbus_init_mmio(dev, RAM_size, ram_offset); |
669 | 81a322d4 | Gerd Hoffmann | return 0; |
670 | bda42033 | Blue Swirl | } |
671 | bda42033 | Blue Swirl | |
672 | c227f099 | Anthony Liguori | static void ram_init(target_phys_addr_t addr, ram_addr_t RAM_size) |
673 | bda42033 | Blue Swirl | { |
674 | bda42033 | Blue Swirl | DeviceState *dev; |
675 | bda42033 | Blue Swirl | SysBusDevice *s; |
676 | bda42033 | Blue Swirl | RamDevice *d; |
677 | bda42033 | Blue Swirl | |
678 | bda42033 | Blue Swirl | /* allocate RAM */
|
679 | bda42033 | Blue Swirl | dev = qdev_create(NULL, "memory"); |
680 | bda42033 | Blue Swirl | s = sysbus_from_qdev(dev); |
681 | bda42033 | Blue Swirl | |
682 | bda42033 | Blue Swirl | d = FROM_SYSBUS(RamDevice, s); |
683 | bda42033 | Blue Swirl | d->size = RAM_size; |
684 | e23a1b33 | Markus Armbruster | qdev_init_nofail(dev); |
685 | bda42033 | Blue Swirl | |
686 | bda42033 | Blue Swirl | sysbus_mmio_map(s, 0, addr);
|
687 | bda42033 | Blue Swirl | } |
688 | bda42033 | Blue Swirl | |
689 | bda42033 | Blue Swirl | static SysBusDeviceInfo ram_info = {
|
690 | bda42033 | Blue Swirl | .init = ram_init1, |
691 | bda42033 | Blue Swirl | .qdev.name = "memory",
|
692 | bda42033 | Blue Swirl | .qdev.size = sizeof(RamDevice),
|
693 | bda42033 | Blue Swirl | .qdev.props = (Property[]) { |
694 | 32a7ee98 | Gerd Hoffmann | DEFINE_PROP_UINT64("size", RamDevice, size, 0), |
695 | 32a7ee98 | Gerd Hoffmann | DEFINE_PROP_END_OF_LIST(), |
696 | bda42033 | Blue Swirl | } |
697 | bda42033 | Blue Swirl | }; |
698 | bda42033 | Blue Swirl | |
699 | bda42033 | Blue Swirl | static void ram_register_devices(void) |
700 | bda42033 | Blue Swirl | { |
701 | bda42033 | Blue Swirl | sysbus_register_withprop(&ram_info); |
702 | bda42033 | Blue Swirl | } |
703 | bda42033 | Blue Swirl | |
704 | bda42033 | Blue Swirl | device_init(ram_register_devices); |
705 | bda42033 | Blue Swirl | |
706 | 7b833f5b | Blue Swirl | static CPUState *cpu_devinit(const char *cpu_model, const struct hwdef *hwdef) |
707 | 3475187d | bellard | { |
708 | c68ea704 | bellard | CPUState *env; |
709 | e87231d4 | blueswir1 | ResetData *reset_info; |
710 | 3475187d | bellard | |
711 | 8f4efc55 | Igor V. Kovalenko | uint32_t tick_frequency = 100*1000000; |
712 | 8f4efc55 | Igor V. Kovalenko | uint32_t stick_frequency = 100*1000000; |
713 | 8f4efc55 | Igor V. Kovalenko | uint32_t hstick_frequency = 100*1000000; |
714 | 8f4efc55 | Igor V. Kovalenko | |
715 | c7ba218d | blueswir1 | if (!cpu_model)
|
716 | c7ba218d | blueswir1 | cpu_model = hwdef->default_cpu_model; |
717 | aaed909a | bellard | env = cpu_init(cpu_model); |
718 | aaed909a | bellard | if (!env) {
|
719 | 62724a37 | blueswir1 | fprintf(stderr, "Unable to find Sparc CPU definition\n");
|
720 | 62724a37 | blueswir1 | exit(1);
|
721 | 62724a37 | blueswir1 | } |
722 | 20c9f095 | blueswir1 | |
723 | 8f4efc55 | Igor V. Kovalenko | env->tick = cpu_timer_create("tick", env, tick_irq,
|
724 | 8f4efc55 | Igor V. Kovalenko | tick_frequency, TICK_NPT_MASK); |
725 | 8f4efc55 | Igor V. Kovalenko | |
726 | 8f4efc55 | Igor V. Kovalenko | env->stick = cpu_timer_create("stick", env, stick_irq,
|
727 | 8f4efc55 | Igor V. Kovalenko | stick_frequency, TICK_INT_DIS); |
728 | 20c9f095 | blueswir1 | |
729 | 8f4efc55 | Igor V. Kovalenko | env->hstick = cpu_timer_create("hstick", env, hstick_irq,
|
730 | 8f4efc55 | Igor V. Kovalenko | hstick_frequency, TICK_INT_DIS); |
731 | e87231d4 | blueswir1 | |
732 | e87231d4 | blueswir1 | reset_info = qemu_mallocz(sizeof(ResetData));
|
733 | e87231d4 | blueswir1 | reset_info->env = env; |
734 | 44a99354 | Blue Swirl | reset_info->prom_addr = hwdef->prom_addr; |
735 | a08d4367 | Jan Kiszka | qemu_register_reset(main_cpu_reset, reset_info); |
736 | c68ea704 | bellard | |
737 | 7b833f5b | Blue Swirl | return env;
|
738 | 7b833f5b | Blue Swirl | } |
739 | 7b833f5b | Blue Swirl | |
740 | c227f099 | Anthony Liguori | static void sun4uv_init(ram_addr_t RAM_size, |
741 | 7b833f5b | Blue Swirl | const char *boot_devices, |
742 | 7b833f5b | Blue Swirl | const char *kernel_filename, const char *kernel_cmdline, |
743 | 7b833f5b | Blue Swirl | const char *initrd_filename, const char *cpu_model, |
744 | 7b833f5b | Blue Swirl | const struct hwdef *hwdef) |
745 | 7b833f5b | Blue Swirl | { |
746 | 7b833f5b | Blue Swirl | CPUState *env; |
747 | 43a34704 | Blue Swirl | M48t59State *nvram; |
748 | 7b833f5b | Blue Swirl | unsigned int i; |
749 | 7b833f5b | Blue Swirl | long initrd_size, kernel_size;
|
750 | 7b833f5b | Blue Swirl | PCIBus *pci_bus, *pci_bus2, *pci_bus3; |
751 | 7b833f5b | Blue Swirl | qemu_irq *irq; |
752 | f455e98c | Gerd Hoffmann | DriveInfo *hd[MAX_IDE_BUS * MAX_IDE_DEVS]; |
753 | fd8014e1 | Gerd Hoffmann | DriveInfo *fd[MAX_FD]; |
754 | 7b833f5b | Blue Swirl | void *fw_cfg;
|
755 | 7b833f5b | Blue Swirl | |
756 | 7b833f5b | Blue Swirl | /* init CPUs */
|
757 | 7b833f5b | Blue Swirl | env = cpu_devinit(cpu_model, hwdef); |
758 | 7b833f5b | Blue Swirl | |
759 | bda42033 | Blue Swirl | /* set up devices */
|
760 | bda42033 | Blue Swirl | ram_init(0, RAM_size);
|
761 | 3475187d | bellard | |
762 | 1baffa46 | Blue Swirl | prom_init(hwdef->prom_addr, bios_name); |
763 | 3475187d | bellard | |
764 | 7d55273f | Igor Kovalenko | |
765 | 7d55273f | Igor Kovalenko | irq = qemu_allocate_irqs(cpu_set_irq, env, MAX_PILS); |
766 | 7d55273f | Igor Kovalenko | pci_bus = pci_apb_init(APB_SPECIAL_BASE, APB_MEM_BASE, irq, &pci_bus2, |
767 | c190ea07 | blueswir1 | &pci_bus3); |
768 | d63baf92 | Igor V. Kovalenko | isa_mem_base = APB_PCI_IO_BASE; |
769 | fbe1b595 | Paul Brook | pci_vga_init(pci_bus, 0, 0); |
770 | 83469015 | bellard | |
771 | c190ea07 | blueswir1 | // XXX Should be pci_bus3
|
772 | c190ea07 | blueswir1 | pci_ebus_init(pci_bus, -1);
|
773 | c190ea07 | blueswir1 | |
774 | e87231d4 | blueswir1 | i = 0;
|
775 | e87231d4 | blueswir1 | if (hwdef->console_serial_base) {
|
776 | e87231d4 | blueswir1 | serial_mm_init(hwdef->console_serial_base, 0, NULL, 115200, |
777 | 2d48377a | Blue Swirl | serial_hds[i], 1, 1); |
778 | e87231d4 | blueswir1 | i++; |
779 | e87231d4 | blueswir1 | } |
780 | e87231d4 | blueswir1 | for(; i < MAX_SERIAL_PORTS; i++) {
|
781 | 83469015 | bellard | if (serial_hds[i]) {
|
782 | ac0be998 | Gerd Hoffmann | serial_isa_init(i, serial_hds[i]); |
783 | 83469015 | bellard | } |
784 | 83469015 | bellard | } |
785 | 83469015 | bellard | |
786 | 83469015 | bellard | for(i = 0; i < MAX_PARALLEL_PORTS; i++) { |
787 | 83469015 | bellard | if (parallel_hds[i]) {
|
788 | 021f0674 | Gerd Hoffmann | parallel_init(i, parallel_hds[i]); |
789 | 83469015 | bellard | } |
790 | 83469015 | bellard | } |
791 | 83469015 | bellard | |
792 | cb457d76 | aliguori | for(i = 0; i < nb_nics; i++) |
793 | 07caea31 | Markus Armbruster | pci_nic_init_nofail(&nd_table[i], "ne2k_pci", NULL); |
794 | 83469015 | bellard | |
795 | e4bcb14c | ths | if (drive_get_max_bus(IF_IDE) >= MAX_IDE_BUS) {
|
796 | e4bcb14c | ths | fprintf(stderr, "qemu: too many IDE bus\n");
|
797 | e4bcb14c | ths | exit(1);
|
798 | e4bcb14c | ths | } |
799 | e4bcb14c | ths | for(i = 0; i < MAX_IDE_BUS * MAX_IDE_DEVS; i++) { |
800 | f455e98c | Gerd Hoffmann | hd[i] = drive_get(IF_IDE, i / MAX_IDE_DEVS, |
801 | 751c6a17 | Gerd Hoffmann | i % MAX_IDE_DEVS); |
802 | e4bcb14c | ths | } |
803 | e4bcb14c | ths | |
804 | 3b898dda | blueswir1 | pci_cmd646_ide_init(pci_bus, hd, 1);
|
805 | 3b898dda | blueswir1 | |
806 | 2e15e23b | Gerd Hoffmann | isa_create_simple("i8042");
|
807 | e4bcb14c | ths | for(i = 0; i < MAX_FD; i++) { |
808 | fd8014e1 | Gerd Hoffmann | fd[i] = drive_get(IF_FLOPPY, 0, i);
|
809 | e4bcb14c | ths | } |
810 | 86c86157 | Gerd Hoffmann | fdctrl_init_isa(fd); |
811 | f80237d4 | Blue Swirl | nvram = m48t59_init_isa(0x0074, NVRAM_SIZE, 59); |
812 | 636aa70a | Blue Swirl | |
813 | 636aa70a | Blue Swirl | initrd_size = 0;
|
814 | 636aa70a | Blue Swirl | kernel_size = sun4u_load_kernel(kernel_filename, initrd_filename, |
815 | 636aa70a | Blue Swirl | ram_size, &initrd_size); |
816 | 636aa70a | Blue Swirl | |
817 | 22548760 | blueswir1 | sun4u_NVRAM_set_params(nvram, NVRAM_SIZE, "Sun4u", RAM_size, boot_devices,
|
818 | 0d31cb99 | blueswir1 | KERNEL_LOAD_ADDR, kernel_size, |
819 | 0d31cb99 | blueswir1 | kernel_cmdline, |
820 | 0d31cb99 | blueswir1 | INITRD_LOAD_ADDR, initrd_size, |
821 | 0d31cb99 | blueswir1 | /* XXX: need an option to load a NVRAM image */
|
822 | 0d31cb99 | blueswir1 | 0,
|
823 | 0d31cb99 | blueswir1 | graphic_width, graphic_height, graphic_depth, |
824 | 0d31cb99 | blueswir1 | (uint8_t *)&nd_table[0].macaddr);
|
825 | 83469015 | bellard | |
826 | 3cce6243 | blueswir1 | fw_cfg = fw_cfg_init(BIOS_CFG_IOPORT, BIOS_CFG_IOPORT + 1, 0, 0); |
827 | 3cce6243 | blueswir1 | fw_cfg_add_i32(fw_cfg, FW_CFG_ID, 1);
|
828 | 905fdcb5 | blueswir1 | fw_cfg_add_i64(fw_cfg, FW_CFG_RAM_SIZE, (uint64_t)ram_size); |
829 | 905fdcb5 | blueswir1 | fw_cfg_add_i16(fw_cfg, FW_CFG_MACHINE_ID, hwdef->machine_id); |
830 | 513f789f | blueswir1 | fw_cfg_add_i32(fw_cfg, FW_CFG_KERNEL_ADDR, KERNEL_LOAD_ADDR); |
831 | 513f789f | blueswir1 | fw_cfg_add_i32(fw_cfg, FW_CFG_KERNEL_SIZE, kernel_size); |
832 | 513f789f | blueswir1 | if (kernel_cmdline) {
|
833 | 9c9b0512 | Blue Swirl | fw_cfg_add_i32(fw_cfg, FW_CFG_CMDLINE_SIZE, |
834 | 9c9b0512 | Blue Swirl | strlen(kernel_cmdline) + 1);
|
835 | 6bb4ca57 | Blue Swirl | fw_cfg_add_bytes(fw_cfg, FW_CFG_CMDLINE_DATA, |
836 | 6bb4ca57 | Blue Swirl | (uint8_t*)strdup(kernel_cmdline), |
837 | 6bb4ca57 | Blue Swirl | strlen(kernel_cmdline) + 1);
|
838 | 513f789f | blueswir1 | } else {
|
839 | 9c9b0512 | Blue Swirl | fw_cfg_add_i32(fw_cfg, FW_CFG_CMDLINE_SIZE, 0);
|
840 | 513f789f | blueswir1 | } |
841 | 513f789f | blueswir1 | fw_cfg_add_i32(fw_cfg, FW_CFG_INITRD_ADDR, INITRD_LOAD_ADDR); |
842 | 513f789f | blueswir1 | fw_cfg_add_i32(fw_cfg, FW_CFG_INITRD_SIZE, initrd_size); |
843 | 513f789f | blueswir1 | fw_cfg_add_i16(fw_cfg, FW_CFG_BOOT_DEVICE, boot_devices[0]);
|
844 | 7589690c | Blue Swirl | |
845 | 7589690c | Blue Swirl | fw_cfg_add_i16(fw_cfg, FW_CFG_SPARC64_WIDTH, graphic_width); |
846 | 7589690c | Blue Swirl | fw_cfg_add_i16(fw_cfg, FW_CFG_SPARC64_HEIGHT, graphic_height); |
847 | 7589690c | Blue Swirl | fw_cfg_add_i16(fw_cfg, FW_CFG_SPARC64_DEPTH, graphic_depth); |
848 | 7589690c | Blue Swirl | |
849 | 513f789f | blueswir1 | qemu_register_boot_set(fw_cfg_boot_set, fw_cfg); |
850 | 3475187d | bellard | } |
851 | 3475187d | bellard | |
852 | 905fdcb5 | blueswir1 | enum {
|
853 | 905fdcb5 | blueswir1 | sun4u_id = 0,
|
854 | 905fdcb5 | blueswir1 | sun4v_id = 64,
|
855 | e87231d4 | blueswir1 | niagara_id, |
856 | 905fdcb5 | blueswir1 | }; |
857 | 905fdcb5 | blueswir1 | |
858 | c7ba218d | blueswir1 | static const struct hwdef hwdefs[] = { |
859 | c7ba218d | blueswir1 | /* Sun4u generic PC-like machine */
|
860 | c7ba218d | blueswir1 | { |
861 | 5910b047 | Igor V. Kovalenko | .default_cpu_model = "TI UltraSparc IIi",
|
862 | 905fdcb5 | blueswir1 | .machine_id = sun4u_id, |
863 | e87231d4 | blueswir1 | .prom_addr = 0x1fff0000000ULL,
|
864 | e87231d4 | blueswir1 | .console_serial_base = 0,
|
865 | c7ba218d | blueswir1 | }, |
866 | c7ba218d | blueswir1 | /* Sun4v generic PC-like machine */
|
867 | c7ba218d | blueswir1 | { |
868 | c7ba218d | blueswir1 | .default_cpu_model = "Sun UltraSparc T1",
|
869 | 905fdcb5 | blueswir1 | .machine_id = sun4v_id, |
870 | e87231d4 | blueswir1 | .prom_addr = 0x1fff0000000ULL,
|
871 | e87231d4 | blueswir1 | .console_serial_base = 0,
|
872 | e87231d4 | blueswir1 | }, |
873 | e87231d4 | blueswir1 | /* Sun4v generic Niagara machine */
|
874 | e87231d4 | blueswir1 | { |
875 | e87231d4 | blueswir1 | .default_cpu_model = "Sun UltraSparc T1",
|
876 | e87231d4 | blueswir1 | .machine_id = niagara_id, |
877 | e87231d4 | blueswir1 | .prom_addr = 0xfff0000000ULL,
|
878 | e87231d4 | blueswir1 | .console_serial_base = 0xfff0c2c000ULL,
|
879 | c7ba218d | blueswir1 | }, |
880 | c7ba218d | blueswir1 | }; |
881 | c7ba218d | blueswir1 | |
882 | c7ba218d | blueswir1 | /* Sun4u hardware initialisation */
|
883 | c227f099 | Anthony Liguori | static void sun4u_init(ram_addr_t RAM_size, |
884 | 3023f332 | aliguori | const char *boot_devices, |
885 | c7ba218d | blueswir1 | const char *kernel_filename, const char *kernel_cmdline, |
886 | c7ba218d | blueswir1 | const char *initrd_filename, const char *cpu_model) |
887 | c7ba218d | blueswir1 | { |
888 | fbe1b595 | Paul Brook | sun4uv_init(RAM_size, boot_devices, kernel_filename, |
889 | c7ba218d | blueswir1 | kernel_cmdline, initrd_filename, cpu_model, &hwdefs[0]);
|
890 | c7ba218d | blueswir1 | } |
891 | c7ba218d | blueswir1 | |
892 | c7ba218d | blueswir1 | /* Sun4v hardware initialisation */
|
893 | c227f099 | Anthony Liguori | static void sun4v_init(ram_addr_t RAM_size, |
894 | 3023f332 | aliguori | const char *boot_devices, |
895 | c7ba218d | blueswir1 | const char *kernel_filename, const char *kernel_cmdline, |
896 | c7ba218d | blueswir1 | const char *initrd_filename, const char *cpu_model) |
897 | c7ba218d | blueswir1 | { |
898 | fbe1b595 | Paul Brook | sun4uv_init(RAM_size, boot_devices, kernel_filename, |
899 | c7ba218d | blueswir1 | kernel_cmdline, initrd_filename, cpu_model, &hwdefs[1]);
|
900 | c7ba218d | blueswir1 | } |
901 | c7ba218d | blueswir1 | |
902 | e87231d4 | blueswir1 | /* Niagara hardware initialisation */
|
903 | c227f099 | Anthony Liguori | static void niagara_init(ram_addr_t RAM_size, |
904 | 3023f332 | aliguori | const char *boot_devices, |
905 | e87231d4 | blueswir1 | const char *kernel_filename, const char *kernel_cmdline, |
906 | e87231d4 | blueswir1 | const char *initrd_filename, const char *cpu_model) |
907 | e87231d4 | blueswir1 | { |
908 | fbe1b595 | Paul Brook | sun4uv_init(RAM_size, boot_devices, kernel_filename, |
909 | e87231d4 | blueswir1 | kernel_cmdline, initrd_filename, cpu_model, &hwdefs[2]);
|
910 | e87231d4 | blueswir1 | } |
911 | e87231d4 | blueswir1 | |
912 | f80f9ec9 | Anthony Liguori | static QEMUMachine sun4u_machine = {
|
913 | 66de733b | blueswir1 | .name = "sun4u",
|
914 | 66de733b | blueswir1 | .desc = "Sun4u platform",
|
915 | 66de733b | blueswir1 | .init = sun4u_init, |
916 | 1bcee014 | blueswir1 | .max_cpus = 1, // XXX for now |
917 | 0c257437 | Anthony Liguori | .is_default = 1,
|
918 | 3475187d | bellard | }; |
919 | c7ba218d | blueswir1 | |
920 | f80f9ec9 | Anthony Liguori | static QEMUMachine sun4v_machine = {
|
921 | 66de733b | blueswir1 | .name = "sun4v",
|
922 | 66de733b | blueswir1 | .desc = "Sun4v platform",
|
923 | 66de733b | blueswir1 | .init = sun4v_init, |
924 | 1bcee014 | blueswir1 | .max_cpus = 1, // XXX for now |
925 | c7ba218d | blueswir1 | }; |
926 | e87231d4 | blueswir1 | |
927 | f80f9ec9 | Anthony Liguori | static QEMUMachine niagara_machine = {
|
928 | e87231d4 | blueswir1 | .name = "Niagara",
|
929 | e87231d4 | blueswir1 | .desc = "Sun4v platform, Niagara",
|
930 | e87231d4 | blueswir1 | .init = niagara_init, |
931 | 1bcee014 | blueswir1 | .max_cpus = 1, // XXX for now |
932 | e87231d4 | blueswir1 | }; |
933 | f80f9ec9 | Anthony Liguori | |
934 | f80f9ec9 | Anthony Liguori | static void sun4u_machine_init(void) |
935 | f80f9ec9 | Anthony Liguori | { |
936 | f80f9ec9 | Anthony Liguori | qemu_register_machine(&sun4u_machine); |
937 | f80f9ec9 | Anthony Liguori | qemu_register_machine(&sun4v_machine); |
938 | f80f9ec9 | Anthony Liguori | qemu_register_machine(&niagara_machine); |
939 | f80f9ec9 | Anthony Liguori | } |
940 | f80f9ec9 | Anthony Liguori | |
941 | f80f9ec9 | Anthony Liguori | machine_init(sun4u_machine_init); |