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 6/8] ide/via: Remove vt82c686b_init_ports() function
Date: Fri, 25 Jan 2019 17:06:46 -0500 [thread overview]
Message-ID: <20190125220648.28164-7-jsnow@redhat.com> (raw)
In-Reply-To: <20190125220648.28164-1-jsnow@redhat.com>
From: BALATON Zoltan <balaton@eik.bme.hu>
This function is only called once from vt82c686b_ide_realize() and its
content is simple enough to not need a separate function but be
included in realize directly (as done in other IDE models except PIIX
currently).
Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
Message-id: 47d854e0fa41dad6861107eac61327c247965566.1548160772.git.balaton@eik.bme.hu
Signed-off-by: John Snow <jsnow@redhat.com>
---
hw/ide/via.c | 44 ++++++++++++++++++++------------------------
1 file changed, 20 insertions(+), 24 deletions(-)
diff --git a/hw/ide/via.c b/hw/ide/via.c
index 987d99c5ec..46cac7b8d6 100644
--- a/hw/ide/via.c
+++ b/hw/ide/via.c
@@ -32,6 +32,15 @@
#include "hw/ide/pci.h"
#include "trace.h"
+static const struct {
+ int iobase;
+ int iobase2;
+ int isairq;
+} port_info[] = {
+ {0x1f0, 0x3f6, 14},
+ {0x170, 0x376, 15},
+};
+
static uint64_t bmdma_read(void *opaque, hwaddr addr,
unsigned size)
{
@@ -143,34 +152,12 @@ static void via_reset(void *opaque)
pci_set_long(pci_conf + 0xc0, 0x00020001);
}
-static void vt82c686b_init_ports(PCIIDEState *d) {
- static const struct {
- int iobase;
- int iobase2;
- int isairq;
- } port_info[] = {
- {0x1f0, 0x3f6, 14},
- {0x170, 0x376, 15},
- };
- int i;
-
- for (i = 0; i < 2; i++) {
- ide_bus_new(&d->bus[i], sizeof(d->bus[i]), DEVICE(d), i, 2);
- ide_init_ioport(&d->bus[i], NULL, port_info[i].iobase,
- port_info[i].iobase2);
- ide_init2(&d->bus[i], isa_get_irq(NULL, port_info[i].isairq));
-
- bmdma_init(&d->bus[i], &d->bmdma[i], d);
- d->bmdma[i].bus = &d->bus[i];
- ide_register_restart_cb(&d->bus[i]);
- }
-}
-
/* via ide func */
static void vt82c686b_ide_realize(PCIDevice *dev, Error **errp)
{
PCIIDEState *d = PCI_IDE(dev);
uint8_t *pci_conf = dev->config;
+ int i;
pci_config_set_prog_interface(pci_conf, 0x8a); /* legacy ATA mode */
pci_set_long(pci_conf + PCI_CAPABILITY_LIST, 0x000000c0);
@@ -181,7 +168,16 @@ static void vt82c686b_ide_realize(PCIDevice *dev, Error **errp)
vmstate_register(DEVICE(dev), 0, &vmstate_ide_pci, d);
- vt82c686b_init_ports(d);
+ for (i = 0; i < 2; i++) {
+ ide_bus_new(&d->bus[i], sizeof(d->bus[i]), DEVICE(d), i, 2);
+ ide_init_ioport(&d->bus[i], NULL, port_info[i].iobase,
+ port_info[i].iobase2);
+ ide_init2(&d->bus[i], isa_get_irq(NULL, port_info[i].isairq));
+
+ bmdma_init(&d->bus[i], &d->bmdma[i], d);
+ d->bmdma[i].bus = &d->bus[i];
+ ide_register_restart_cb(&d->bus[i]);
+ }
}
static void vt82c686b_ide_exitfn(PCIDevice *dev)
--
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 ` [Qemu-devel] [PULL 2/8] cmd646: Remove IDEBus from CMD646BAR John Snow
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 ` John Snow [this message]
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-7-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).