Revision 22548760 hw/sun4m.c
b/hw/sun4m.c | ||
---|---|---|
32 | 32 |
#include "boards.h" |
33 | 33 |
#include "firmware_abi.h" |
34 | 34 |
#include "scsi.h" |
35 |
#include "pc.h" |
|
36 |
#include "isa.h" |
|
35 | 37 |
|
36 | 38 |
//#define DEBUG_IRQ |
37 | 39 |
|
... | ... | |
123 | 125 |
const char * const default_cpu_model; |
124 | 126 |
}; |
125 | 127 |
|
126 |
/* TSC handling */ |
|
127 |
|
|
128 |
uint64_t cpu_get_tsc() |
|
129 |
{ |
|
130 |
return qemu_get_clock(vm_clock); |
|
131 |
} |
|
132 |
|
|
133 | 128 |
int DMA_get_channel_mode (int nchan) |
134 | 129 |
{ |
135 | 130 |
return 0; |
... | ... | |
238 | 233 |
|
239 | 234 |
static void *slavio_intctl; |
240 | 235 |
|
241 |
void pic_info() |
|
236 |
void pic_info(void)
|
|
242 | 237 |
{ |
243 | 238 |
if (slavio_intctl) |
244 | 239 |
slavio_pic_info(slavio_intctl); |
245 | 240 |
} |
246 | 241 |
|
247 |
void irq_info() |
|
242 |
void irq_info(void)
|
|
248 | 243 |
{ |
249 | 244 |
if (slavio_intctl) |
250 | 245 |
slavio_irq_info(slavio_intctl); |
... | ... | |
319 | 314 |
} |
320 | 315 |
|
321 | 316 |
static unsigned long sun4m_load_kernel(const char *kernel_filename, |
322 |
const char *kernel_cmdline, |
|
323 | 317 |
const char *initrd_filename) |
324 | 318 |
{ |
325 | 319 |
int linux_boot; |
... | ... | |
384 | 378 |
int ret; |
385 | 379 |
char buf[1024]; |
386 | 380 |
BlockDriverState *fd[MAX_FD]; |
387 |
int index; |
|
381 |
int drive_index;
|
|
388 | 382 |
|
389 | 383 |
/* init CPUs */ |
390 | 384 |
if (!cpu_model) |
... | ... | |
506 | 500 |
if (hwdef->fd_base != (target_phys_addr_t)-1) { |
507 | 501 |
/* there is zero or one floppy drive */ |
508 | 502 |
memset(fd, 0, sizeof(fd)); |
509 |
index = drive_get_index(IF_FLOPPY, 0, 0); |
|
510 |
if (index != -1) |
|
511 |
fd[0] = drives_table[index].bdrv; |
|
503 |
drive_index = drive_get_index(IF_FLOPPY, 0, 0);
|
|
504 |
if (drive_index != -1)
|
|
505 |
fd[0] = drives_table[drive_index].bdrv;
|
|
512 | 506 |
|
513 | 507 |
sun4m_fdctrl_init(slavio_irq[hwdef->fd_irq], hwdef->fd_base, fd, |
514 | 508 |
fdc_tc); |
... | ... | |
524 | 518 |
espdma, *espdma_irq, esp_reset); |
525 | 519 |
|
526 | 520 |
for (i = 0; i < ESP_MAX_DEVS; i++) { |
527 |
index = drive_get_index(IF_SCSI, 0, i); |
|
528 |
if (index == -1) |
|
521 |
drive_index = drive_get_index(IF_SCSI, 0, i);
|
|
522 |
if (drive_index == -1)
|
|
529 | 523 |
continue; |
530 |
esp_scsi_attach(main_esp, drives_table[index].bdrv, i); |
|
524 |
esp_scsi_attach(main_esp, drives_table[drive_index].bdrv, i);
|
|
531 | 525 |
} |
532 | 526 |
|
533 | 527 |
if (hwdef->cs_base != (target_phys_addr_t)-1) |
534 | 528 |
cs_init(hwdef->cs_base, hwdef->cs_irq, slavio_intctl); |
535 | 529 |
|
536 |
kernel_size = sun4m_load_kernel(kernel_filename, kernel_cmdline, |
|
537 |
initrd_filename); |
|
530 |
kernel_size = sun4m_load_kernel(kernel_filename, initrd_filename); |
|
538 | 531 |
|
539 | 532 |
nvram_init(nvram, (uint8_t *)&nd_table[0].macaddr, kernel_cmdline, |
540 | 533 |
boot_device, RAM_size, kernel_size, graphic_width, |
... | ... | |
561 | 554 |
int ret; |
562 | 555 |
char buf[1024]; |
563 | 556 |
BlockDriverState *fd[MAX_FD]; |
564 |
int index; |
|
557 |
int drive_index;
|
|
565 | 558 |
|
566 | 559 |
/* init CPU */ |
567 | 560 |
if (!cpu_model) |
... | ... | |
658 | 651 |
if (hwdef->fd_base != (target_phys_addr_t)-1) { |
659 | 652 |
/* there is zero or one floppy drive */ |
660 | 653 |
fd[1] = fd[0] = NULL; |
661 |
index = drive_get_index(IF_FLOPPY, 0, 0); |
|
662 |
if (index != -1) |
|
663 |
fd[0] = drives_table[index].bdrv; |
|
654 |
drive_index = drive_get_index(IF_FLOPPY, 0, 0);
|
|
655 |
if (drive_index != -1)
|
|
656 |
fd[0] = drives_table[drive_index].bdrv;
|
|
664 | 657 |
|
665 | 658 |
sun4m_fdctrl_init(slavio_irq[hwdef->fd_irq], hwdef->fd_base, fd, |
666 | 659 |
fdc_tc); |
... | ... | |
676 | 669 |
espdma, *espdma_irq, esp_reset); |
677 | 670 |
|
678 | 671 |
for (i = 0; i < ESP_MAX_DEVS; i++) { |
679 |
index = drive_get_index(IF_SCSI, 0, i); |
|
680 |
if (index == -1) |
|
672 |
drive_index = drive_get_index(IF_SCSI, 0, i);
|
|
673 |
if (drive_index == -1)
|
|
681 | 674 |
continue; |
682 |
esp_scsi_attach(main_esp, drives_table[index].bdrv, i); |
|
675 |
esp_scsi_attach(main_esp, drives_table[drive_index].bdrv, i);
|
|
683 | 676 |
} |
684 | 677 |
|
685 |
kernel_size = sun4m_load_kernel(kernel_filename, kernel_cmdline, |
|
686 |
initrd_filename); |
|
678 |
kernel_size = sun4m_load_kernel(kernel_filename, initrd_filename); |
|
687 | 679 |
|
688 | 680 |
nvram_init(nvram, (uint8_t *)&nd_table[0].macaddr, kernel_cmdline, |
689 | 681 |
boot_device, RAM_size, kernel_size, graphic_width, |
... | ... | |
1366 | 1358 |
unsigned long prom_offset, kernel_size; |
1367 | 1359 |
int ret; |
1368 | 1360 |
char buf[1024]; |
1369 |
int index; |
|
1361 |
int drive_index;
|
|
1370 | 1362 |
|
1371 | 1363 |
/* init CPUs */ |
1372 | 1364 |
if (!cpu_model) |
... | ... | |
1478 | 1470 |
espdma, *espdma_irq, esp_reset); |
1479 | 1471 |
|
1480 | 1472 |
for (i = 0; i < ESP_MAX_DEVS; i++) { |
1481 |
index = drive_get_index(IF_SCSI, 0, i); |
|
1482 |
if (index == -1) |
|
1473 |
drive_index = drive_get_index(IF_SCSI, 0, i);
|
|
1474 |
if (drive_index == -1)
|
|
1483 | 1475 |
continue; |
1484 |
esp_scsi_attach(main_esp, drives_table[index].bdrv, i); |
|
1476 |
esp_scsi_attach(main_esp, drives_table[drive_index].bdrv, i);
|
|
1485 | 1477 |
} |
1486 | 1478 |
|
1487 |
kernel_size = sun4m_load_kernel(kernel_filename, kernel_cmdline, |
|
1488 |
initrd_filename); |
|
1479 |
kernel_size = sun4m_load_kernel(kernel_filename, initrd_filename); |
|
1489 | 1480 |
|
1490 | 1481 |
nvram_init(nvram, (uint8_t *)&nd_table[0].macaddr, kernel_cmdline, |
1491 | 1482 |
boot_device, RAM_size, kernel_size, graphic_width, |
Also available in: Unified diff