From: John Snow <jsnow@redhat.com>
To: qemu-devel@nongnu.org
Cc: peter.maydell@linaro.org, jsnow@redhat.com,
BALATON Zoltan <balaton@eik.bme.hu>
Subject: [Qemu-devel] [PULL 2/8] cmd646: Remove IDEBus from CMD646BAR
Date: Fri, 25 Jan 2019 17:06:42 -0500 [thread overview]
Message-ID: <20190125220648.28164-3-jsnow@redhat.com> (raw)
In-Reply-To: <20190125220648.28164-1-jsnow@redhat.com>
From: BALATON Zoltan <balaton@eik.bme.hu>
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>
---
hw/ide/cmd646.c | 29 ++++++++++++++---------------
include/hw/ide/pci.h | 1 -
2 files changed, 14 insertions(+), 16 deletions(-)
diff --git a/hw/ide/cmd646.c b/hw/ide/cmd646.c
index 41c1831f9a..c24f71e219 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);
}
diff --git a/include/hw/ide/pci.h b/include/hw/ide/pci.h
index ed723acfb4..013d7937d2 100644
--- a/include/hw/ide/pci.h
+++ b/include/hw/ide/pci.h
@@ -40,7 +40,6 @@ typedef struct BMDMAState {
typedef struct CMD646BAR {
MemoryRegion cmd;
MemoryRegion data;
- IDEBus *bus;
} CMD646BAR;
#define TYPE_PCI_IDE "pci-ide"
--
2.17.2
next prev parent reply other threads:[~2019-01-25 22:07 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-25 22:06 [Qemu-devel] [PULL 0/8] Ide patches John Snow
2019-01-25 22:06 ` [Qemu-devel] [PULL 1/8] cmd646: Remove unused variable John Snow
2019-01-25 22:06 ` John Snow [this message]
2019-01-25 22:06 ` [Qemu-devel] [PULL 3/8] cmd646: Move PCI IDE specific functions to ide/pci.c John Snow
2019-01-25 22:06 ` [Qemu-devel] [PULL 4/8] ide: Get rid of CMD646BAR struct John Snow
2019-01-25 22:06 ` [Qemu-devel] [PULL 5/8] sii3112: Remove duplicated code and use PCI IDE ops instead John Snow
2019-01-25 22:06 ` [Qemu-devel] [PULL 6/8] ide/via: Remove vt82c686b_init_ports() function John Snow
2019-01-25 22:06 ` [Qemu-devel] [PULL 7/8] ide/via: Rename functions to match device name John Snow
2019-01-25 22:06 ` [Qemu-devel] [PULL 8/8] ide/via: Implement and use native PCI IDE mode John Snow
2019-01-28 15:27 ` [Qemu-devel] [PULL 0/8] Ide patches Peter Maydell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190125220648.28164-3-jsnow@redhat.com \
--to=jsnow@redhat.com \
--cc=balaton@eik.bme.hu \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).