From: Bernhard Beschow <shentey@gmail.com>
To: qemu-devel@nongnu.org
Cc: qemu-trivial@nongnu.org, "Bernhard Beschow" <shentey@gmail.com>,
"Mark Cave-Ayland" <mark.cave-ayland@ilande.co.uk>,
"Philippe Mathieu-Daudé" <f4bug@amsat.org>,
"Michael S. Tsirkin" <mst@redhat.com>,
"Marcel Apfelbaum" <marcel.apfelbaum@gmail.com>,
"Hervé Poussineau" <hpoussin@reactos.org>,
"Aurelien Jarno" <aurelien@aurel32.net>
Subject: [PATCH v3 3/7] hw/isa/piix{3, 4}: Move pci_map_irq_fn's near pci_set_irq_fn's
Date: Sat, 28 May 2022 21:20:52 +0200 [thread overview]
Message-ID: <20220528192057.30910-4-shentey@gmail.com> (raw)
In-Reply-To: <20220528192057.30910-1-shentey@gmail.com>
The pci_map_irq_fn's were implemented below type_init() which made them
inaccessible to QOM functions. So move them up.
Signed-off-by: Bernhard Beschow <shentey@gmail.com>
Reviewed-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
hw/isa/piix3.c | 22 +++++++++++-----------
hw/isa/piix4.c | 50 +++++++++++++++++++++++++-------------------------
2 files changed, 36 insertions(+), 36 deletions(-)
diff --git a/hw/isa/piix3.c b/hw/isa/piix3.c
index d96ce2b788..c7a9014c3f 100644
--- a/hw/isa/piix3.c
+++ b/hw/isa/piix3.c
@@ -78,6 +78,17 @@ static void piix3_set_irq(void *opaque, int pirq, int level)
piix3_set_irq_level(piix3, pirq, level);
}
+/*
+ * Return the global irq number corresponding to a given device irq
+ * pin. We could also use the bus number to have a more precise mapping.
+ */
+static int pci_slot_get_pirq(PCIDevice *pci_dev, int pci_intx)
+{
+ int slot_addend;
+ slot_addend = PCI_SLOT(pci_dev->devfn) - 1;
+ return (pci_intx + slot_addend) & 3;
+}
+
static PCIINTxRoute piix3_route_intx_pin_to_irq(void *opaque, int pin)
{
PIIX3State *piix3 = opaque;
@@ -350,17 +361,6 @@ static void piix3_register_types(void)
type_init(piix3_register_types)
-/*
- * Return the global irq number corresponding to a given device irq
- * pin. We could also use the bus number to have a more precise mapping.
- */
-static int pci_slot_get_pirq(PCIDevice *pci_dev, int pci_intx)
-{
- int slot_addend;
- slot_addend = PCI_SLOT(pci_dev->devfn) - 1;
- return (pci_intx + slot_addend) & 3;
-}
-
PIIX3State *piix3_create(PCIBus *pci_bus, ISABus **isa_bus)
{
PIIX3State *piix3;
diff --git a/hw/isa/piix4.c b/hw/isa/piix4.c
index 1d04fb6a55..18aa24424f 100644
--- a/hw/isa/piix4.c
+++ b/hw/isa/piix4.c
@@ -74,6 +74,31 @@ static void piix4_set_irq(void *opaque, int irq_num, int level)
}
}
+static int pci_slot_get_pirq(PCIDevice *pci_dev, int irq_num)
+{
+ int slot;
+
+ slot = PCI_SLOT(pci_dev->devfn);
+
+ switch (slot) {
+ /* PIIX4 USB */
+ case 10:
+ return 3;
+ /* AMD 79C973 Ethernet */
+ case 11:
+ return 1;
+ /* Crystal 4281 Sound */
+ case 12:
+ return 2;
+ /* PCI slot 1 to 4 */
+ case 18 ... 21:
+ return ((slot - 18) + irq_num) & 0x03;
+ /* Unknown device, don't do any translation */
+ default:
+ return irq_num;
+ }
+}
+
static void piix4_isa_reset(DeviceState *dev)
{
PIIX4State *d = PIIX4_PCI_DEVICE(dev);
@@ -266,31 +291,6 @@ static void piix4_register_types(void)
type_init(piix4_register_types)
-static int pci_slot_get_pirq(PCIDevice *pci_dev, int irq_num)
-{
- int slot;
-
- slot = PCI_SLOT(pci_dev->devfn);
-
- switch (slot) {
- /* PIIX4 USB */
- case 10:
- return 3;
- /* AMD 79C973 Ethernet */
- case 11:
- return 1;
- /* Crystal 4281 Sound */
- case 12:
- return 2;
- /* PCI slot 1 to 4 */
- case 18 ... 21:
- return ((slot - 18) + irq_num) & 0x03;
- /* Unknown device, don't do any translation */
- default:
- return irq_num;
- }
-}
-
DeviceState *piix4_create(PCIBus *pci_bus, ISABus **isa_bus, I2CBus **smbus)
{
PIIX4State *s;
--
2.36.1
next prev parent reply other threads:[~2022-05-28 19:27 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-28 19:20 [PATCH v3 0/7] QOM'ify PIIX southbridge creation Bernhard Beschow
2022-05-28 19:20 ` [PATCH v3 1/7] include/hw/southbridge/piix: Aggregate all PIIX soughbridge type names Bernhard Beschow
2022-05-29 9:05 ` Mark Cave-Ayland
2022-05-29 18:09 ` Bernhard Beschow
2022-05-30 13:19 ` Philippe Mathieu-Daudé via
2022-06-01 21:34 ` Bernhard Beschow
2022-05-28 19:20 ` [PATCH v3 2/7] hw/isa/piix4: Use object_initialize_child() for embedded struct Bernhard Beschow
2022-05-30 11:38 ` Philippe Mathieu-Daudé via
2022-06-01 21:36 ` Bernhard Beschow
2022-05-28 19:20 ` Bernhard Beschow [this message]
2022-05-28 19:20 ` [PATCH v3 4/7] hw/isa/piix{3, 4}: QOM'ify PCI device creation and wiring Bernhard Beschow
2022-05-30 13:17 ` Philippe Mathieu-Daudé via
2022-05-30 21:00 ` [PATCH v3 4/7] hw/isa/piix{3,4}: " Bernhard Beschow
2022-05-28 19:20 ` [PATCH v3 5/7] hw/isa/piix{3, 4}: Factor out ISABus retrieval from create() functions Bernhard Beschow
2022-05-28 19:20 ` [PATCH v3 6/7] hw/isa/piix4: QOM'ify PIIX4 PM creation Bernhard Beschow
2022-05-29 9:25 ` Mark Cave-Ayland
2022-05-29 18:05 ` Bernhard Beschow
2022-05-30 19:58 ` Mark Cave-Ayland
2022-06-01 21:39 ` Bernhard Beschow
2022-05-28 19:20 ` [PATCH v3 7/7] hw/isa/piix{3, 4}: Inline and remove create() functions Bernhard Beschow
2022-05-29 9:46 ` [PATCH v3 0/7] QOM'ify PIIX southbridge creation Mark Cave-Ayland
2022-05-29 10:06 ` Mark Cave-Ayland
2022-05-29 13:02 ` Bernhard Beschow
2022-05-30 19:11 ` Mark Cave-Ayland
2022-05-30 19:45 ` Philippe Mathieu-Daudé via
2022-06-04 8:36 ` Bernhard Beschow
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=20220528192057.30910-4-shentey@gmail.com \
--to=shentey@gmail.com \
--cc=aurelien@aurel32.net \
--cc=f4bug@amsat.org \
--cc=hpoussin@reactos.org \
--cc=marcel.apfelbaum@gmail.com \
--cc=mark.cave-ayland@ilande.co.uk \
--cc=mst@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-trivial@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).