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