aboutsummaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorBALATON Zoltan <balaton@eik.bme.hu>2019-01-25 14:52:11 -0500
committerJohn Snow <jsnow@redhat.com>2019-01-25 14:52:11 -0500
commite210ec87b93cf94212b5f522d514115dc3604975 (patch)
tree25b1db5a540fe01e1db78cd5d5880c96d2802abe /hw
parent2ab2ef078504c9a4979bd5c457fdf5903292e0f7 (diff)
downloadqemu-e210ec87b93cf94212b5f522d514115dc3604975.zip
qemu-e210ec87b93cf94212b5f522d514115dc3604975.tar.gz
qemu-e210ec87b93cf94212b5f522d514115dc3604975.tar.bz2
cmd646: Remove IDEBus from CMD646BAR
The cmd646 io mem ops callbacks only need the IDEBus which is currently passed via a CMD646BAR struct. No need to wrap it up like that, we can pass it directly to these callbacks which then allows to drop the IDEBus from the CMD646BAR. Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu> Tested-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Reviewed-by: John Snow <jsnow@redhat.com> Message-id: 7a31c155c9899869794499d841d30c7ef32aae47.1547166960.git.balaton@eik.bme.hu Signed-off-by: John Snow <jsnow@redhat.com>
Diffstat (limited to 'hw')
-rw-r--r--hw/ide/cmd646.c29
1 files changed, 14 insertions, 15 deletions
diff --git a/hw/ide/cmd646.c b/hw/ide/cmd646.c
index 41c1831..c24f71e 100644
--- a/hw/ide/cmd646.c
+++ b/hw/ide/cmd646.c
@@ -53,23 +53,23 @@ static void cmd646_update_irq(PCIDevice *pd);
static uint64_t cmd646_cmd_read(void *opaque, hwaddr addr,
unsigned size)
{
- CMD646BAR *cmd646bar = opaque;
+ IDEBus *bus = opaque;
if (addr != 2 || size != 1) {
return ((uint64_t)1 << (size * 8)) - 1;
}
- return ide_status_read(cmd646bar->bus, addr + 2);
+ return ide_status_read(bus, addr + 2);
}
static void cmd646_cmd_write(void *opaque, hwaddr addr,
uint64_t data, unsigned size)
{
- CMD646BAR *cmd646bar = opaque;
+ IDEBus *bus = opaque;
if (addr != 2 || size != 1) {
return;
}
- ide_cmd_write(cmd646bar->bus, addr + 2, data);
+ ide_cmd_write(bus, addr + 2, data);
}
static const MemoryRegionOps cmd646_cmd_ops = {
@@ -81,15 +81,15 @@ static const MemoryRegionOps cmd646_cmd_ops = {
static uint64_t cmd646_data_read(void *opaque, hwaddr addr,
unsigned size)
{
- CMD646BAR *cmd646bar = opaque;
+ IDEBus *bus = opaque;
if (size == 1) {
- return ide_ioport_read(cmd646bar->bus, addr);
+ return ide_ioport_read(bus, addr);
} else if (addr == 0) {
if (size == 2) {
- return ide_data_readw(cmd646bar->bus, addr);
+ return ide_data_readw(bus, addr);
} else {
- return ide_data_readl(cmd646bar->bus, addr);
+ return ide_data_readl(bus, addr);
}
}
return ((uint64_t)1 << (size * 8)) - 1;
@@ -98,15 +98,15 @@ static uint64_t cmd646_data_read(void *opaque, hwaddr addr,
static void cmd646_data_write(void *opaque, hwaddr addr,
uint64_t data, unsigned size)
{
- CMD646BAR *cmd646bar = opaque;
+ IDEBus *bus = opaque;
if (size == 1) {
- ide_ioport_write(cmd646bar->bus, addr, data);
+ ide_ioport_write(bus, addr, data);
} else if (addr == 0) {
if (size == 2) {
- ide_data_writew(cmd646bar->bus, addr, data);
+ ide_data_writew(bus, addr, data);
} else {
- ide_data_writel(cmd646bar->bus, addr, data);
+ ide_data_writel(bus, addr, data);
}
}
}
@@ -122,10 +122,9 @@ static void setup_cmd646_bar(PCIIDEState *d, int bus_num)
IDEBus *bus = &d->bus[bus_num];
CMD646BAR *bar = &d->cmd646_bar[bus_num];
- bar->bus = bus;
- memory_region_init_io(&bar->cmd, OBJECT(d), &cmd646_cmd_ops, bar,
+ memory_region_init_io(&bar->cmd, OBJECT(d), &cmd646_cmd_ops, bus,
"cmd646-cmd", 4);
- memory_region_init_io(&bar->data, OBJECT(d), &cmd646_data_ops, bar,
+ memory_region_init_io(&bar->data, OBJECT(d), &cmd646_data_ops, bus,
"cmd646-data", 8);
}