aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/osl.c
diff options
context:
space:
mode:
authorLen Brown <len.brown@intel.com>2005-08-04 18:09:09 -0400
committerLen Brown <len.brown@intel.com>2005-08-04 18:09:09 -0400
commit5d2a22079c825669d91a3a200332f1053b4b61b0 (patch)
tree2e6e88bbcc3e17535fdf3103540b246b3658e20b /drivers/acpi/osl.c
parent1c5ad84516ae7ea4ec868436a910a6bd8d20215a (diff)
parentbd6dbdf3c7b9784fbf5d8500e427a954e27a976a (diff)
/home/lenb/src/to-akpm branch 'acpi-2.6.12'
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 7289da3c4db6..f3a807c342c0 100644
--- a/drivers/acpi/osl.c
+++ b/drivers/acpi/osl.c
@@ -782,54 +782,6 @@ acpi_os_delete_lock (
782 return_VOID; 782 return_VOID;
783} 783}
784 784
785/*
786 * Acquire a spinlock.
787 *
788 * handle is a pointer to the spinlock_t.
789 * flags is *not* the result of save_flags - it is an ACPI-specific flag variable
790 * that indicates whether we are at interrupt level.
791 */
792void
793acpi_os_acquire_lock (
794 acpi_handle handle,
795 u32 flags)
796{
797 ACPI_FUNCTION_TRACE ("os_acquire_lock");
798
799 ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX, "Acquiring spinlock[%p] from %s level\n", handle,
800 ((flags & ACPI_NOT_ISR) ? "non-interrupt" : "interrupt")));
801
802 if (flags & ACPI_NOT_ISR)
803 ACPI_DISABLE_IRQS();
804
805 spin_lock((spinlock_t *)handle);
806
807 return_VOID;
808}
809
810
811/*
812 * Release a spinlock. See above.
813 */
814void
815acpi_os_release_lock (
816 acpi_handle handle,
817 u32 flags)
818{
819 ACPI_FUNCTION_TRACE ("os_release_lock");
820
821 ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX, "Releasing spinlock[%p] from %s level\n", handle,
822 ((flags & ACPI_NOT_ISR) ? "non-interrupt" : "interrupt")));
823
824 spin_unlock((spinlock_t *)handle);
825
826 if (flags & ACPI_NOT_ISR)
827 ACPI_ENABLE_IRQS();
828
829 return_VOID;
830}
831
832
833acpi_status 785acpi_status
834acpi_os_create_semaphore( 786acpi_os_create_semaphore(
835 u32 max_units, 787 u32 max_units,
@@ -1176,3 +1128,151 @@ unsigned int max_cstate = ACPI_PROCESSOR_MAX_POWER;
1176 1128
1177 1129
1178EXPORT_SYMBOL(max_cstate); 1130EXPORT_SYMBOL(max_cstate);
1131
1132/*
1133 * Acquire a spinlock.
1134 *
1135 * handle is a pointer to the spinlock_t.
1136 * flags is *not* the result of save_flags - it is an ACPI-specific flag variable
1137 * that indicates whether we are at interrupt level.
1138 */
1139
1140unsigned long
1141acpi_os_acquire_lock (
1142 acpi_handle handle)
1143{
1144 unsigned long flags;
1145 spin_lock_irqsave((spinlock_t *)handle, flags);
1146 return flags;
1147}
1148
1149/*
1150 * Release a spinlock. See above.
1151 */
1152
1153void
1154acpi_os_release_lock (
1155 acpi_handle handle,
1156 unsigned long flags)
1157{
1158 spin_unlock_irqrestore((spinlock_t *)handle, flags);
1159}
1160
1161
1162#ifndef ACPI_USE_LOCAL_CACHE
1163
1164/*******************************************************************************
1165 *
1166 * FUNCTION: acpi_os_create_cache
1167 *
1168 * PARAMETERS: CacheName - Ascii name for the cache
1169 * ObjectSize - Size of each cached object
1170 * MaxDepth - Maximum depth of the cache (in objects)
1171 * ReturnCache - Where the new cache object is returned
1172 *
1173 * RETURN: Status
1174 *
1175 * DESCRIPTION: Create a cache object
1176 *
1177 ******************************************************************************/
1178
1179acpi_status
1180acpi_os_create_cache (
1181 char *name,
1182 u16 size,
1183 u16 depth,
1184 acpi_cache_t **cache)
1185{
1186 *cache = kmem_cache_create (name, size, 0, 0, NULL, NULL);
1187 return AE_OK;
1188}
1189
1190/*******************************************************************************
1191 *
1192 * FUNCTION: acpi_os_purge_cache
1193 *
1194 * PARAMETERS: Cache - Handle to cache object
1195 *
1196 * RETURN: Status
1197 *
1198 * DESCRIPTION: Free all objects within the requested cache.
1199 *
1200 ******************************************************************************/
1201
1202acpi_status
1203acpi_os_purge_cache (
1204 acpi_cache_t *cache)
1205{
1206 (void) kmem_cache_shrink(cache);
1207 return (AE_OK);
1208}
1209
1210/*******************************************************************************
1211 *
1212 * FUNCTION: acpi_os_delete_cache
1213 *
1214 * PARAMETERS: Cache - Handle to cache object
1215 *
1216 * RETURN: Status
1217 *
1218 * DESCRIPTION: Free all objects within the requested cache and delete the
1219 * cache object.
1220 *
1221 ******************************************************************************/
1222
1223acpi_status
1224acpi_os_delete_cache (
1225 acpi_cache_t *cache)
1226{
1227 (void)kmem_cache_destroy(cache);
1228 return (AE_OK);
1229}
1230
1231/*******************************************************************************
1232 *
1233 * FUNCTION: acpi_os_release_object
1234 *
1235 * PARAMETERS: Cache - Handle to cache object
1236 * Object - The object to be released
1237 *
1238 * RETURN: None
1239 *
1240 * DESCRIPTION: Release an object to the specified cache. If cache is full,
1241 * the object is deleted.
1242 *
1243 ******************************************************************************/
1244
1245acpi_status
1246acpi_os_release_object (
1247 acpi_cache_t *cache,
1248 void *object)
1249{
1250 kmem_cache_free(cache, object);
1251 return (AE_OK);
1252}
1253
1254/*******************************************************************************
1255 *
1256 * FUNCTION: acpi_os_acquire_object
1257 *
1258 * PARAMETERS: Cache - Handle to cache object
1259 * ReturnObject - Where the object is returned
1260 *
1261 * RETURN: Status
1262 *
1263 * DESCRIPTION: Get an object from the specified cache. If cache is empty,
1264 * the object is allocated.
1265 *
1266 ******************************************************************************/
1267
1268void *
1269acpi_os_acquire_object (
1270 acpi_cache_t *cache)
1271{
1272 void *object = kmem_cache_alloc(cache, GFP_KERNEL);
1273 WARN_ON(!object);
1274 return object;
1275}
1276
1277#endif
1278