diff options
author | Markus Armbruster <armbru@redhat.com> | 2010-05-28 15:38:46 +0200 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2010-06-04 11:43:39 +0200 |
commit | 57dac7ef8aeabcd17b1ceee2296917bc48ccd526 (patch) | |
tree | 62a7cb2ca6be6c87b5f87849860a05105eda13a9 /hw/ide/core.c | |
parent | 124964b54e0c50706385691142795b6e43dad817 (diff) | |
download | qemu-57dac7ef8aeabcd17b1ceee2296917bc48ccd526.tar.gz |
ide: Remove redundant IDEState member conf
Commit 428c149b added IDEState member conf to let commit 0009baf1 find
the BlockConf from there. It exists only for qdev drives, created via
ide_drive_initfn(), not for drives created via ide_init2().
But for a qdev drive, we can just as well reach its IDEDevice, which
contains the BlockConf. Do that, and revert the parts of commit
428c149b that add IDEState member conf.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'hw/ide/core.c')
-rw-r--r-- | hw/ide/core.c | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/hw/ide/core.c b/hw/ide/core.c index 066fecb0c0..c3334b121e 100644 --- a/hw/ide/core.c +++ b/hw/ide/core.c @@ -98,6 +98,7 @@ static void ide_identify(IDEState *s) { uint16_t *p; unsigned int oldsize; + IDEDevice *dev; if (s->identify_set) { memcpy(s->io_buffer, s->identify_data, sizeof(s->identify_data)); @@ -165,8 +166,9 @@ static void ide_identify(IDEState *s) put_le16(p + 101, s->nb_sectors >> 16); put_le16(p + 102, s->nb_sectors >> 32); put_le16(p + 103, s->nb_sectors >> 48); - if (s->conf && s->conf->physical_block_size) - put_le16(p + 106, 0x6000 | get_physical_block_exp(s->conf)); + dev = s->unit ? s->bus->slave : s->bus->master; + if (dev && dev->conf.physical_block_size) + put_le16(p + 106, 0x6000 | get_physical_block_exp(&dev->conf)); memcpy(s->identify_data, p, sizeof(s->identify_data)); s->identify_set = 1; @@ -2594,8 +2596,7 @@ void ide_bus_reset(IDEBus *bus) ide_clear_hob(bus); } -void ide_init_drive(IDEState *s, DriveInfo *dinfo, BlockConf *conf, - const char *version) +void ide_init_drive(IDEState *s, DriveInfo *dinfo, const char *version) { int cylinders, heads, secs; uint64_t nb_sectors; @@ -2620,9 +2621,6 @@ void ide_init_drive(IDEState *s, DriveInfo *dinfo, BlockConf *conf, } strncpy(s->drive_serial_str, drive_get_serial(s->bs), sizeof(s->drive_serial_str)); - if (conf) { - s->conf = conf; - } } if (strlen(s->drive_serial_str) == 0) snprintf(s->drive_serial_str, sizeof(s->drive_serial_str), @@ -2653,9 +2651,9 @@ void ide_init2(IDEBus *bus, DriveInfo *hd0, DriveInfo *hd1, s->sector_write_timer = qemu_new_timer(vm_clock, ide_sector_write_timer_cb, s); if (i == 0) - ide_init_drive(s, hd0, NULL, NULL); + ide_init_drive(s, hd0, NULL); if (i == 1) - ide_init_drive(s, hd1, NULL, NULL); + ide_init_drive(s, hd1, NULL); } bus->irq = irq; } |