public inbox for linuxppc-dev@ozlabs.org 
 help / color / mirror / Atom feed
From: mostrows@watson•ibm.com
To: linuxppc-dev@ozlabs•org
Subject: [PATCH 2/8] PIC discovery re-organization.
Date: Mon, 29 May 2006 16:42:05 -0400	[thread overview]
Message-ID: <1148935325129-git-send-email-mostrows@watson.ibm.com> (raw)
In-Reply-To: <1148935262.25048.31.camel@brick>

Change pSeries_discover_pic() to simply return the PIC type, rather
than setting the global "ppc64_interrupt_controller" value.  They type of
controller present will be passed down as an argument to functions
that need it.

--
Signed-off-by: Michal Ostrowski <mostrows@watson•ibm.com>

---

 arch/powerpc/platforms/pseries/setup.c |   36 +++++++++++++++++---------------
 1 files changed, 19 insertions(+), 17 deletions(-)

3675f032e1b03d6f000ffb08b2487ee9aa44fa2d
diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c
index 9d22265..33ae521 100644
--- a/arch/powerpc/platforms/pseries/setup.c
+++ b/arch/powerpc/platforms/pseries/setup.c
@@ -83,6 +83,7 @@ int fwnmi_active;  /* TRUE if an FWNMI h
 
 static void pseries_shared_idle_sleep(void);
 static void pseries_dedicated_idle_sleep(void);
+static  int pSeries_discover_pic(void);
 
 struct mpic *pSeries_mpic;
 
@@ -195,8 +196,11 @@ static void pseries_lpar_enable_pmcs(voi
 
 static void __init pSeries_setup_arch(void)
 {
+	int int_ctrl = pSeries_discover_pic();
+	ppc64_interrupt_controller = int_ctrl;
+
 	/* Fixup ppc_md depending on the type of interrupt controller */
-	if (ppc64_interrupt_controller == IC_OPEN_PIC) {
+	if (int_ctrl == IC_OPEN_PIC) {
 		ppc_md.init_IRQ       = pSeries_init_mpic;
 		ppc_md.get_irq        = mpic_get_irq;
 		/* Allocate the mpic now, so that find_and_init_phbs() can
@@ -261,39 +265,30 @@ static int __init pSeries_init_panel(voi
 }
 arch_initcall(pSeries_init_panel);
 
-static  void __init pSeries_discover_pic(void)
+static  int __init pSeries_discover_pic(void)
 {
 	struct device_node *np;
 	char *typep;
-
 	/*
 	 * Setup interrupt mapping options that are needed for finish_device_tree
 	 * to properly parse the OF interrupt tree & do the virtual irq mapping
 	 */
-	ppc64_interrupt_controller = IC_INVALID;
+	int int_ctrl = IC_INVALID;
 	for (np = NULL; (np = of_find_node_by_name(np, "interrupt-controller"));) {
 		typep = (char *)get_property(np, "compatible", NULL);
 		if (strstr(typep, "open-pic")) {
-			ppc64_interrupt_controller = IC_OPEN_PIC;
+			int_ctrl = IC_OPEN_PIC;
 			break;
 		} else if (strstr(typep, "ppc-xicp")) {
-			ppc64_interrupt_controller = IC_PPC_XIC;
+			int_ctrl = IC_PPC_XIC;
 			break;
 		}
 	}
-	if (ppc64_interrupt_controller == IC_INVALID)
+	if (int_ctrl == IC_INVALID)
 		printk("pSeries_discover_pic: failed to recognize"
 			" interrupt-controller\n");
 
-	/*
-	 * Don't use virtual irqs 0, 1, 2 for devices.
-	 * The pcnet32 driver considers interrupt numbers < 2 to be invalid,
-	 * and 2 is the XICS IPI interrupt.
-	 */
-	
-	virt_irq_config(NUM_ISA_INTERRUPTS, 3,  
-			NR_IRQS - (3 + NUM_ISA_INTERRUPTS));
-
+	return int_ctrl;
 }
 
 static void pSeries_mach_cpu_die(void)
@@ -346,7 +341,14 @@ static void __init pSeries_init_early(vo
 
 	iommu_init_early_pSeries();
 
-	pSeries_discover_pic();
+	/*
+	 * Don't use virtual irqs 0, 1, 2 for devices.
+	 * The pcnet32 driver considers interrupt numbers < 2 to be invalid,
+	 * and 2 is the XICS IPI interrupt.
+	 */
+	
+	virt_irq_config(NUM_ISA_INTERRUPTS, 3,  
+			NR_IRQS - (3 + NUM_ISA_INTERRUPTS));
 
 	DBG(" <- pSeries_init_early()\n");
 }
-- 
1.1.4.g0b63-dirty

  parent reply	other threads:[~2006-05-29 20:42 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-05-29 20:41 [RFC/PATCH 0/8] Overhaul of virt IRQ configuration. / Kill ppc64_interrupt_controller Michal Ostrowski
2006-05-29 20:42 ` [PATCH 3/8] Avoid use of ppc64_interrupt_controller mostrows
2006-05-29 20:42 ` [PATCH 1/8] Formalize virtual-IRQ remapping configuration mostrows
2006-05-29 20:42 ` [PATCH 4/8] Avoid use of ppc64_interrupt_controller mostrows
2006-05-29 20:42 ` mostrows [this message]
2006-05-29 20:42 ` [PATCH 7/8] Cleaner checks for MPIC on pSeries mostrows
2006-05-29 20:50   ` Olof Johansson
2006-05-29 20:42 ` [PATCH 6/8] Avoid use of ppc64_interrupt_controller mostrows
2006-05-29 20:42 ` [PATCH 8/8] Kill the ppc64_interrupt_controller global symbol mostrows
2006-05-29 20:42 ` [PATCH 5/8] Avoid use of ppc64_interrupt_controller mostrows
2006-05-29 21:28 ` [RFC/PATCH 0/8] Overhaul of virt IRQ configuration. / Kill ppc64_interrupt_controller Benjamin Herrenschmidt
2006-05-29 23:08   ` Michal Ostrowski
2006-05-30 13:54   ` Michal Ostrowski
2006-05-30 22:13     ` Benjamin Herrenschmidt
2006-05-30 22:53       ` Michal Ostrowski
2006-05-30 23:10         ` Benjamin Herrenschmidt
2006-05-29 21:56 ` Paul Mackerras

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=1148935325129-git-send-email-mostrows@watson.ibm.com \
    --to=mostrows@watson$(echo .)ibm.com \
    --cc=linuxppc-dev@ozlabs$(echo .)org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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