aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/osl.c
diff options
context:
space:
mode:
authorRobert Moore <robert.moore@intel.com>2005-06-24 00:00:00 -0400
committerLen Brown <len.brown@intel.com>2005-07-13 23:45:36 -0400
commit73459f73e5d1602c59ebec114fc45185521353c1 (patch)
tree56c2183e345784d2be09c2f5d2530cf36221c55e /drivers/acpi/osl.c
parent88ac00f5a841dcfc5c682000f4a6add0add8caac (diff)
ACPICA 20050617-0624 from Bob Moore <robert.moore@intel.com>
ACPICA 20050617: Moved the object cache operations into the OS interface layer (OSL) to allow the host OS to handle these operations if desired (for example, the Linux OSL will invoke the slab allocator). This support is optional; the compile time define ACPI_USE_LOCAL_CACHE may be used to utilize the original cache code in the ACPI CA core. The new OSL interfaces are shown below. See utalloc.c for an example implementation, and acpiosxf.h for the exact interface definitions. Thanks to Alexey Starikovskiy. acpi_os_create_cache acpi_os_delete_cache acpi_os_purge_cache acpi_os_acquire_object acpi_os_release_object Modified the interfaces to acpi_os_acquire_lock and acpi_os_release_lock to return and restore a flags parameter. This fits better with many OS lock models. Note: the current execution state (interrupt handler or not) is no longer passed to these interfaces. If necessary, the OSL must determine this state by itself, a simple and fast operation. Thanks to Alexey Starikovskiy. Fixed a problem in the ACPI table handling where a valid XSDT was assumed present if the revision of the RSDP was 2 or greater. According to the ACPI specification, the XSDT is optional in all cases, and the table manager therefore now checks for both an RSDP >=2 and a valid XSDT pointer. Otherwise, the RSDT pointer is used. Some ACPI 2.0 compliant BIOSs contain only the RSDT. Fixed an interpreter problem with the Mid() operator in the case of an input string where the resulting output string is of zero length. It now correctly returns a valid, null terminated string object instead of a string object with a null pointer. Fixed a problem with the control method argument handling to allow a store to an Arg object that already contains an object of type Device. The Device object is now correctly overwritten. Previously, an error was returned. ACPICA 20050624: Modified the new OSL cache interfaces to use ACPI_CACHE_T as the type for the host-defined cache object. This allows the OSL implementation to define and type this object in any manner desired, simplifying the OSL implementation. For example, ACPI_CACHE_T is defined as kmem_cache_t for Linux, and should be defined in the OS-specific header file for other operating systems as required. Changed the interface to AcpiOsAcquireObject to directly return the requested object as the function return (instead of ACPI_STATUS.) This change was made for performance reasons, since this is the purpose of the interface in the first place. acpi_os_acquire_object is now similar to the acpi_os_allocate interface. Thanks to Alexey Starikovskiy. Modified the initialization sequence in acpi_initialize_subsystem to call the OSL interface acpi_osl_initialize first, before any local initialization. This change was required because the global initialization now calls OSL interfaces. Restructured the code base to split some files because of size and/or because the code logically belonged in a separate file. New files are listed below. utilities/utcache.c /* Local cache interfaces */ utilities/utmutex.c /* Local mutex support */ utilities/utstate.c /* State object support */ parser/psloop.c /* Main AML parse loop */ Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi/osl.c')
-rw-r--r--drivers/acpi/osl.c196
1 files changed, 148 insertions, 48 deletions
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c
index bdd9f37f8101..56e7cedba919 100644
--- a/drivers/acpi/osl.c
+++ b/drivers/acpi/osl.c
@@ -778,54 +778,6 @@ acpi_os_delete_lock (
778 return_VOID; 778 return_VOID;
779} 779}
780 780
781/*
782 * Acquire a spinlock.
783 *
784 * handle is a pointer to the spinlock_t.
785 * flags is *not* the result of save_flags - it is an ACPI-specific flag variable
786 * that indicates whether we are at interrupt level.
787 */
788void
789acpi_os_acquire_lock (
790 acpi_handle handle,
791 u32 flags)
792{
793 ACPI_FUNCTION_TRACE ("os_acquire_lock");
794
795 ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX, "Acquiring spinlock[%p] from %s level\n", handle,
796 ((flags & ACPI_NOT_ISR) ? "non-interrupt" : "interrupt")));
797
798 if (flags & ACPI_NOT_ISR)
799 ACPI_DISABLE_IRQS();
800
801 spin_lock((spinlock_t *)handle);
802
803 return_VOID;
804}
805
806
807/*
808 * Release a spinlock. See above.
809 */
810void
811acpi_os_release_lock (
812 acpi_handle handle,
813 u32 flags)
814{
815 ACPI_FUNCTION_TRACE ("os_release_lock");
816
817 ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX, "Releasing spinlock[%p] from %s level\n", handle,
818 ((flags & ACPI_NOT_ISR) ? "non-interrupt" : "interrupt")));
819
820 spin_unlock((spinlock_t *)handle);
821
822 if (flags & ACPI_NOT_ISR)
823 ACPI_ENABLE_IRQS();
824
825 return_VOID;
826}
827
828
829acpi_status 781acpi_status
830acpi_os_create_semaphore( 782acpi_os_create_semaphore(
831 u32 max_units, 783 u32 max_units,
@@ -1172,3 +1124,151 @@ unsigned int max_cstate = ACPI_PROCESSOR_MAX_POWER;
1172 1124
1173 1125
1174EXPORT_SYMBOL(max_cstate); 1126EXPORT_SYMBOL(max_cstate);
1127
1128/*
1129 * Acquire a spinlock.
1130 *
1131 * handle is a pointer to the spinlock_t.
1132 * flags is *not* the result of save_flags - it is an ACPI-specific flag variable
1133 * that indicates whether we are at interrupt level.
1134 */
1135
1136unsigned long
1137acpi_os_acquire_lock (
1138 acpi_handle handle)
1139{
1140 unsigned long flags;
1141 spin_lock_irqsave((spinlock_t *)handle, flags);
1142 return flags;
1143}
1144
1145/*
1146 * Release a spinlock. See above.
1147 */
1148
1149void
1150acpi_os_release_lock (
1151 acpi_handle handle,
1152 unsigned long flags)
1153{
1154 spin_unlock_irqrestore((spinlock_t *)handle, flags);
1155}
1156
1157
1158#ifndef ACPI_USE_LOCAL_CACHE
1159
1160/*******************************************************************************
1161 *
1162 * FUNCTION: acpi_os_create_cache
1163 *
1164 * PARAMETERS: CacheName - Ascii name for the cache
1165 * ObjectSize - Size of each cached object
1166 * MaxDepth - Maximum depth of the cache (in objects)
1167 * ReturnCache - Where the new cache object is returned
1168 *
1169 * RETURN: Status
1170 *
1171 * DESCRIPTION: Create a cache object
1172 *
1173 ******************************************************************************/
1174
1175acpi_status
1176acpi_os_create_cache (
1177 char *name,
1178 u16 size,
1179 u16 depth,
1180 acpi_cache_t **cache)
1181{
1182 *cache = kmem_cache_create (name, size, 0, 0, NULL, NULL);
1183 return AE_OK;
1184}
1185
1186/*******************************************************************************
1187 *
1188 * FUNCTION: acpi_os_purge_cache
1189 *
1190 * PARAMETERS: Cache - Handle to cache object
1191 *
1192 * RETURN: Status
1193 *
1194 * DESCRIPTION: Free all objects within the requested cache.
1195 *
1196 ******************************************************************************/
1197
1198acpi_status
1199acpi_os_purge_cache (
1200 acpi_cache_t *cache)
1201{
1202 (void) kmem_cache_shrink(cache);
1203 return (AE_OK);
1204}
1205
1206/*******************************************************************************
1207 *
1208 * FUNCTION: acpi_os_delete_cache
1209 *
1210 * PARAMETERS: Cache - Handle to cache object
1211 *
1212 * RETURN: Status
1213 *
1214 * DESCRIPTION: Free all objects within the requested cache and delete the
1215 * cache object.
1216 *
1217 ******************************************************************************/
1218
1219acpi_status
1220acpi_os_delete_cache (
1221 acpi_cache_t *cache)
1222{
1223 (void)kmem_cache_destroy(cache);
1224 return (AE_OK);
1225}
1226
1227/*******************************************************************************
1228 *
1229 * FUNCTION: acpi_os_release_object
1230 *
1231 * PARAMETERS: Cache - Handle to cache object
1232 * Object - The object to be released
1233 *
1234 * RETURN: None
1235 *
1236 * DESCRIPTION: Release an object to the specified cache. If cache is full,
1237 * the object is deleted.
1238 *
1239 ******************************************************************************/
1240
1241acpi_status
1242acpi_os_release_object (
1243 acpi_cache_t *cache,
1244 void *object)
1245{
1246 kmem_cache_free(cache, object);
1247 return (AE_OK);
1248}
1249
1250/*******************************************************************************
1251 *
1252 * FUNCTION: acpi_os_acquire_object
1253 *
1254 * PARAMETERS: Cache - Handle to cache object
1255 * ReturnObject - Where the object is returned
1256 *
1257 * RETURN: Status
1258 *
1259 * DESCRIPTION: Get an object from the specified cache. If cache is empty,
1260 * the object is allocated.
1261 *
1262 ******************************************************************************/
1263
1264void *
1265acpi_os_acquire_object (
1266 acpi_cache_t *cache)
1267{
1268 void *object = kmem_cache_alloc(cache, GFP_KERNEL);
1269 WARN_ON(!object);
1270 return object;
1271}
1272
1273#endif
1274