From: Scott Wood <scottwood@freescale.com>
To: Alexander Graf <agraf@suse.de>
Cc: "qemu-ppc@nongnu.org List" <qemu-ppc@nongnu.org>,
qemu-devel qemu-devel <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [Qemu-ppc] [PATCH 3/5] PPC: E500: Generate dt pci irq map dynamically
Date: Wed, 12 Dec 2012 12:40:25 -0600 [thread overview]
Message-ID: <1355337625.28445.2@snotra> (raw)
In-Reply-To: <1355321398-23393-4-git-send-email-agraf@suse.de> (from agraf@suse.de on Wed Dec 12 08:09:56 2012)
On 12/12/2012 08:09:56 AM, Alexander Graf wrote:
> Today we're hardcoding the PCI interrupt map in the e500 machine file.
> Instead, let's write it dynamically so that different machine types
> can have different slot properties.
>
> Signed-off-by: Alexander Graf <agraf@suse.de>
> ---
> hw/ppc/e500.c | 51
> +++++++++++++++++++++++++++++++--------------------
> 1 files changed, 31 insertions(+), 20 deletions(-)
>
> diff --git a/hw/ppc/e500.c b/hw/ppc/e500.c
> index 1034f93..ebb6d96 100644
> --- a/hw/ppc/e500.c
> +++ b/hw/ppc/e500.c
> @@ -66,25 +66,33 @@ struct boot_info
> uint32_t entry;
> };
>
> -static void pci_map_create(void *fdt, uint32_t *pci_map, uint32_t
> mpic)
> +static uint32_t *pci_map_create(void *fdt, uint32_t mpic, int
> first_slot,
> + int nr_slots, int *len)
> {
> - int i;
> - const uint32_t tmp[] = {
> - /* IDSEL 0x11 J17 Slot 1 */
> - 0x8800, 0x0, 0x0, 0x1, mpic, 0x2, 0x1,
> - 0x8800, 0x0, 0x0, 0x2, mpic, 0x3, 0x1,
> - 0x8800, 0x0, 0x0, 0x3, mpic, 0x4, 0x1,
> - 0x8800, 0x0, 0x0, 0x4, mpic, 0x1, 0x1,
> -
> - /* IDSEL 0x12 J16 Slot 2 */
> - 0x9000, 0x0, 0x0, 0x1, mpic, 0x3, 0x1,
> - 0x9000, 0x0, 0x0, 0x2, mpic, 0x4, 0x1,
> - 0x9000, 0x0, 0x0, 0x3, mpic, 0x2, 0x1,
> - 0x9000, 0x0, 0x0, 0x4, mpic, 0x1, 0x1,
> - };
> - for (i = 0; i < (7 * 8); i++) {
> - pci_map[i] = cpu_to_be32(tmp[i]);
> + int i = 0;
> + int slot;
> + int pci_irq;
> + int last_slot = first_slot + nr_slots;
> + uint32_t *pci_map;
> +
> + *len = nr_slots * 4 * 7 * sizeof(uint32_t);
> + pci_map = g_malloc(*len);
> +
> + for (slot = first_slot; slot < last_slot; slot++) {
> + for (pci_irq = 0; pci_irq < 4; pci_irq++) {
> + pci_map[i++] = cpu_to_be32(slot << 11);
> + pci_map[i++] = cpu_to_be32(0x0);
> + pci_map[i++] = cpu_to_be32(0x0);
> + pci_map[i++] = cpu_to_be32(pci_irq + 1);
> + pci_map[i++] = cpu_to_be32(mpic);
> + pci_map[i++] = cpu_to_be32(((pci_irq + slot) % 4) + 1);
> + pci_map[i++] = cpu_to_be32(0x1);
> + }
> }
It would be nice if the slot-to-IRQ calculation were done in only one
place rather than duplicated here.
-Scott
next prev parent reply other threads:[~2012-12-12 18:41 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-12-12 14:09 [Qemu-devel] [PATCH 0/5] PPC: e500: Enable more PCI slots for -M ppce500 Alexander Graf
2012-12-12 14:09 ` [Qemu-devel] [PATCH 1/5] PPC: E500: PCI: Make first slot qdev settable Alexander Graf
2012-12-12 14:09 ` [Qemu-devel] [PATCH 2/5] PPC: E500: PCI: Make IRQ calculation more generic Alexander Graf
2012-12-12 14:09 ` [Qemu-devel] [PATCH 3/5] PPC: E500: Generate dt pci irq map dynamically Alexander Graf
2012-12-12 18:40 ` Scott Wood [this message]
2012-12-12 23:38 ` [Qemu-devel] [Qemu-ppc] " Alexander Graf
2012-12-12 23:43 ` Scott Wood
2012-12-13 0:04 ` Alexander Graf
2012-12-13 0:20 ` Scott Wood
2012-12-13 0:28 ` Alexander Graf
2012-12-13 0:33 ` Scott Wood
2012-12-13 0:36 ` Alexander Graf
2012-12-12 14:09 ` [Qemu-devel] [PATCH 4/5] PPC: E500: Move PCI slot information into params Alexander Graf
2012-12-12 14:09 ` [Qemu-devel] [PATCH 5/5] PPC: E500plat: Make a lot of PCI slots available Alexander Graf
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=1355337625.28445.2@snotra \
--to=scottwood@freescale.com \
--cc=agraf@suse.de \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@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).