From owner-svn-src-all@FreeBSD.ORG Tue Aug 13 21:34:06 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 1B9CE35E; Tue, 13 Aug 2013 21:34:06 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 072592751; Tue, 13 Aug 2013 21:34:06 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r7DLY5e2073127; Tue, 13 Aug 2013 21:34:05 GMT (envelope-from jkim@svn.freebsd.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7DLY4Iw072825; Tue, 13 Aug 2013 21:34:04 GMT (envelope-from jkim@svn.freebsd.org) Message-Id: <201308132134.r7DLY4Iw072825@svn.freebsd.org> From: Jung-uk Kim Date: Tue, 13 Aug 2013 21:34:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254300 - in head/sys: amd64/include dev/acpica/Osd i386/include ia64/include X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Aug 2013 21:34:06 -0000 Author: jkim Date: Tue Aug 13 21:34:03 2013 New Revision: 254300 URL: http://svnweb.freebsd.org/changeset/base/254300 Log: Tidy up global locks for ACPICA. There is no functional change. Modified: head/sys/amd64/include/acpica_machdep.h head/sys/dev/acpica/Osd/OsdSynch.c head/sys/i386/include/acpica_machdep.h head/sys/ia64/include/acpica_machdep.h Modified: head/sys/amd64/include/acpica_machdep.h ============================================================================== --- head/sys/amd64/include/acpica_machdep.h Tue Aug 13 21:12:28 2013 (r254299) +++ head/sys/amd64/include/acpica_machdep.h Tue Aug 13 21:34:03 2013 (r254300) @@ -59,9 +59,9 @@ #define ACPI_FLUSH_CPU_CACHE() wbinvd() -/* Section 5.2.9.1: global lock acquire/release functions */ -extern int acpi_acquire_global_lock(uint32_t *lock); -extern int acpi_release_global_lock(uint32_t *lock); +/* Section 5.2.10.1: global lock acquire/release functions */ +int acpi_acquire_global_lock(volatile uint32_t *); +int acpi_release_global_lock(volatile uint32_t *); #define ACPI_ACQUIRE_GLOBAL_LOCK(GLptr, Acq) do { \ (Acq) = acpi_acquire_global_lock(&((GLptr)->GlobalLock)); \ } while (0) Modified: head/sys/dev/acpica/Osd/OsdSynch.c ============================================================================== --- head/sys/dev/acpica/Osd/OsdSynch.c Tue Aug 13 21:12:28 2013 (r254299) +++ head/sys/dev/acpica/Osd/OsdSynch.c Tue Aug 13 21:34:03 2013 (r254300) @@ -566,8 +566,6 @@ AcpiOsReleaseLock(ACPI_SPINLOCK Handle, } /* Section 5.2.10.1: global lock acquire/release functions */ -#define GL_BIT_PENDING 0x01 -#define GL_BIT_OWNED 0x02 /* * Acquire the global lock. If busy, set the pending bit. The caller @@ -575,18 +573,18 @@ AcpiOsReleaseLock(ACPI_SPINLOCK Handle, * and then attempt to acquire it again. */ int -acpi_acquire_global_lock(uint32_t *lock) +acpi_acquire_global_lock(volatile uint32_t *lock) { uint32_t new, old; do { old = *lock; - new = (old & ~GL_BIT_PENDING) | GL_BIT_OWNED; - if ((old & GL_BIT_OWNED) != 0) - new |= GL_BIT_PENDING; - } while (atomic_cmpset_acq_int(lock, old, new) == 0); + new = (old & ~ACPI_GLOCK_PENDING) | ACPI_GLOCK_OWNED; + if ((old & ACPI_GLOCK_OWNED) != 0) + new |= ACPI_GLOCK_PENDING; + } while (atomic_cmpset_32(lock, old, new) == 0); - return ((new & GL_BIT_PENDING) == 0); + return ((new & ACPI_GLOCK_PENDING) == 0); } /* @@ -595,14 +593,14 @@ acpi_acquire_global_lock(uint32_t *lock) * releases the lock. */ int -acpi_release_global_lock(uint32_t *lock) +acpi_release_global_lock(volatile uint32_t *lock) { uint32_t new, old; do { old = *lock; - new = old & ~(GL_BIT_PENDING | GL_BIT_OWNED); - } while (atomic_cmpset_rel_int(lock, old, new) == 0); + new = old & ~(ACPI_GLOCK_PENDING | ACPI_GLOCK_OWNED); + } while (atomic_cmpset_32(lock, old, new) == 0); - return ((old & GL_BIT_PENDING) != 0); + return ((old & ACPI_GLOCK_PENDING) != 0); } Modified: head/sys/i386/include/acpica_machdep.h ============================================================================== --- head/sys/i386/include/acpica_machdep.h Tue Aug 13 21:12:28 2013 (r254299) +++ head/sys/i386/include/acpica_machdep.h Tue Aug 13 21:34:03 2013 (r254300) @@ -59,9 +59,9 @@ #define ACPI_FLUSH_CPU_CACHE() wbinvd() -/* Section 5.2.9.1: global lock acquire/release functions */ -extern int acpi_acquire_global_lock(uint32_t *lock); -extern int acpi_release_global_lock(uint32_t *lock); +/* Section 5.2.10.1: global lock acquire/release functions */ +int acpi_acquire_global_lock(volatile uint32_t *); +int acpi_release_global_lock(volatile uint32_t *); #define ACPI_ACQUIRE_GLOBAL_LOCK(GLptr, Acq) do { \ (Acq) = acpi_acquire_global_lock(&((GLptr)->GlobalLock)); \ } while (0) Modified: head/sys/ia64/include/acpica_machdep.h ============================================================================== --- head/sys/ia64/include/acpica_machdep.h Tue Aug 13 21:12:28 2013 (r254299) +++ head/sys/ia64/include/acpica_machdep.h Tue Aug 13 21:34:03 2013 (r254300) @@ -60,9 +60,9 @@ #define ACPI_FLUSH_CPU_CACHE() /* XXX ia64_fc()? */ -/* Section 5.2.9.1: global lock acquire/release functions */ -extern int acpi_acquire_global_lock(uint32_t *lock); -extern int acpi_release_global_lock(uint32_t *lock); +/* Section 5.2.10.1: global lock acquire/release functions */ +int acpi_acquire_global_lock(volatile uint32_t *); +int acpi_release_global_lock(volatile uint32_t *); #define ACPI_ACQUIRE_GLOBAL_LOCK(GLptr, Acq) do { \ (Acq) = acpi_acquire_global_lock(&((GLptr)->GlobalLock)); \ } while (0)