Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 23 Jul 2016 22:50:59 +0000 (UTC)
From:      John Baldwin <jhb@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
Subject:   svn commit: r303252 - in stable: 10/sys/dev/acpica/Osd 9/sys/dev/acpica/Osd
Message-ID:  <201607232250.u6NMoxXi061473@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jhb
Date: Sat Jul 23 22:50:59 2016
New Revision: 303252
URL: https://svnweb.freebsd.org/changeset/base/303252

Log:
  MFC 299977: 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.

Modified:
  stable/9/sys/dev/acpica/Osd/OsdSynch.c
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/dev/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/10/sys/dev/acpica/Osd/OsdSynch.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/9/sys/dev/acpica/Osd/OsdSynch.c
==============================================================================
--- stable/9/sys/dev/acpica/Osd/OsdSynch.c	Sat Jul 23 21:56:52 2016	(r303251)
+++ stable/9/sys/dev/acpica/Osd/OsdSynch.c	Sat Jul 23 22:50:59 2016	(r303252)
@@ -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->as_lock);
+				DELAY(1000);
+				mtx_lock(&as->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->am_lock);
+				DELAY(1000);
+				mtx_lock(&am->am_lock);
+			}
+			break;
+		}
 		tmo = timeout2hz(Timeout);
 		while (!ACPIMTX_AVAIL(am)) {
 			prevtick = ticks;



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