aboutsummaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorths <ths@c046a42c-6fe2-441c-8c8c-71466251a162>2006-12-24 17:12:43 +0000
committerths <ths@c046a42c-6fe2-441c-8c8c-71466251a162>2006-12-24 17:12:43 +0000
commitfa1fb14cd2f4f24e158b1bb284bd193e79899575 (patch)
tree8a38b3800d1f3a13153ef0f1b4b08761d82039b3 /hw
parent1f9584496747480020bb93ee1582d104f877ce0a (diff)
Fix SCSI cdrom boot, thanks Blue Swirl.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2278 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'hw')
-rw-r--r--hw/esp.c33
-rw-r--r--hw/sun4m.c6
2 files changed, 31 insertions, 8 deletions
diff --git a/hw/esp.c b/hw/esp.c
index 4587502e2b..fea08d8783 100644
--- a/hw/esp.c
+++ b/hw/esp.c
@@ -43,6 +43,8 @@ do { printf("ESP: " fmt , ##args); } while (0)
#define ESP_MAXREG 0x3f
#define TI_BUFSZ 32
+/* The HBA is ID 7, so for simplicitly limit to 7 devices. */
+#define ESP_MAX_DEVS 7
typedef struct ESPState ESPState;
@@ -526,11 +528,33 @@ static int esp_load(QEMUFile *f, void *opaque, int version_id)
return 0;
}
+void esp_scsi_attach(void *opaque, BlockDriverState *bd, int id)
+{
+ ESPState *s = (ESPState *)opaque;
+
+ if (id < 0) {
+ for (id = 0; id < ESP_MAX_DEVS; id++) {
+ if (s->scsi_dev[id] == NULL)
+ break;
+ }
+ }
+ if (id >= ESP_MAX_DEVS) {
+ DPRINTF("Bad Device ID %d\n", id);
+ return;
+ }
+ if (s->scsi_dev[id]) {
+ DPRINTF("Destroying device %d\n", id);
+ scsi_disk_destroy(s->scsi_dev[id]);
+ }
+ DPRINTF("Attaching block device %d\n", id);
+ /* Command queueing is not implemented. */
+ s->scsi_dev[id] = scsi_disk_init(bd, 0, esp_command_complete, s);
+}
+
void *esp_init(BlockDriverState **bd, uint32_t espaddr, void *dma_opaque)
{
ESPState *s;
int esp_io_memory;
- int i;
s = qemu_mallocz(sizeof(ESPState));
if (!s)
@@ -546,13 +570,6 @@ void *esp_init(BlockDriverState **bd, uint32_t espaddr, void *dma_opaque)
register_savevm("esp", espaddr, 2, esp_save, esp_load, s);
qemu_register_reset(esp_reset, s);
- for (i = 0; i < MAX_DISKS; i++) {
- if (bs_table[i]) {
- /* Command queueing is not implemented. */
- s->scsi_dev[i] =
- scsi_disk_init(bs_table[i], 0, esp_command_complete, s);
- }
- }
return s;
}
diff --git a/hw/sun4m.c b/hw/sun4m.c
index a636638b5f..c6765d9e17 100644
--- a/hw/sun4m.c
+++ b/hw/sun4m.c
@@ -262,6 +262,12 @@ static void sun4m_init(int ram_size, int vga_ram_size, int boot_device,
slavio_serial_init(PHYS_JJ_SER, PHYS_JJ_SER_IRQ, serial_hds[1], serial_hds[0]);
fdctrl_init(PHYS_JJ_FLOPPY_IRQ, 0, 1, PHYS_JJ_FDC, fd_table);
main_esp = esp_init(bs_table, PHYS_JJ_ESP, dma);
+ for (i = 0; i < MAX_SCSI_DISKS; i++) {
+ if (scsi_disks_info[i].adapter == SCSI_ESP &&
+ scsi_disks_info[i].device_type != SCSI_NONE) {
+ esp_scsi_attach(main_esp, bs_scsi_table[i], scsi_disks_info[i].id);
+ }
+ }
slavio_misc = slavio_misc_init(PHYS_JJ_SLAVIO, PHYS_JJ_ME_IRQ);
cs_init(PHYS_JJ_CS, PHYS_JJ_CS_IRQ, slavio_intctl);
sparc32_dma_set_reset_data(dma, main_esp, main_lance);