iPXE
Functions
mlx_memory.h File Reference
#include "mlx_utils.h"

Go to the source code of this file.

Functions

 FILE_LICENCE (GPL2_OR_LATER)
mlx_status mlx_memory_alloc (IN mlx_utils *utils, IN mlx_size size, OUT mlx_void **ptr)
mlx_status mlx_memory_zalloc (IN mlx_utils *utils, IN mlx_size size, OUT mlx_void **ptr)
mlx_status mlx_memory_free (IN mlx_utils *utils, IN mlx_void **ptr)
mlx_status mlx_memory_alloc_dma (IN mlx_utils *utils, IN mlx_size size, IN mlx_size align, OUT mlx_void **ptr)
mlx_status mlx_memory_free_dma (IN mlx_utils *utils, IN mlx_size size, IN mlx_void **ptr)
mlx_status mlx_memory_map_dma (IN mlx_utils *utils, IN mlx_void *Addr, IN mlx_size NumberOfBytes, OUT mlx_physical_address *PhysAddr, OUT mlx_void **Mapping)
mlx_status mlx_memory_ummap_dma (IN mlx_utils *utils, IN mlx_void *Mapping)
mlx_status mlx_memory_cmp (IN mlx_utils *utils, IN mlx_void *first_block, IN mlx_void *second_block, IN mlx_size size, OUT mlx_uint32 *out)
mlx_status mlx_memory_set (IN mlx_utils *utils, IN mlx_void *block, IN mlx_int32 value, IN mlx_size size)
mlx_status mlx_memory_cpy (IN mlx_utils *utils, OUT mlx_void *destination_buffer, IN mlx_void *source_buffer, IN mlx_size length)
mlx_status mlx_memory_cpu_to_be32 (IN mlx_utils *utils, IN mlx_uint32 source, IN mlx_uint32 *destination)
mlx_status mlx_memory_be32_to_cpu (IN mlx_utils *utils, IN mlx_uint32 source, IN mlx_uint32 *destination)

Function Documentation

FILE_LICENCE ( GPL2_OR_LATER  )
mlx_status mlx_memory_alloc ( IN mlx_utils utils,
IN mlx_size  size,
OUT mlx_void **  ptr 
)

Definition at line 27 of file mlx_memory.c.

References MLX_INVALID_PARAMETER, mlx_memory_alloc_priv(), MLX_SUCCESS, NULL, and status.

{
        mlx_status status = MLX_SUCCESS;
        *ptr = NULL;
        if ( utils == NULL || size == 0 || *ptr != NULL ){
                status = MLX_INVALID_PARAMETER;
                goto bad_param;
        }
        status = mlx_memory_alloc_priv(utils, size, ptr);
bad_param:
        return status;
}
mlx_status mlx_memory_zalloc ( IN mlx_utils utils,
IN mlx_size  size,
OUT mlx_void **  ptr 
)

Definition at line 45 of file mlx_memory.c.

References MLX_INVALID_PARAMETER, mlx_memory_zalloc_priv(), MLX_SUCCESS, NULL, and status.

Referenced by nodnic_port_create_cq(), nodnic_port_create_qp(), and nvconfig_nvdata_read_default_value().

{
        mlx_status status = MLX_SUCCESS;
        *ptr = NULL;
        if ( utils == NULL || size == 0 || *ptr != NULL ){
                status = MLX_INVALID_PARAMETER;
                goto bad_param;
        }
        status = mlx_memory_zalloc_priv(utils, size, ptr);
bad_param:
        return status;
}
mlx_status mlx_memory_free ( IN mlx_utils utils,
IN mlx_void **  ptr 
)

Definition at line 63 of file mlx_memory.c.

References MLX_INVALID_PARAMETER, mlx_memory_free_priv(), MLX_SUCCESS, NULL, and status.

Referenced by nodnic_port_create_cq(), nodnic_port_create_qp(), nodnic_port_destroy_cq(), nodnic_port_destroy_qp(), and nvconfig_nvdata_read_default_value().

{
        mlx_status status = MLX_SUCCESS;
        if ( utils == NULL ||  ptr == NULL || *ptr == NULL ){
                status = MLX_INVALID_PARAMETER;
                goto bad_param;
        }
        status = mlx_memory_free_priv(utils, *ptr);
        *ptr = NULL;
bad_param:
        return status;
}
mlx_status mlx_memory_alloc_dma ( IN mlx_utils utils,
IN mlx_size  size,
IN mlx_size  align,
OUT mlx_void **  ptr 
)

Definition at line 79 of file mlx_memory.c.

References MLX_INVALID_PARAMETER, mlx_memory_alloc_dma_priv(), MLX_SUCCESS, NULL, and status.

Referenced by nodnic_port_allocate_dbr_dma(), nodnic_port_allocate_eq(), nodnic_port_create_cq(), and nodnic_port_create_qp().

{
        mlx_status status = MLX_SUCCESS;
        *ptr = NULL;
        if ( utils == NULL || size == 0 || *ptr != NULL ){
                status = MLX_INVALID_PARAMETER;
                goto bad_param;
        }
        status = mlx_memory_alloc_dma_priv(utils, size, align, ptr);
bad_param:
        return status;
}
mlx_status mlx_memory_free_dma ( IN mlx_utils utils,
IN mlx_size  size,
IN mlx_void **  ptr 
)
mlx_status mlx_memory_map_dma ( IN mlx_utils utils,
IN mlx_void Addr,
IN mlx_size  NumberOfBytes,
OUT mlx_physical_address PhysAddr,
OUT mlx_void **  Mapping 
)

Definition at line 116 of file mlx_memory.c.

References MLX_INVALID_PARAMETER, mlx_memory_map_dma_priv(), MLX_SUCCESS, NULL, and status.

Referenced by nodnic_port_allocate_dbr_dma(), nodnic_port_allocate_eq(), nodnic_port_create_cq(), and nodnic_port_create_qp().

{
        mlx_status status = MLX_SUCCESS;
        if ( utils == NULL || phys_addr == NULL ){
                status = MLX_INVALID_PARAMETER;
                goto bad_param;
        }
        status = mlx_memory_map_dma_priv(utils, addr, number_of_bytes, phys_addr, mapping);
bad_param:
        return status;
}
mlx_status mlx_memory_ummap_dma ( IN mlx_utils utils,
IN mlx_void Mapping 
)
mlx_status mlx_memory_cmp ( IN mlx_utils utils,
IN mlx_void first_block,
IN mlx_void second_block,
IN mlx_size  size,
OUT mlx_uint32 out 
)

Definition at line 151 of file mlx_memory.c.

References MLX_INVALID_PARAMETER, mlx_memory_cmp_priv(), MLX_SUCCESS, NULL, and status.

Referenced by nodnic_port_add_mac_filter(), and nodnic_port_remove_mac_filter().

{
        mlx_status status = MLX_SUCCESS;
        if ( utils == NULL || first_block == NULL || second_block == NULL ||
                        out == NULL){
                status = MLX_INVALID_PARAMETER;
                goto bad_param;
        }
        status = mlx_memory_cmp_priv(utils, first_block, second_block, size, out);
bad_param:
        return status;
}
mlx_status mlx_memory_set ( IN mlx_utils utils,
IN mlx_void block,
IN mlx_int32  value,
IN mlx_size  size 
)
mlx_status mlx_memory_cpy ( IN mlx_utils utils,
OUT mlx_void destination_buffer,
IN mlx_void source_buffer,
IN mlx_size  length 
)

Definition at line 189 of file mlx_memory.c.

References MLX_INVALID_PARAMETER, mlx_memory_cpy_priv(), MLX_SUCCESS, NULL, and status.

Referenced by mlx_reg_access(), and nvconfig_nvdata_access().

{
        mlx_status status = MLX_SUCCESS;
        if ( utils == NULL || destination_buffer == NULL || source_buffer == NULL){
                status = MLX_INVALID_PARAMETER;
                goto bad_param;
        }
        status = mlx_memory_cpy_priv(utils, destination_buffer, source_buffer, length);
bad_param:
        return status;
}
mlx_status mlx_memory_cpu_to_be32 ( IN mlx_utils utils,
IN mlx_uint32  source,
IN mlx_uint32 destination 
)

Definition at line 207 of file mlx_memory.c.

References MLX_INVALID_PARAMETER, mlx_memory_cpu_to_be32_priv(), MLX_SUCCESS, NULL, and status.

Referenced by nodnic_device_clear_int(), nodnic_port_recv_db_dma(), nodnic_port_send_db_dma(), and nvconfig_nvdata_access().

{
        mlx_status status = MLX_SUCCESS;
        if ( utils == NULL || destination == NULL ){
                status = MLX_INVALID_PARAMETER;
                goto bad_param;
        }
        status = mlx_memory_cpu_to_be32_priv(utils, source, destination);
bad_param:
        return status;
}
mlx_status mlx_memory_be32_to_cpu ( IN mlx_utils utils,
IN mlx_uint32  source,
IN mlx_uint32 destination 
)

Definition at line 224 of file mlx_memory.c.

References MLX_INVALID_PARAMETER, mlx_memory_be32_to_cpu_priv(), MLX_SUCCESS, NULL, and status.

Referenced by nvconfig_nvdata_access(), nvconfig_nvdata_default_access(), and nvconfig_read_rom_ini_values().

{
        mlx_status status = MLX_SUCCESS;
        if ( utils == NULL || destination == NULL ){
                status = MLX_INVALID_PARAMETER;
                goto bad_param;
        }
        status = mlx_memory_be32_to_cpu_priv(utils, source, destination);
bad_param:
        return status;
}