iPXE
mlx_memory.c File Reference

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 number_of_bytes, OUT mlx_physical_address *phys_addr, 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()

FILE_LICENCE ( GPL2_OR_LATER )

◆ mlx_memory_alloc()

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.

32{
34 *ptr = NULL;
35 if ( utils == NULL || size == 0 || *ptr != NULL ){
37 goto bad_param;
38 }
39 status = mlx_memory_alloc_priv(utils, size, ptr);
40bad_param:
41 return status;
42}
#define NULL
NULL pointer (VOID *)
Definition Base.h:322
uint8_t status
Status.
Definition ena.h:5
uint16_t size
Buffer size.
Definition dwmac.h:3
mlx_status mlx_memory_alloc_priv(IN mlx_utils *utils, IN mlx_size size, OUT mlx_void **ptr)
#define MLX_INVALID_PARAMETER
#define MLX_SUCCESS
int mlx_status

References IN, MLX_INVALID_PARAMETER, mlx_memory_alloc_priv(), MLX_SUCCESS, NULL, OUT, size, and status.

◆ mlx_memory_zalloc()

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.

50{
52 *ptr = NULL;
53 if ( utils == NULL || size == 0 || *ptr != NULL ){
55 goto bad_param;
56 }
57 status = mlx_memory_zalloc_priv(utils, size, ptr);
58bad_param:
59 return status;
60}
mlx_status mlx_memory_zalloc_priv(IN mlx_utils *utils, IN mlx_size size, OUT mlx_void **ptr)

References IN, MLX_INVALID_PARAMETER, mlx_memory_zalloc_priv(), MLX_SUCCESS, NULL, OUT, size, and status.

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

◆ mlx_memory_free()

mlx_status mlx_memory_free ( IN mlx_utils * utils,
IN mlx_void ** ptr )

Definition at line 63 of file mlx_memory.c.

67{
69 if ( utils == NULL || ptr == NULL || *ptr == NULL ){
71 goto bad_param;
72 }
73 status = mlx_memory_free_priv(utils, *ptr);
74 *ptr = NULL;
75bad_param:
76 return status;
77}
mlx_status mlx_memory_free_priv(IN mlx_utils *utils, IN mlx_void *ptr)

References IN, 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_memory_alloc_dma()

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.

85{
87 *ptr = NULL;
88 if ( utils == NULL || size == 0 || *ptr != NULL ){
90 goto bad_param;
91 }
92 status = mlx_memory_alloc_dma_priv(utils, size, align, ptr);
93bad_param:
94 return status;
95}
mlx_status mlx_memory_alloc_dma_priv(IN mlx_utils *utils, IN mlx_size size, IN mlx_size align, OUT mlx_void **ptr)

References IN, MLX_INVALID_PARAMETER, mlx_memory_alloc_dma_priv(), MLX_SUCCESS, NULL, OUT, size, and status.

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

◆ mlx_memory_free_dma()

mlx_status mlx_memory_free_dma ( IN mlx_utils * utils,
IN mlx_size size,
IN mlx_void ** ptr )

Definition at line 98 of file mlx_memory.c.

103{
105 if ( utils == NULL || size == 0 || ptr == NULL || *ptr == NULL ){
107 goto bad_param;
108 }
109 status = mlx_memory_free_dma_priv(utils, size, *ptr);
110 *ptr = NULL;
111bad_param:
112 return status;
113}
mlx_status mlx_memory_free_dma_priv(IN mlx_utils *utils, IN mlx_size size, IN mlx_void *ptr)

References IN, MLX_INVALID_PARAMETER, mlx_memory_free_dma_priv(), MLX_SUCCESS, NULL, size, and status.

Referenced by nodnic_port_allocate_dbr_dma(), nodnic_port_allocate_eq(), nodnic_port_create_cq(), nodnic_port_create_qp(), nodnic_port_destroy_cq(), nodnic_port_destroy_qp(), and nodnic_port_free_eq().

◆ mlx_memory_map_dma()

mlx_status mlx_memory_map_dma ( IN mlx_utils * utils,
IN mlx_void * addr,
IN mlx_size number_of_bytes,
OUT mlx_physical_address * phys_addr,
OUT mlx_void ** mapping )

Definition at line 116 of file mlx_memory.c.

123{
125 if ( utils == NULL || phys_addr == NULL ){
127 goto bad_param;
128 }
129 status = mlx_memory_map_dma_priv(utils, addr, number_of_bytes, phys_addr, mapping);
130bad_param:
131 return status;
132}
uint32_t addr
Buffer address.
Definition dwmac.h:9
mlx_status mlx_memory_map_dma_priv(IN mlx_utils *utils, IN mlx_void *addr, IN mlx_size number_of_bytes, OUT mlx_physical_address *phys_addr, OUT mlx_void **mapping)

References addr, IN, MLX_INVALID_PARAMETER, mlx_memory_map_dma_priv(), MLX_SUCCESS, NULL, OUT, and status.

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

◆ mlx_memory_ummap_dma()

mlx_status mlx_memory_ummap_dma ( IN mlx_utils * utils,
IN mlx_void * mapping )

Definition at line 135 of file mlx_memory.c.

139{
141 if ( utils == NULL){
143 goto bad_param;
144 }
145 status = mlx_memory_ummap_dma_priv(utils, mapping);
146bad_param:
147 return status;
148}
mlx_status mlx_memory_ummap_dma_priv(IN mlx_utils *utils, IN mlx_void *mapping)

References IN, MLX_INVALID_PARAMETER, mlx_memory_ummap_dma_priv(), MLX_SUCCESS, NULL, and status.

Referenced by nodnic_port_allocate_dbr_dma(), nodnic_port_allocate_eq(), nodnic_port_create_cq(), nodnic_port_create_qp(), nodnic_port_destroy_cq(), nodnic_port_destroy_qp(), and nodnic_port_free_eq().

◆ mlx_memory_cmp()

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.

158{
160 if ( utils == NULL || first_block == NULL || second_block == NULL ||
161 out == NULL){
163 goto bad_param;
164 }
165 status = mlx_memory_cmp_priv(utils, first_block, second_block, size, out);
166bad_param:
167 return status;
168}
__be32 out[4]
Definition CIB_PRM.h:8
mlx_status mlx_memory_cmp_priv(IN mlx_utils *utils, IN mlx_void *first_block, IN mlx_void *second_block, IN mlx_size size, OUT mlx_uint32 *out)

References IN, MLX_INVALID_PARAMETER, mlx_memory_cmp_priv(), MLX_SUCCESS, NULL, OUT, out, size, and status.

Referenced by nodnic_port_add_mac_filter(), and nodnic_port_remove_mac_filter().

◆ mlx_memory_set()

mlx_status mlx_memory_set ( IN mlx_utils * utils,
IN mlx_void * block,
IN mlx_int32 value,
IN mlx_size size )

Definition at line 171 of file mlx_memory.c.

177{
179 if ( utils == NULL || block == NULL){
181 goto bad_param;
182 }
184bad_param:
185 return status;
186}
pseudo_bit_t value[0x00020]
Definition arbel.h:2
mlx_status mlx_memory_set_priv(IN mlx_utils *utils, IN mlx_void *block, IN mlx_int32 value, IN mlx_size size)
uint8_t block[3][8]
DES-encrypted blocks.
Definition mschapv2.h:1

References block, IN, MLX_INVALID_PARAMETER, mlx_memory_set_priv(), MLX_SUCCESS, NULL, size, status, and value.

Referenced by mlx_blink_leds(), mlx_get_max_mtu(), mlx_get_max_speed(), mlx_reg_access(), mlx_set_admin_mtu(), mlx_set_link_speed(), nodnic_port_add_mac_filter(), nodnic_port_create_qp(), nodnic_port_remove_mac_filter(), nvconfig_nvdata_access(), nvconfig_nvdata_invalidate(), nvconfig_query_capability(), nvconfig_read_general_default_values(), nvconfig_read_port_default_values(), and nvconfig_read_rom_ini_values().

◆ mlx_memory_cpy()

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.

195{
197 if ( utils == NULL || destination_buffer == NULL || source_buffer == NULL){
199 goto bad_param;
200 }
201 status = mlx_memory_cpy_priv(utils, destination_buffer, source_buffer, length);
202bad_param:
203 return status;
204}
mlx_status mlx_memory_cpy_priv(IN mlx_utils *utils, OUT mlx_void *destination_buffer, IN mlx_void *source_buffer, IN mlx_size length)
u16 length
Definition sky2.h:1

References IN, length, MLX_INVALID_PARAMETER, mlx_memory_cpy_priv(), MLX_SUCCESS, NULL, OUT, and status.

Referenced by mlx_reg_access(), and nvconfig_nvdata_access().

◆ mlx_memory_cpu_to_be32()

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.

212{
214 if ( utils == NULL || destination == NULL ){
216 goto bad_param;
217 }
218 status = mlx_memory_cpu_to_be32_priv(utils, source, destination);
219bad_param:
220 return status;
221}
mlx_status mlx_memory_cpu_to_be32_priv(IN mlx_utils *utils, IN mlx_uint32 source, IN mlx_uint32 *destination)

References IN, 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_memory_be32_to_cpu()

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.

229{
231 if ( utils == NULL || destination == NULL ){
233 goto bad_param;
234 }
235 status = mlx_memory_be32_to_cpu_priv(utils, source, destination);
236bad_param:
237 return status;
238}
mlx_status mlx_memory_be32_to_cpu_priv(IN mlx_utils *utils, IN mlx_uint32 source, IN mlx_uint32 *destination)

References IN, 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().