Re: svn commit: r299977 - head/sys/dev/acpica/Osd

2016-05-17 Thread Jim Harris
On Mon, May 16, 2016 at 2:33 PM, John Baldwin  wrote:

> Author: jhb
> Date: Mon May 16 21:33:31 2016
> New Revision: 299977
> URL: https://svnweb.freebsd.org/changeset/base/299977
>
> Log:
>   Use polling spin loops for timeouts during early boot.
>
>   Some ACPI operations such as mutex acquires and event waits accept a
>   timeout.  The ACPI OSD layer implements these timeouts by using regular
>   sleep timeouts.  However, this doesn't work during early boot before
>   event timers are setup.  Instead, use polling combined with DELAY()
>   to spin.
>
>   This fixes booting on upcoming Intel systems with Kaby Lake processors.
>

Thanks!


>
>   Tested by:"Jeffrey E Pieper" 
>   Reviewed by:  jimharris
>   MFC after:1 week
>
> Modified:
>   head/sys/dev/acpica/Osd/OsdSynch.c
>
> Modified: head/sys/dev/acpica/Osd/OsdSynch.c
>
> ==
> --- head/sys/dev/acpica/Osd/OsdSynch.c  Mon May 16 20:26:30 2016
> (r299976)
> +++ head/sys/dev/acpica/Osd/OsdSynch.c  Mon May 16 21:33:31 2016
> (r299977)
> @@ -188,6 +188,23 @@ AcpiOsWaitSemaphore(ACPI_SEMAPHORE Handl
> }
> break;
> default:
> +   if (cold) {
> +   /*
> +* Just spin polling the semaphore once a
> +* millisecond.
> +*/
> +   while (!ACPISEM_AVAIL(as, Units)) {
> +   if (Timeout == 0) {
> +   status = AE_TIME;
> +   break;
> +   }
> +   Timeout--;
> +   mtx_unlock(>as_lock);
> +   DELAY(1000);
> +   mtx_lock(>as_lock);
> +   }
> +   break;
> +   }
> tmo = timeout2hz(Timeout);
> while (!ACPISEM_AVAIL(as, Units)) {
> prevtick = ticks;
> @@ -381,6 +398,23 @@ AcpiOsAcquireMutex(ACPI_MUTEX Handle, UI
> }
> break;
> default:
> +   if (cold) {
> +   /*
> +* Just spin polling the mutex once a
> +* millisecond.
> +*/
> +   while (!ACPIMTX_AVAIL(am)) {
> +   if (Timeout == 0) {
> +   status = AE_TIME;
> +   break;
> +   }
> +   Timeout--;
> +   mtx_unlock(>am_lock);
> +   DELAY(1000);
> +   mtx_lock(>am_lock);
> +   }
> +   break;
> +   }
> tmo = timeout2hz(Timeout);
> while (!ACPIMTX_AVAIL(am)) {
> prevtick = ticks;
>
>
___
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"


svn commit: r299977 - head/sys/dev/acpica/Osd

2016-05-16 Thread John Baldwin
Author: jhb
Date: Mon May 16 21:33:31 2016
New Revision: 299977
URL: https://svnweb.freebsd.org/changeset/base/299977

Log:
  Use polling spin loops for timeouts during early boot.
  
  Some ACPI operations such as mutex acquires and event waits accept a
  timeout.  The ACPI OSD layer implements these timeouts by using regular
  sleep timeouts.  However, this doesn't work during early boot before
  event timers are setup.  Instead, use polling combined with DELAY()
  to spin.
  
  This fixes booting on upcoming Intel systems with Kaby Lake processors.
  
  Tested by:"Jeffrey E Pieper" 
  Reviewed by:  jimharris
  MFC after:1 week

Modified:
  head/sys/dev/acpica/Osd/OsdSynch.c

Modified: head/sys/dev/acpica/Osd/OsdSynch.c
==
--- head/sys/dev/acpica/Osd/OsdSynch.c  Mon May 16 20:26:30 2016
(r299976)
+++ head/sys/dev/acpica/Osd/OsdSynch.c  Mon May 16 21:33:31 2016
(r299977)
@@ -188,6 +188,23 @@ AcpiOsWaitSemaphore(ACPI_SEMAPHORE Handl
}
break;
default:
+   if (cold) {
+   /*
+* Just spin polling the semaphore once a
+* millisecond.
+*/
+   while (!ACPISEM_AVAIL(as, Units)) {
+   if (Timeout == 0) {
+   status = AE_TIME;
+   break;
+   }
+   Timeout--;
+   mtx_unlock(>as_lock);
+   DELAY(1000);
+   mtx_lock(>as_lock);
+   }
+   break;
+   }
tmo = timeout2hz(Timeout);
while (!ACPISEM_AVAIL(as, Units)) {
prevtick = ticks;
@@ -381,6 +398,23 @@ AcpiOsAcquireMutex(ACPI_MUTEX Handle, UI
}
break;
default:
+   if (cold) {
+   /*
+* Just spin polling the mutex once a
+* millisecond.
+*/
+   while (!ACPIMTX_AVAIL(am)) {
+   if (Timeout == 0) {
+   status = AE_TIME;
+   break;
+   }
+   Timeout--;
+   mtx_unlock(>am_lock);
+   DELAY(1000);
+   mtx_lock(>am_lock);
+   }
+   break;
+   }
tmo = timeout2hz(Timeout);
while (!ACPIMTX_AVAIL(am)) {
prevtick = ticks;
___
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"