svn commit: r263795 - head/sys/x86/acpica

2014-03-27 Thread Takanori Watanabe
Author: takawata
Date: Thu Mar 27 06:36:38 2014
New Revision: 263795
URL: http://svnweb.freebsd.org/changeset/base/263795

Log:
  Strict value checking will cause problem.
  Bay trail DN2820FYKH is supported on Linux but does not work on FreeBSD.
  This behaviour is bug-compatible with Linux-3.13.5.
  
  References:
  http://d.hatena.ne.jp/syuu1228/20140326
  http://lxr.linux.no/linux+v3.13.5/arch/x86/kernel/acpi/boot.c#L1094
  
  Submitted by: syuu

Modified:
  head/sys/x86/acpica/madt.c

Modified: head/sys/x86/acpica/madt.c
==
--- head/sys/x86/acpica/madt.c  Thu Mar 27 06:08:07 2014(r263794)
+++ head/sys/x86/acpica/madt.c  Thu Mar 27 06:36:38 2014(r263795)
@@ -306,10 +306,11 @@ interrupt_polarity(UINT16 IntiFlags, UIN
case ACPI_MADT_POLARITY_ACTIVE_HIGH:
return (INTR_POLARITY_HIGH);
case ACPI_MADT_POLARITY_ACTIVE_LOW:
-   return (INTR_POLARITY_LOW);
+   break;
default:
-   panic(Bogus Interrupt Polarity);
+   printf(WARNING: Bogus Interrupt Polarity. Assume POLALITY 
LOW);
}
+   return (INTR_POLARITY_LOW);
 }
 
 static enum intr_trigger
@@ -325,10 +326,13 @@ interrupt_trigger(UINT16 IntiFlags, UINT
case ACPI_MADT_TRIGGER_EDGE:
return (INTR_TRIGGER_EDGE);
case ACPI_MADT_TRIGGER_LEVEL:
-   return (INTR_TRIGGER_LEVEL);
+   break;
default:
-   panic(Bogus Interrupt Trigger Mode);
+   printf(WARNING: Bogus Interrupt Trigger Mode. Assume Level 
trigger.);
+   
+   break;
}
+   return (INTR_TRIGGER_LEVEL);
 }
 
 /*
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r263795 - head/sys/x86/acpica

2014-03-27 Thread John Baldwin
On Thursday, March 27, 2014 2:36:39 am Takanori Watanabe wrote:
 Author: takawata
 Date: Thu Mar 27 06:36:38 2014
 New Revision: 263795
 URL: http://svnweb.freebsd.org/changeset/base/263795
 
 Log:
   Strict value checking will cause problem.
   Bay trail DN2820FYKH is supported on Linux but does not work on FreeBSD.
   This behaviour is bug-compatible with Linux-3.13.5.
   
   References:
   http://d.hatena.ne.jp/syuu1228/20140326
   http://lxr.linux.no/linux+v3.13.5/arch/x86/kernel/acpi/boot.c#L1094
   
   Submitted by: syuu

I think the problem with changing it at this level is that you don't know
what the default should be.  These are used both for local NMI but also
for interrupt override entries for ISA interrupts in the local APIC, so
hardcoding 

I think you should instead treat invalid values as conforms.  You can
do this by mostly reverting your change and moving default to the top of
the case and have it print a warning but fall through to the conforms
cases.

 Modified:
   head/sys/x86/acpica/madt.c
 
 Modified: head/sys/x86/acpica/madt.c
 
==
 --- head/sys/x86/acpica/madt.cThu Mar 27 06:08:07 2014
 (r263794)
 +++ head/sys/x86/acpica/madt.cThu Mar 27 06:36:38 2014
 (r263795)
 @@ -306,10 +306,11 @@ interrupt_polarity(UINT16 IntiFlags, UIN
   case ACPI_MADT_POLARITY_ACTIVE_HIGH:
   return (INTR_POLARITY_HIGH);
   case ACPI_MADT_POLARITY_ACTIVE_LOW:
 - return (INTR_POLARITY_LOW);
 + break;

I am not a fan of this at all.  If we fixed default's logic to be different
(e.g. as I suggested above), then falling through could result in the
wrong thing.  POLARITY_LOW should always explicitly return POLARITY_LOW.

   default:
 - panic(Bogus Interrupt Polarity);
 + printf(WARNING: Bogus Interrupt Polarity. Assume POLALITY 
 LOW);
   }
 + return (INTR_POLARITY_LOW);
  }
  
  static enum intr_trigger

-- 
John Baldwin
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org