[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 10/27] ide: Remove redundant IDEState member conf
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] [PATCH 10/27] ide: Remove redundant IDEState member conf |
Date: |
Fri, 4 Jun 2010 18:32:58 +0200 |
From: Markus Armbruster <address@hidden>
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 <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
---
hw/ide/core.c | 16 +++++++---------
hw/ide/internal.h | 4 +---
hw/ide/qdev.c | 3 +--
3 files changed, 9 insertions(+), 14 deletions(-)
diff --git a/hw/ide/core.c b/hw/ide/core.c
index 066fecb..c3334b1 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;
}
diff --git a/hw/ide/internal.h b/hw/ide/internal.h
index b4554ce..cf71019 100644
--- a/hw/ide/internal.h
+++ b/hw/ide/internal.h
@@ -398,7 +398,6 @@ struct IDEState {
/* set for lba48 access */
uint8_t lba48;
BlockDriverState *bs;
- BlockConf *conf;
char version[9];
/* ATAPI specific */
uint8_t sense_key;
@@ -555,8 +554,7 @@ uint32_t ide_data_readw(void *opaque, uint32_t addr);
void ide_data_writel(void *opaque, uint32_t addr, uint32_t val);
uint32_t ide_data_readl(void *opaque, uint32_t addr);
-void ide_init_drive(IDEState *s, DriveInfo *dinfo, BlockConf *conf,
- const char *version);
+void ide_init_drive(IDEState *s, DriveInfo *dinfo, const char *version);
void ide_init2(IDEBus *bus, DriveInfo *hd0, DriveInfo *hd1,
qemu_irq irq);
void ide_init_ioport(IDEBus *bus, int iobase, int iobase2);
diff --git a/hw/ide/qdev.c b/hw/ide/qdev.c
index b18693d..9ebb906 100644
--- a/hw/ide/qdev.c
+++ b/hw/ide/qdev.c
@@ -99,8 +99,7 @@ typedef struct IDEDrive {
static int ide_drive_initfn(IDEDevice *dev)
{
IDEBus *bus = DO_UPCAST(IDEBus, qbus, dev->qdev.parent_bus);
- ide_init_drive(bus->ifs + dev->unit, dev->conf.dinfo, &dev->conf,
- dev->version);
+ ide_init_drive(bus->ifs + dev->unit, dev->conf.dinfo, dev->version);
return 0;
}
--
1.6.6.1
- [Qemu-devel] [PATCH 06/27] blockdev: Belatedly remove MAX_DRIVES, (continued)
- [Qemu-devel] [PATCH 06/27] blockdev: Belatedly remove MAX_DRIVES, Kevin Wolf, 2010/06/04
- [Qemu-devel] [PATCH 07/27] blockdev: Belatedly remove driveopts, Kevin Wolf, 2010/06/04
- [Qemu-devel] [PATCH 01/27] Cleanup: bdrv_open() no need to shift total_size just to shift back., Kevin Wolf, 2010/06/04
- [Qemu-devel] [PATCH 11/27] ide: Split ide_init1() off ide_init2(), Kevin Wolf, 2010/06/04
- [Qemu-devel] [PATCH 02/27] Cleanup: Be consistent and use BDRV_SECTOR_SIZE instead of 512, Kevin Wolf, 2010/06/04
- [Qemu-devel] [PATCH 04/27] Cleanup: virtio-blk.c: Be more consistent using BDRV_SECTOR_SIZE instead, Kevin Wolf, 2010/06/04
- [Qemu-devel] [PATCH 05/27] qemu-io: Fix error messages, Kevin Wolf, 2010/06/04
- [Qemu-devel] [PATCH 08/27] usb: Remove unused usb_device_add() parameter is_hotplug, Kevin Wolf, 2010/06/04
- [Qemu-devel] [PATCH 14/27] qdev: New qdev_prop_set_string(), Kevin Wolf, 2010/06/04
- [Qemu-devel] [PATCH 13/27] ide: Split non-qdev code off ide_init2(), Kevin Wolf, 2010/06/04
- [Qemu-devel] [PATCH 10/27] ide: Remove redundant IDEState member conf,
Kevin Wolf <=
- [Qemu-devel] [PATCH 12/27] ide: Change ide_init_drive() to require valid dinfo argument, Kevin Wolf, 2010/06/04
- [Qemu-devel] [PATCH 03/27] Cleanup: raw-posix.c: Be more consistent using BDRV_SECTOR_SIZE instead of 512, Kevin Wolf, 2010/06/04
- [Qemu-devel] [PATCH 09/27] ide: Remove useless IDEDeviceInfo members unit, drive, Kevin Wolf, 2010/06/04
- [Qemu-devel] [PATCH 17/27] ide: Fix info qtree for ide-drive.ver, Kevin Wolf, 2010/06/04
- [Qemu-devel] [PATCH 18/27] scsi: Turn drive serial into a qdev property scsi-disk.serial, Kevin Wolf, 2010/06/04
- [Qemu-devel] [PATCH 19/27] scsi: Fix info qtree for scsi-disk.ver, Kevin Wolf, 2010/06/04
- [Qemu-devel] [PATCH 27/27] block: Fix serial number assignment, Kevin Wolf, 2010/06/04
- [Qemu-devel] [PATCH 20/27] Fix error message in drive_init, Kevin Wolf, 2010/06/04
- [Qemu-devel] [PATCH 24/27] blockdev: Hide QEMUMachine from drive_init(), Kevin Wolf, 2010/06/04
- [Qemu-devel] [PATCH 23/27] block: call the snapshot handlers of the protocol drivers, Kevin Wolf, 2010/06/04