From owner-freebsd-smp Wed Dec 4 21:03:53 1996 Return-Path: owner-smp Received: (from root@localhost) by freefall.freebsd.org (8.8.3/8.7.3) id VAA14129 for smp-outgoing; Wed, 4 Dec 1996 21:03:53 -0800 (PST) Received: from clem.systemsix.com (clem.systemsix.com [198.99.86.131]) by freefall.freebsd.org (8.7.5/8.7.3) with SMTP id VAA14119 for ; Wed, 4 Dec 1996 21:03:45 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by clem.systemsix.com (8.6.12/8.6.12) with SMTP id WAA10189; Wed, 4 Dec 1996 22:03:29 -0700 Message-Id: <199612050503.WAA10189@clem.systemsix.com> X-Authentication-Warning: clem.systemsix.com: Host localhost didn't use HELO protocol X-Mailer: exmh version 1.6.5 12/11/95 From: Steve Passe To: smp@freebsd.org cc: Terje Normann Marthinussen , Erich Boleyn Subject: Re: Get running with 2 CPUs only! (finally...) In-reply-to: Your message of "Wed, 04 Dec 1996 09:46:04 PST." Mime-Version: 1.0 Content-Type: text/plain Date: Wed, 04 Dec 1996 22:03:29 -0700 Sender: owner-smp@freebsd.org X-Loop: FreeBSD.org Precedence: bulk Hi, The following 2 patches for i386/i386/mp_machdep.c and i386/i386/mpboot.s attempt to track how far we get when launching CPUs 3 & 4. What they do is set initial values of 99 in 6 consecutive bytes of CMOS ram. The advantage of this is that it is all done via outb instructions, so they can be done very early in the AP boot process, before they have valid stack, etc. This should tell us how far, if at all the APs run. The results are printed very near the top of the output, before the dmesg buffer works, so a serial debug would be helpful. you could also put a cngetc() call in after the CHECK_PRINT()s to stop them. The expected output of each AP is: ... check: 99, 99, 99, 99, 99, 99 check: 1, 2, 3, 4, 5, 99 Sizing memory.. init386 done CR0 = 80000011 ---------------------------------- cut --------------------------------------- *** mpboot.s 1996/12/04 22:32:56 1.14 --- mpboot.s 1996/12/05 04:23:14 *************** *** 31,37 **** * mpboot.s: FreeBSD machine support for the Intel MP Spec * multiprocessor systems. * ! * $Id: mpboot.s,v 1.14 1996/12/04 22:32:56 fsmp Exp $ */ #include "opt_smp_autostart.h" --- 31,37 ---- * mpboot.s: FreeBSD machine support for the Intel MP Spec * multiprocessor systems. * ! * $Id: mpboot.s,v 1.14 1996/12/04 22:32:56 fsmp Exp fsmp $ */ #include "opt_smp_autostart.h" *************** *** 42,53 **** --- 42,62 ---- #include "assym.s" + #if 1 + #define CHECK(A,D) \ + movb $(A),%al ; \ + outb %al,$0x70 ; \ + movb $(D),%al ; \ + outb %al,$0x71 + #endif + /* * the APs enter here from their trampoline code (bootMP, below) */ .align 4 NON_GPROF_ENTRY(MPentry) + CHECK(0x36,3) movl $mp_stk-KERNBASE,%esp /* mp boot stack end loc. */ /* Now enable paging mode */ movl _IdlePTD-KERNBASE, %eax *************** *** 65,71 **** --- 74,82 ---- * Wait for the booting CPU to signal startup */ mp_begin: /* now running relocated at KERNBASE */ + CHECK(0x37,4) call _init_secondary /* load i386 tables */ + CHECK(0x38,5) /* disable the APIC, just to be SURE */ movl _apic_base, %esi *************** *** 87,92 **** --- 98,104 ---- xchgb %al, bootlock /* xchg is implicitly locked */ cmpb $BL_SET, %al /* was is set? */ jz 1b /* yes, keep trying... */ + CHECK(0x39,6) /* Now, let's do some REAL WORK :-) */ call _secondary_main *************** *** 121,126 **** --- 133,139 ---- NON_GPROF_ENTRY(bootMP) cli + CHECK(0x34,1) /* First guarantee a 'clean slate' */ data32 xorl %eax, %eax *************** *** 176,181 **** --- 189,195 ---- lret protmode: + CHECK(0x35,2) /* * we are NOW running for the first time with %eip * having the full physical address, BUT we still ---------------------------------- cut --------------------------------------- ---------------------------------- cut --------------------------------------- *** mp_machdep.c 1996/12/04 22:32:53 1.31 --- mp_machdep.c 1996/12/05 04:44:06 *************** *** 22,28 **** * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ! * $Id: mp_machdep.c,v 1.31 1996/12/04 22:32:53 fsmp Exp $ */ #include "opt_smp_invltlb.h" --- 22,28 ---- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ! * $Id: mp_machdep.c,v 1.31 1996/12/04 22:32:53 fsmp Exp fsmp $ */ #include "opt_smp_invltlb.h" *************** *** 1463,1468 **** --- 1463,1471 ---- } + #define CHECK_READ(A) (outb( CMOS_REG, (A) ), inb( CMOS_DATA )) + #define CHECK_WRITE(A,D) (outb( CMOS_REG, (A) ), outb( CMOS_DATA, (D) )) + /* * this function starts the AP (application processor) identified * by the APIC ID 'physicalCpu'. It does quite a "song and dance" *************** *** 1470,1481 **** --- 1473,1498 ---- * of the different hardware we might encounter. It ain't pretty, * but it seems to work. */ + #define CHECK_PRINT() \ + printf( "check: %d, %d, %d, %d, %d, %d\n", \ + CHECK_READ( 0x34 ), CHECK_READ( 0x35 ), \ + CHECK_READ( 0x36 ), CHECK_READ( 0x37 ), \ + CHECK_READ( 0x38 ), CHECK_READ( 0x39 ) ) static int startAP( int physicalCpu, int vector ) { int cpus; u_long icrLo, icrHi; + #if 1 + CHECK_WRITE( 0x34, 99 ); + CHECK_WRITE( 0x35, 99 ); + CHECK_WRITE( 0x36, 99 ); + CHECK_WRITE( 0x37, 99 ); + CHECK_WRITE( 0x38, 99 ); + CHECK_WRITE( 0x39, 99 ); + CHECK_PRINT(); + #endif /* used as a watchpoint to signal AP startup */ cpus = mp_ncpus; *************** *** 1541,1551 **** /* wait for it to start */ setApicTimer( 5000000 ); while ( readApicTimer() ) ! if ( mp_ncpus > cpus ) return 1; /* it started! */ ! #if 1 /* better panic as the AP may be running loose somewhere */ printf( "Application Processor #%d failed!\n", physicalCpu ); panic( "\n" ); #endif /* 1 */ --- 1558,1575 ---- /* wait for it to start */ setApicTimer( 5000000 ); while ( readApicTimer() ) ! if ( mp_ncpus > cpus ) { #if 1 + CHECK_PRINT(); + #endif + return 1; /* it started! */ + } + /* better panic as the AP may be running loose somewhere */ printf( "Application Processor #%d failed!\n", physicalCpu ); + #if 1 + CHECK_PRINT(); + #else panic( "\n" ); #endif /* 1 */ ---------------------------------- cut --------------------------------------- -- Steve Passe | powered by smp@csn.net | FreeBSD