Skip to contentSkip to conversation

Yet another INIT handler

PATCH Zoltan Menyhart 1 participant 1 message Jan 15, 2004

lore
Share & tools
lore
#0 lore raw

As the MCA hand-off procedure differs just a bit from that of the INIT, with a slight addition, I can handle the INITs, too.

Predicates can tell what to deal with in our mca_asm1.S.

Currently, my stuff is activated only if the kernel is compiled in debug mode, otherwise the original routines take the INIT.

You push the button, each CPU goes in to the high level INIT routine, prints out the most important registers ( in order to demonstrate that we've caught the INIT ), and - if the PSP.co is on, - it returns with success.

We could call the KDB from the high level INIT routine.

The key features of the INIT handler are:

* Everything is CPU local ( an MCA data area is allocated and hooked to each "cpuinfo" structure, there is room for the INIT, too )

* No locks to protect the stack, the RSE, ...

* No rendezvous
- Does not seem to work if not all the CPUs are started up,

    i.e. you specify a "maxcpus=<NUM>"...

* No monarch, nor slave
- All CPUs enter the high level INIT routine
- The KDB has got a chance to synchronize them :-)

* The same data structure as for our MCA
- The KDB can use common routines

There is a lock in the high level INIT routine for not to mix up the print-outs.

Why do I use another, separate data area for the INIT ? If I am lost in my MCA handler, and I push the button...

This patch is against the version 2.6.1 + kdb-v4.3-2.6.1-common-b0.bz2 + kdb-v4.3-2.6.1-ia64-b0.bz2 + our MCA patch (ftp://visibull.frec.bull.fr/pub/linux/mca/mca.patch-jan-14 )

Your remarks will be appreciated.

Zoltan Menyhart

arch/ia64/kernel/mca.c +11 -0
diff -ruN tmp/arch/ia64/kernel/mca.c linux-2.6.1-jan-15/arch/ia64/kernel/mca.c
@@ -121,8 +121,14 @@
 u64				ia64_mca_serialize;
 static void			ia64_mca_wakeup_ipi_wait(void);
 static void			ia64_log_init(int);
+
+#if defined(CONFIG_DEBUG_KERNEL)			// Temporary :-)
+extern void			ia64_os_init_dispatch(void);
+#else
 extern void			ia64_monarch_init_handler (void);
 extern void			ia64_slave_init_handler (void);
+#endif
+
 static u64			ia64_log_get(int sal_info_type, u8 **buffer);
 extern struct hw_interrupt_type	irq_type_iosapic_level;
 
@@ -710,8 +716,13 @@
 void __init
 ia64_mca_init(void)
 {
+#if defined(CONFIG_DEBUG_KERNEL)			// Temporary :-)
+	ia64_fptr_t *mon_init_ptr = (ia64_fptr_t *)ia64_os_init_dispatch;
+	ia64_fptr_t *slave_init_ptr = (ia64_fptr_t *)ia64_os_init_dispatch;
+#else
 	ia64_fptr_t *mon_init_ptr = (ia64_fptr_t *)ia64_monarch_init_handler;
 	ia64_fptr_t *slave_init_ptr = (ia64_fptr_t *)ia64_slave_init_handler;
+#endif
 	ia64_fptr_t *mca_hldlr_ptr = (ia64_fptr_t *)ia64_os_mca_dispatch;
 	int i;
 	s64 rc;
arch/ia64/kernel/mca1.c +68 -6

108 lines not on this page · raw message

arch/ia64/kernel/mca_asm.S +7 -0
diff -ruN tmp/arch/ia64/kernel/mca_asm.S linux-2.6.1-jan-15/arch/ia64/kernel/mca_asm.S
@@ -501,6 +501,9 @@
 //EndStub//////////////////////////////////////////////////////////////////////
 
 
+#if !defined(CONFIG_DEBUG_KERNEL)
+
+
 #ifndef	CONFIG_KDB
 // ok, the issue here is that we need to save state information so
 // it can be useable by the kernel debugger and show regs routines.
@@ -730,3 +733,7 @@
 
 1:	br.sptk 1b
 END(ia64_slave_init_handler)
+
+
+#endif // #if !defined(CONFIG_DEBUG_KERNEL)
+
arch/ia64/kernel/mca_asm1.S +103 -45

253 lines not on this page · raw message

arch/ia64/kernel/mca_util.c +6 -4
diff -ruN tmp/arch/ia64/kernel/mca_util.c linux-2.6.1-jan-15/arch/ia64/kernel/mca_util.c
@@ -241,21 +241,23 @@
 /*
  * Clear the processor and platform information logged by SAL.
  *
+ * Inputs:	type:		SAL_INFO_TYPE_MCA, ...
+ *
  * Returns:	The status from SAL_CLEAR_STATE_INFO
  */
 int
-mca_sal_clear_state_info(void)
+mca_sal_clear_state_info(unsigned int type)
 {
 	s64	status;
 
 	KDBA_MCA_TRACE();
-	switch(status = ia64_sal_clear_state_info_no_lock(SAL_INFO_TYPE_MCA)){
+	switch(status = ia64_sal_clear_state_info_no_lock(type)){
 	case SAL_CALL_OK_MORE_ERR_REC_AVAILABLE:
 	case SAL_CALL_OK:
 		return (int) status;
 	default:
-		panic("\nMCA: apparently, I do not know how to call SAL_CLEAR_STATE_INFO, "
-								"status = %ld\n", status);
+		panic("\nApparently, I do not know how to call "
+				"SAL_CLEAR_STATE_INFO(%u), status = %ld\n", type, status);
 		return (int) status;
 	}
 	/*NOTREACHED*/
include/asm-ia64/mca.h +5 -0
diff -ruN tmp/include/asm-ia64/mca.h linux-2.6.1-jan-15/include/asm-ia64/mca.h
@@ -120,6 +120,11 @@
 	u64		proc_state_param;	/* from PAL in r18. See SDV 2:268 11.3.2.1 */
 } ia64_mca_sal_to_os_state_t;
 
+
+/*
+ * MCA and INIT return codes.
+ * (INIT does not use "IA64_MCA_COLD_BOOT" or "IA64_MCA_HALT".)
+ */
 enum {
 	IA64_MCA_CORRECTED	=	0x0,	/* Error has been corrected by OS_MCA */
 	IA64_MCA_WARM_BOOT	=	-1,	/* Warm boot of the system need from SAL */