Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 17 Mar 1998 06:35:17 +0100
From:      Tor Egge <Tor.Egge@idi.ntnu.no>
To:        freebsd-smp@FreeBSD.ORG
Subject:   MP config table robustness
Message-ID:  <199803170535.GAA28240@pat.idi.ntnu.no>

next in thread | raw e-mail | index | archive | help

I see two problems with the current APIC code

1.  Interrupts on the ISA bus are assumed to be conforming.  When
    PCI interrupts are redirected to the ISA bus, this assumption can
    be wrong.

2.  A PCI interrupt not specified in the MP table as a PCI interrupt
    is treated as a ISA interrupt delivered to the same interrupt
    pin number on the IOAPIC as the ISA interrupt number. This is
    inconsistent with the handling if ISA devices, where the IOAPIC
    pin number doesn't need to be the same as the ISA interrupt number.

With a few changes, my -SMP machine (ASUS P6UP65 motherboard) can boot
the -SMP kernel when MP 1.4 is disabled in the BIOS (as long as it has
enough free interrupt to use for the PCI devices).  The same kernel 
also works with MP 1.4 enabled in the bios.

This change also seems to help on some versions of SuperMicro motherboards.

Index: sys/pci/pci.c
===================================================================
RCS file: /home/ncvs/src/sys/pci/pci.c,v
retrieving revision 1.81
diff -u -r1.81 pci.c
--- pci.c	1998/01/24 02:54:47	1.81
+++ pci.c	1998/03/17 05:00:36
@@ -340,9 +340,25 @@
 			int airq;
 
 			airq = pci_apic_pin(cfg->bus, cfg->slot, cfg->intpin);
-			if ((airq >= 0) && (airq != cfg->intline)) {
-				undirect_pci_irq(cfg->intline);
-				cfg->intline = airq;
+			if (airq >= 0) {
+				/* PCI specific entry found in MP table */
+				if (airq != cfg->intline) {
+					undirect_pci_irq(cfg->intline);
+					cfg->intline = airq;
+				}
+			} else {
+				/* 
+				 * PCI interrupts might be redirected to the
+				 * ISA bus according to some MP tables. Use the
+				 * same methods as used by the ISA devices
+				 * to find the proper IOAPIC int pin.
+				 */
+				airq = isa_apic_pin(cfg->intline);
+				if ((airq >= 0) && (airq != cfg->intline)) {
+					/* XXX: undirect_pci_irq() ? */
+					undirect_isa_irq(cfg->intline);
+					cfg->intline = airq;
+				}
 			}
 		}
 #endif /* APIC_IO */
Index: sys/i386/i386/mpapic.c
===================================================================
RCS file: /home/ncvs/src/sys/i386/i386/mpapic.c,v
retrieving revision 1.28
diff -u -r1.28 mpapic.c
--- mpapic.c	1998/03/03 19:54:49	1.28
+++ mpapic.c	1998/03/17 04:45:26
@@ -164,7 +164,7 @@
 	if (apic == 0) {
 		maxpin = REDIRCNT_IOAPIC(apic);		/* pins in APIC */
 		for (pin = 0; pin < maxpin; ++pin) {
-			int bus, bustype;
+			int bus;
 
 			/* we only deal with vectored INTs here */
 			if (apic_int_type(apic, pin) != 0)
@@ -174,21 +174,12 @@
 			bus = apic_src_bus_id(apic, pin);
 			if (bus == -1)
 				continue;
-			bustype = apic_bus_type(bus);
 
-			/* the "ISA" type INTerrupts */
-			if ((bustype == ISA) || (bustype == EISA)) {
-				flags = DEFAULT_ISA_FLAGS;
-			}
-
-			/* PCI or other bus */
-			else {
-				flags = DEFAULT_FLAGS;
-				level = trigger(apic, pin, &flags);
-				if (level == 1)
-					apic_pin_trigger[apic] |= (1 << pin);
-				polarity(apic, pin, &flags, level);
-			}
+			flags = DEFAULT_FLAGS;
+			level = trigger(apic, pin, &flags);
+			if (level == 1)
+				apic_pin_trigger[apic] |= (1 << pin);
+			polarity(apic, pin, &flags, level);
 
 			/* program the appropriate registers */
 			select = pin * 2 + IOAPIC_REDTBL0;	/* register */


My mptable -verbose -demsg output then looks like:


===============================================================================

MPTable, version 2.0.15

 looking for EBDA pointer @ 0x040e, found, searching EBDA @ 0x0009fc00
 searching CMOS 'top of mem' @ 0x0009f800 (638K)
 searching default 'top of mem' @ 0x0009fc00 (639K)
 searching BIOS @ 0x000f0000

 MP FPS found in BIOS @ physical addr: 0x000f6980

-------------------------------------------------------------------------------

MP Floating Pointer Structure:

  location:			BIOS
  physical address:		0x000f6980
  signature:			'_MP_'
  length:			16 bytes
  version:			1.1
  checksum:			0xb5
  mode:				Virtual Wire

-------------------------------------------------------------------------------

MP Config Table Header:

  physical address:		0x000f657a
  signature:			'PCMP'
  base table length:		244
  version:			1.1
  checksum:			0x21
  OEM ID:			'OEM00000'
  Product ID:			'PROD00000000'
  OEM table pointer:		0x00000000
  OEM table size:		0
  entry count:			22
  local APIC address:		0xfee00000
  extended table length:	0
  extended table checksum:	0

-------------------------------------------------------------------------------

MP Config Base Table Entries:

--
Processors:	APIC ID	Version	State		Family	Model	Step	Flags
		 1	 0x11	 BSP, usable	 6	 1	 6	 0xfbff
		 0	 0x11	 AP, usable	 6	 1	 6	 0xfbff
--
Bus:		Bus ID	Type
		 0	 PCI   
		 1	 ISA   
--
I/O APICs:	APIC ID	Version	State		Address
		 2	 0x11	 usable		 0xfec00000
--
I/O Ints:	Type	Polarity    Trigger	Bus ID	 IRQ	APIC ID	PIN#
		ExtINT	 conforms    conforms	     1	   0	      2	   0
		INT	 conforms    conforms	     1	   1	      2	   1
		INT	 conforms    conforms	     1	   0	      2	   2
		INT	 conforms    conforms	     1	   3	      2	   3
		INT	 conforms    conforms	     1	   4	      2	   4
		INT	 conforms    conforms	     1	   5	      2	   5
		INT	 conforms    conforms	     1	   6	      2	   6
		INT	 conforms    conforms	     1	   7	      2	   7
		INT	 conforms    conforms	     1	   8	      2	   8
		INT	 conforms    conforms	     1	  12	      2	  12
		INT	 conforms    conforms	     1	  14	      2	  14
		INT	active-lo       level	     1	  11	      2	  16
		INT	active-lo       level	     1	  10	      2	  17
		INT	active-lo       level	     1	   9	      2	  18
		INT	active-lo       level	     1	  15	      2	  19
--
Local Ints:	Type	Polarity    Trigger	Bus ID	 IRQ	APIC ID	PIN#
		ExtINT	active-hi        edge	     1	   0	    255	   0
		NMI	active-hi        edge	     1	   0	    255	   1

-------------------------------------------------------------------------------

# SMP kernel config file options:


# Required:
options		SMP			# Symmetric MultiProcessor Kernel
options		APIC_IO			# Symmetric (APIC) I/O

# Optional (built-in defaults will work in most cases):
#options		NCPU=2			# number of CPUs
#options		NBUS=2			# number of busses
#options		NAPIC=1			# number of IO APICs
#options		NINTR=24		# number of INTs

-------------------------------------------------------------------------------

dmesg output:

Copyright (c) 1992-1998 FreeBSD Inc.
Copyright (c) 1982, 1986, 1989, 1991, 1993
	The Regents of the University of California. All rights reserved.
FreeBSD 3.0-CURRENT #36: Tue Mar 17 06:02:03 CET 1998
    root@ikke.idi.ntnu.no:/usr/src/sys/compile/TEGGE_SMP
Timecounter "i8254"  frequency 1193182 Hz  cost 3820 ns
CPU: Pentium Pro (686-class CPU)
  Origin = "GenuineIntel"  Id = 0x616  Stepping=6
  Features=0xfbff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV>
real memory  = 536870912 (524288K bytes)
avail memory = 519852032 (507668K bytes)
FreeBSD/SMP: Multiprocessor motherboard
 cpu0 (BSP): apic id:  1, version: 0x00040011, at 0xfee00000
 cpu1 (AP):  apic id:  0, version: 0x00040011, at 0xfee00000
 io0 (APIC): apic id:  2, version: 0x00170011, at 0xfec00000
Probing for devices on PCI bus 0:
chip0: <Intel 82440FX (Natoma) PCI and memory controller> rev 0x02 on pci0.0.0
chip1: <Intel 82371SB PCI to ISA bridge> rev 0x01 on pci0.1.0
Freeing (NOT implemented) redirected ISA irq 15.
ahc0: <Adaptec 2940 SCSI host adapter> rev 0x00 int a irq 19 on pci0.9.0
ahc0: aic7870 Single Channel, SCSI Id=7, 16/255 SCBs
scbus0 at ahc0 bus 0
ahc0: target 0 Tagged Queuing Device
scbus0 target 0 lun 0: <SEAGATE ST12550N 0013> type 0 fixed SCSI 2
sd0 at scbus0 target 0 lun 0
sd0: Direct-Access 2040MB (4178874 512 byte sectors)
ahc0: target 1 Tagged Queuing Device
scbus0 target 1 lun 0: <MICROP 2217-15MZ1001905 HQ30> type 0 fixed SCSI 2
sd1 at scbus0 target 1 lun 0
sd1: Direct-Access 1685MB (3450902 512 byte sectors)
ahc0: target 2 Tagged Queuing Device
scbus0 target 2 lun 0: <SEAGATE ST15150N 0905> type 0 fixed SCSI 2
sd2 at scbus0 target 2 lun 0
sd2: Direct-Access 4095MB (8388315 512 byte sectors)
ahc0: target 3 Tagged Queuing Device
scbus0 target 3 lun 0: <SEAGATE ST15150N 0905> type 0 fixed SCSI 2
sd3 at scbus0 target 3 lun 0
sd3: Direct-Access 4095MB (8388315 512 byte sectors)
Freeing (NOT implemented) redirected ISA irq 9.
ahc1: <Adaptec 2940 Ultra SCSI host adapter> rev 0x00 int a irq 18 on pci0.10.0
ahc1: aic7880 Wide Channel, SCSI Id=7, 16/255 SCBs
scbus1 at ahc1 bus 0
ahc1: target 1 Tagged Queuing Device
scbus1 target 1 lun 0: <Quantum XP34300W L915> type 0 fixed SCSI 2
sd6 at scbus1 target 1 lun 0
sd6: Direct-Access 4303MB (8813920 512 byte sectors)
ahc1: target 2 Tagged Queuing Device
scbus1 target 2 lun 0: <Quantum XP34300W L915> type 0 fixed SCSI 2
sd7 at scbus1 target 2 lun 0
sd7: Direct-Access 4303MB (8813920 512 byte sectors)
ahc1: target 3 Tagged Queuing Device
scbus1 target 3 lun 0: <Quantum XP34300W L915> type 0 fixed SCSI 2
sd8 at scbus1 target 3 lun 0
sd8: Direct-Access 4303MB (8813920 512 byte sectors)
ahc1: target 4 Tagged Queuing Device
scbus1 target 4 lun 0: <Quantum XP34300W L915> type 0 fixed SCSI 2
sd9 at scbus1 target 4 lun 0
sd9: Direct-Access 4303MB (8813920 512 byte sectors)
ahc1: target 5 Tagged Queuing Device
scbus1 target 5 lun 0: <Quantum XP34300W L915> type 0 fixed SCSI 2
sd10 at scbus1 target 5 lun 0
sd10: Direct-Access 4303MB (8813920 512 byte sectors)
ahc1: target 6 Tagged Queuing Device
scbus1 target 6 lun 0: <Quantum XP34300W L915> type 0 fixed SCSI 2
sd11 at scbus1 target 6 lun 0
sd11: Direct-Access 4303MB (8813920 512 byte sectors)
probe0(ahc1:9:0): scsi_cmd
probe0(ahc1:9:0): scsi_done
scbus1 target 9 lun 0: command: 0,0,0,0,0,0-[0 bytes]
probe0(ahc1:9:0): scsi_cmd
probe0(ahc1:9:0): scsi_done
scbus1 target 9 lun 0: command: 12,0,0,0,2c,0-[44 bytes]
------------------------------
000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
016: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
032: 00 00 00 00 00 00 00 00 00 00 00 00 
------------------------------
Freeing (NOT implemented) redirected ISA irq 10.
de0: <Digital 21041 Ethernet> rev 0x11 int a irq 17 on pci0.11.0
de0: SMC 21041 [10Mb/s] pass 1.1
de0: address 00:00:c0:ed:c3:d6
Freeing (NOT implemented) redirected ISA irq 11.
vga0: <Matrox MGA 2064W graphics accelerator> rev 0x01 int a irq 16 on pci0.12.0
Freeing (NOT implemented) redirected ISA irq 15.
ahc2: <Adaptec aic7880 Ultra SCSI host adapter> rev 0x00 int a irq 19 on pci0.13.0
ahc2: aic7880 Wide Channel, SCSI Id=7, 16/255 SCBs
scbus2 at ahc2 bus 0
probe0(ahc2:9:0): scsi_cmd
probe0(ahc2:9:0): scsi_done
scbus2 target 9 lun 0: command: 0,0,0,0,0,0-[0 bytes]
probe0(ahc2:9:0): scsi_cmd
probe0(ahc2:9:0): scsi_done
scbus2 target 9 lun 0: command: 12,0,0,0,2c,0-[44 bytes]
------------------------------
000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
016: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
032: 00 00 00 00 00 00 00 00 00 00 00 00 
------------------------------
Probing for devices on the ISA bus:
sc0 at 0x60-0x6f irq 1 on motherboard
sc0: VGA color <16 virtual consoles, flags=0x0>
sio0 at 0x3f8-0x3ff irq 4 on isa
sio0: type 16550A
sio1 at 0x2f8-0x2ff irq 3 flags 0x30 on isa
sio1: type 16550A, console
lpt0 at 0x378-0x37f irq 7 on isa
lpt0: Interrupt-driven port
lp0: TCP/IP capable interface
psm0 at 0x60-0x64 irq 12 on motherboard
psm0: model Generic PS/2 mouse, device ID 0
fdc0 at 0x3f0-0x3f7 irq 6 drq 2 on isa
fdc0: FIFO enabled, 8 bytes threshold
fd0: 1.44MB 3.5in
npx0 on motherboard
npx0: INT 16 interface
sb0 at 0x220 irq 5 drq 1 on isa
snd0: <SoundBlaster 16 4.13> 
sbxvi0 at ? drq 5 on isa
snd0: <SoundBlaster 16 4.13> 
sbmidi0 at 0x330 on isa
snd0: <SoundBlaster MPU-401> 
opl0 at 0x388 on isa
snd0: <Yamaha OPL3 FM> 
APIC_IO: Testing 8254 interrupt delivery
APIC_IO: routing 8254 via pin 2
ccd0-3: Concatenated disk drivers
IP packet filtering initialized, divert enabled, logging limited to 100 packets/entry
changing root device to sd0s5a
SMP: AP CPU #1 Launched!
de0: enabling BNC port

===============================================================================

- Tor Egge

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-smp" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199803170535.GAA28240>