Author: jhb
Date: Mon Sep 17 17:18:54 2018
New Revision: 338725
URL: https://svnweb.freebsd.org/changeset/base/338725

Log:
  Fix a regression in r338360 when booting an x86 machine without APIC.
  
  The atpic_register_sources callback tries to avoid registering interrupt
  sources that would collide with an I/O APIC.  However, the previous
  implementation was failing to register IRQs 8-15 since the slave PIC
  saw valid IRQs from the master and assumed an I/O APIC was present.  To
  fix, go back to registering all 8259A interrupt sources in one loop when
  the master's register_sources method is invoked.
  
  PR:           231291
  Approved by:  re (kib)
  MFC after:    1 month

Modified:
  head/sys/x86/isa/atpic.c

Modified: head/sys/x86/isa/atpic.c
==============================================================================
--- head/sys/x86/isa/atpic.c    Mon Sep 17 16:16:57 2018        (r338724)
+++ head/sys/x86/isa/atpic.c    Mon Sep 17 17:18:54 2018        (r338725)
@@ -221,14 +221,20 @@ atpic_register_sources(struct pic *pic)
         * that APIC ISA routing and allowing the ATPIC source for that IRQ
         * to leak through.  We used to depend on this feature for routing
         * IRQ0 via mixed mode, but now we don't use mixed mode at all.
+        *
+        * To avoid the slave not register sources after the master
+        * registers its sources, register all IRQs when this function is
+        * called on the master.
         */
+       if (ap != &atpics[MASTER])
+               return;
        for (i = 0; i < NUM_ISA_IRQS; i++)
                if (intr_lookup_source(i) != NULL)
                        return;
 
        /* Loop through all interrupt sources and add them. */
-       for (i = 0, ai = atintrs + ap->at_irqbase; i < 8; i++, ai++) {
-               if (ap->at_irqbase + i == ICU_SLAVEID)
+       for (i = 0, ai = atintrs; i < NUM_ISA_IRQS; i++, ai++) {
+               if (i == ICU_SLAVEID)
                        continue;
                intr_register_source(&ai->at_intsrc);
        }
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to