// SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0 /****************************************************************************** * * Module Name: utalloc - local memory allocation routines * * Copyright (C) 2000 - 2023, Intel Corp. * *****************************************************************************/ #include <acpi/acpi.h> #include "accommon.h" #include "acdebug.h" #define _COMPONENT … ACPI_MODULE_NAME("utalloc") #if !defined (USE_NATIVE_ALLOCATE_ZEROED) /******************************************************************************* * * FUNCTION: acpi_os_allocate_zeroed * * PARAMETERS: size - Size of the allocation * * RETURN: Address of the allocated memory on success, NULL on failure. * * DESCRIPTION: Subsystem equivalent of calloc. Allocate and zero memory. * This is the default implementation. Can be overridden via the * USE_NATIVE_ALLOCATE_ZEROED flag. * ******************************************************************************/ void *acpi_os_allocate_zeroed(acpi_size size) { void *allocation; ACPI_FUNCTION_ENTRY(); allocation = acpi_os_allocate(size); if (allocation) { /* Clear the memory block */ memset(allocation, 0, size); } return (allocation); } #endif /* !USE_NATIVE_ALLOCATE_ZEROED */ /******************************************************************************* * * FUNCTION: acpi_ut_create_caches * * PARAMETERS: None * * RETURN: Status * * DESCRIPTION: Create all local caches * ******************************************************************************/ acpi_status acpi_ut_create_caches(void) { … } /******************************************************************************* * * FUNCTION: acpi_ut_delete_caches * * PARAMETERS: None * * RETURN: Status * * DESCRIPTION: Purge and delete all local caches * ******************************************************************************/ acpi_status acpi_ut_delete_caches(void) { … } /******************************************************************************* * * FUNCTION: acpi_ut_validate_buffer * * PARAMETERS: buffer - Buffer descriptor to be validated * * RETURN: Status * * DESCRIPTION: Perform parameter validation checks on an struct acpi_buffer * ******************************************************************************/ acpi_status acpi_ut_validate_buffer(struct acpi_buffer *buffer) { … } /******************************************************************************* * * FUNCTION: acpi_ut_initialize_buffer * * PARAMETERS: buffer - Buffer to be validated * required_length - Length needed * * RETURN: Status * * DESCRIPTION: Validate that the buffer is of the required length or * allocate a new buffer. Returned buffer is always zeroed. * ******************************************************************************/ acpi_status acpi_ut_initialize_buffer(struct acpi_buffer *buffer, acpi_size required_length) { … }