From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:56282) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tivy0-00076k-7Z for qemu-devel@nongnu.org; Wed, 12 Dec 2012 18:43:58 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Tivxx-0000yE-M9 for qemu-devel@nongnu.org; Wed, 12 Dec 2012 18:43:56 -0500 Date: Wed, 12 Dec 2012 17:43:43 -0600 From: Scott Wood References: <1355321398-23393-1-git-send-email-agraf@suse.de> <1355321398-23393-4-git-send-email-agraf@suse.de> <1355337625.28445.2@snotra> <202A4015-19A0-4B44-B27C-92F7ABED560D@suse.de> In-Reply-To: <202A4015-19A0-4B44-B27C-92F7ABED560D@suse.de> (from agraf@suse.de on Wed Dec 12 17:38:32 2012) Message-ID: <1355355823.28445.18@snotra> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; delsp=Yes; format=Flowed Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [Qemu-ppc] [PATCH 3/5] PPC: E500: Generate dt pci irq map dynamically List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alexander Graf Cc: "qemu-ppc@nongnu.org List" , qemu-devel qemu-devel On 12/12/2012 05:38:32 PM, Alexander Graf wrote: >=20 > On 12.12.2012, at 19:40, Scott Wood wrote: >=20 > > On 12/12/2012 08:09:56 AM, Alexander Graf wrote: > >> + for (slot =3D first_slot; slot < last_slot; slot++) { > >> + for (pci_irq =3D 0; pci_irq < 4; pci_irq++) { > >> + pci_map[i++] =3D cpu_to_be32(slot << 11); > >> + pci_map[i++] =3D cpu_to_be32(0x0); > >> + pci_map[i++] =3D cpu_to_be32(0x0); > >> + pci_map[i++] =3D cpu_to_be32(pci_irq + 1); > >> + pci_map[i++] =3D cpu_to_be32(mpic); > >> + pci_map[i++] =3D cpu_to_be32(((pci_irq + slot) % 4) + =20 > 1); > >> + pci_map[i++] =3D cpu_to_be32(0x1); > >> + } > >> } > > > > It would be nice if the slot-to-IRQ calculation were done in only =20 > one place rather than duplicated here. >=20 > Sure, what exactly would you suggest to do? :) Have a common function to calculate the IRQ given the slot number, and =20 call that both from here and from mpc85xx_pci_map_irq(). > We can move the whole function to ppce500_pci.c. > We could export the function(slot, pci_irq) through the header of =20 > ppce500_pci.c. Either works, though I'd lean towards moving this function into =20 ppce500_pci.c. > We could also try and traverse the pci bus to find the function that =20 > is actually called to convert irq numbers internally, so we =20 > potentially support other pci host controllers. Not sure what you mean here. -Scott=