From: "Hervé Poussineau" <hpoussin@reactos.org>
To: qemu-devel@nongnu.org
Cc: "Andreas Färber" <andreas.faerber@web.de>,
"Hervé Poussineau" <hpoussin@reactos.org>
Subject: [Qemu-devel] [PATCH 09/10] ioport: remove now useless portio_list_* functions
Date: Fri, 4 Jan 2013 22:29:44 +0100 [thread overview]
Message-ID: <1357334986-13941-10-git-send-email-hpoussin@reactos.org> (raw)
In-Reply-To: <1357334986-13941-1-git-send-email-hpoussin@reactos.org>
Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
---
include/exec/ioport.h | 19 --------
ioport.c | 121 -------------------------------------------------
2 files changed, 140 deletions(-)
diff --git a/include/exec/ioport.h b/include/exec/ioport.h
index fc28350..b02ddf7 100644
--- a/include/exec/ioport.h
+++ b/include/exec/ioport.h
@@ -56,23 +56,4 @@ uint32_t cpu_inl(pio_addr_t addr);
struct MemoryRegion;
struct MemoryRegionPortio;
-typedef struct PortioList {
- const struct MemoryRegionPortio *ports;
- struct MemoryRegion *address_space;
- unsigned nr;
- struct MemoryRegion **regions;
- struct MemoryRegion **aliases;
- void *opaque;
- const char *name;
-} PortioList;
-
-void portio_list_init(PortioList *piolist,
- const struct MemoryRegionPortio *callbacks,
- void *opaque, const char *name);
-void portio_list_destroy(PortioList *piolist);
-void portio_list_add(PortioList *piolist,
- struct MemoryRegion *address_space,
- uint32_t addr);
-void portio_list_del(PortioList *piolist);
-
#endif /* IOPORT_H */
diff --git a/ioport.c b/ioport.c
index a0ac2a0..a942a19 100644
--- a/ioport.c
+++ b/ioport.c
@@ -329,124 +329,3 @@ uint32_t cpu_inl(pio_addr_t addr)
LOG_IOPORT("inl : %04"FMT_pioaddr" %08"PRIx32"\n", addr, val);
return val;
}
-
-void portio_list_init(PortioList *piolist,
- const MemoryRegionPortio *callbacks,
- void *opaque, const char *name)
-{
- unsigned n = 0;
-
- while (callbacks[n].size) {
- ++n;
- }
-
- piolist->ports = callbacks;
- piolist->nr = 0;
- piolist->regions = g_new0(MemoryRegion *, n);
- piolist->aliases = g_new0(MemoryRegion *, n);
- piolist->address_space = NULL;
- piolist->opaque = opaque;
- piolist->name = name;
-}
-
-void portio_list_destroy(PortioList *piolist)
-{
- g_free(piolist->regions);
- g_free(piolist->aliases);
-}
-
-static void portio_list_add_1(PortioList *piolist,
- const MemoryRegionPortio *pio_init,
- unsigned count, unsigned start,
- unsigned off_low, unsigned off_high)
-{
- MemoryRegionPortio *pio;
- MemoryRegionOps *ops;
- MemoryRegion *region, *alias;
- unsigned i;
-
- /* Copy the sub-list and null-terminate it. */
- pio = g_new(MemoryRegionPortio, count + 1);
- memcpy(pio, pio_init, sizeof(MemoryRegionPortio) * count);
- memset(pio + count, 0, sizeof(MemoryRegionPortio));
-
- /* Adjust the offsets to all be zero-based for the region. */
- for (i = 0; i < count; ++i) {
- pio[i].offset -= off_low;
- }
-
- ops = g_new0(MemoryRegionOps, 1);
- ops->old_portio = pio;
-
- region = g_new(MemoryRegion, 1);
- alias = g_new(MemoryRegion, 1);
- /*
- * Use an alias so that the callback is called with an absolute address,
- * rather than an offset relative to to start + off_low.
- */
- memory_region_init_io(region, ops, piolist->opaque, piolist->name,
- INT64_MAX);
- memory_region_init_alias(alias, piolist->name,
- region, start + off_low, off_high - off_low);
- memory_region_add_subregion(piolist->address_space,
- start + off_low, alias);
- piolist->regions[piolist->nr] = region;
- piolist->aliases[piolist->nr] = alias;
- ++piolist->nr;
-}
-
-void portio_list_add(PortioList *piolist,
- MemoryRegion *address_space,
- uint32_t start)
-{
- const MemoryRegionPortio *pio, *pio_start = piolist->ports;
- unsigned int off_low, off_high, off_last, count;
-
- piolist->address_space = address_space;
-
- /* Handle the first entry specially. */
- off_last = off_low = pio_start->offset;
- off_high = off_low + pio_start->len;
- count = 1;
-
- for (pio = pio_start + 1; pio->size != 0; pio++, count++) {
- /* All entries must be sorted by offset. */
- assert(pio->offset >= off_last);
- off_last = pio->offset;
-
- /* If we see a hole, break the region. */
- if (off_last > off_high) {
- portio_list_add_1(piolist, pio_start, count, start, off_low,
- off_high);
- /* ... and start collecting anew. */
- pio_start = pio;
- off_low = off_last;
- off_high = off_low + pio->len;
- count = 0;
- } else if (off_last + pio->len > off_high) {
- off_high = off_last + pio->len;
- }
- }
-
- /* There will always be an open sub-list. */
- portio_list_add_1(piolist, pio_start, count, start, off_low, off_high);
-}
-
-void portio_list_del(PortioList *piolist)
-{
- MemoryRegion *mr, *alias;
- unsigned i;
-
- for (i = 0; i < piolist->nr; ++i) {
- mr = piolist->regions[i];
- alias = piolist->aliases[i];
- memory_region_del_subregion(piolist->address_space, alias);
- memory_region_destroy(alias);
- memory_region_destroy(mr);
- g_free((MemoryRegionOps *)mr->ops);
- g_free(mr);
- g_free(alias);
- piolist->regions[i] = NULL;
- piolist->aliases[i] = NULL;
- }
-}
--
1.7.10.4
next prev parent reply other threads:[~2013-01-04 21:30 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-04 21:29 [Qemu-devel] [PATCH 00/10] memory: remove old_portio usage Hervé Poussineau
2013-01-04 21:29 ` [Qemu-devel] [PATCH 01/10] ppc/newworld: add ISA bus, required by VGA card Hervé Poussineau
2013-01-12 16:03 ` Andreas Färber
2013-01-04 21:29 ` [Qemu-devel] [PATCH 02/10] ppc/oldworld: " Hervé Poussineau
2013-01-04 21:29 ` [Qemu-devel] [PATCH 03/10] uhci: stop using portio lists Hervé Poussineau
2013-01-10 17:18 ` Andreas Färber
2013-01-11 7:38 ` Gerd Hoffmann
2013-01-04 21:29 ` [Qemu-devel] [PATCH 04/10] sun4u: create VGA card after ISA bus Hervé Poussineau
2013-01-10 17:24 ` Andreas Färber
2013-01-10 19:30 ` Hervé Poussineau
2013-01-12 11:42 ` Blue Swirl
2013-01-12 15:58 ` Andreas Färber
2013-01-04 21:29 ` [Qemu-devel] [PATCH 05/10] xen_platform: do not use old_portio-style callbacks Hervé Poussineau
2013-01-04 21:29 ` Hervé Poussineau
2013-01-12 16:06 ` [Qemu-devel] " Andreas Färber
2013-01-12 16:06 ` Andreas Färber
2013-01-15 17:09 ` [Qemu-devel] " Andreas Färber
2013-01-15 17:09 ` Andreas Färber
2013-01-15 17:43 ` [Qemu-devel] " Stefano Stabellini
2013-01-15 17:43 ` Stefano Stabellini
2013-01-04 21:29 ` [Qemu-devel] [PATCH 06/10] acpi-piix4: " Hervé Poussineau
2013-01-12 16:20 ` Andreas Färber
2013-01-12 18:02 ` Andreas Färber
2013-01-12 19:20 ` Hervé Poussineau
2013-01-04 21:29 ` [Qemu-devel] [PATCH 07/10] vga/qxl: do not use portio_list_init/portio_list_add Hervé Poussineau
2013-01-04 21:29 ` [Qemu-devel] [PATCH 08/10] isa: use memory regions instead of portio_list_* functions Hervé Poussineau
2013-01-12 19:21 ` Andreas Färber
2013-01-04 21:29 ` Hervé Poussineau [this message]
2013-01-04 21:29 ` [Qemu-devel] [PATCH 10/10] memory: remove old_portio-style callbacks support Hervé Poussineau
2013-01-10 17:45 ` Andreas Färber
2013-01-10 19:33 ` Hervé Poussineau
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=1357334986-13941-10-git-send-email-hpoussin@reactos.org \
--to=hpoussin@reactos.org \
--cc=andreas.faerber@web.de \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.