* - ACPICA Interface
*/
#define ACPI_DEBUG_OUTPUT 1
-#define DEBUG 1
+#define DEBUG 0
#define _AcpiModuleName "Shim"
#define _COMPONENT "Acess"
#include <acpi.h>
namelen = (namelen + 3) & ~3;
ret = malloc(sizeof(*ret) + MaxDepth*sizeof(char) + namelen + MaxDepth*ObjectSize);
- if( !ret ) return AE_NO_MEMORY;
+ if( !ret ) {
+ Log_Notice("ACPICA", "%s: malloc() fail", __func__);
+ return AE_NO_MEMORY;
+ }
ret->nObj = MaxDepth;
ret->ObjectSize = ObjectSize;
ret->Name[0] = 0;
memset(ret->ObjectStates, 0, sizeof(char)*MaxDepth);
- LOG("Allocated cache '%s' (%i x 0x%x)", CacheName, MaxDepth, ObjectSize);
+ LOG("Allocated cache %p '%s' (%i x 0x%x)", ret, CacheName, MaxDepth, ObjectSize);
*ReturnCache = ret;
if( !Cache->ObjectStates[i] ) {
Cache->ObjectStates[i] = 1;
void *rv = (char*)Cache->First + i*Cache->ObjectSize;
+ memset(rv, 0, Cache->ObjectSize);
LEAVE('p', rv);
return rv;
}
}
-
+
+ Log_Debug("ACPICA", "AcpiOsAcquireObject: %i objects used", Cache->nObj);
+
LEAVE('n');
return NULL;
}
tVAddr delta = (tVAddr)Object - (tVAddr)Cache->First;
delta /= Cache->ObjectSize;
- LOG("delta = %i, (limit %i)", delta, Cache->nObj);
+ LOG("Cache=%p, delta = %i, (limit %i)", Cache, delta, Cache->nObj);
- if( delta > Cache->nObj )
+ if( delta >= Cache->nObj )
return AE_BAD_PARAMETER;
Cache->ObjectStates[delta] = 0;
if( !OutHandle )
return AE_BAD_PARAMETER;
tMutex *ret = calloc( sizeof(tMutex), 1 );
- if( !ret )
+ if( !ret ) {
+ Log_Notice("ACPICA", "%s: malloc() fail", __func__);
return AE_NO_MEMORY;
+ }
ret->Name = "AcpiOsCreateMutex";
*OutHandle = ret;
if( !OutHandle )
return AE_BAD_PARAMETER;
tSemaphore *ret = calloc( sizeof(tSemaphore), 1 );
- if( !ret )
+ if( !ret ) {
+ Log_Notice("ACPICA", "%s: malloc() fail", __func__);
return AE_NO_MEMORY;
+ }
Semaphore_Init(ret, InitialUnits, MaxUnits, "AcpiOsCreateSemaphore", "");
*OutHandle = ret;