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()

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);
40 bad_param:
41  return status;
42 }
#define MLX_INVALID_PARAMETER
uint8_t status
Status.
Definition: ena.h:16
#define MLX_SUCCESS
uint8_t size
Entry size (in 32-bit words)
Definition: ena.h:16
int mlx_status
mlx_status mlx_memory_alloc_priv(IN mlx_utils *utils, IN mlx_size size, OUT mlx_void **ptr)
#define NULL
NULL pointer (VOID *)
Definition: Base.h:362

References MLX_INVALID_PARAMETER, mlx_memory_alloc_priv(), MLX_SUCCESS, NULL, 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);
58 bad_param:
59  return status;
60 }
#define MLX_INVALID_PARAMETER
uint8_t status
Status.
Definition: ena.h:16
#define MLX_SUCCESS
mlx_status mlx_memory_zalloc_priv(IN mlx_utils *utils, IN mlx_size size, OUT mlx_void **ptr)
uint8_t size
Entry size (in 32-bit words)
Definition: ena.h:16
int mlx_status
#define NULL
NULL pointer (VOID *)
Definition: Base.h:362

References MLX_INVALID_PARAMETER, mlx_memory_zalloc_priv(), MLX_SUCCESS, NULL, 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;
75 bad_param:
76  return status;
77 }
#define MLX_INVALID_PARAMETER
uint8_t status
Status.
Definition: ena.h:16
#define MLX_SUCCESS
mlx_status mlx_memory_free_priv(IN mlx_utils *utils, IN mlx_void *ptr)
int mlx_status
#define NULL
NULL pointer (VOID *)
Definition: Base.h:362

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_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  }
93 bad_param:
94  return status;
95 }
#define MLX_INVALID_PARAMETER
uint8_t status
Status.
Definition: ena.h:16
mlx_uint8 align
Definition: mlx_port.h:58
#define MLX_SUCCESS
mlx_status mlx_memory_alloc_dma_priv(IN mlx_utils *utils, IN mlx_size size, IN mlx_size align, OUT mlx_void **ptr)
uint8_t size
Entry size (in 32-bit words)
Definition: ena.h:16
int mlx_status
#define NULL
NULL pointer (VOID *)
Definition: Base.h:362

References MLX_INVALID_PARAMETER, mlx_memory_alloc_dma_priv(), MLX_SUCCESS, NULL, 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;
111 bad_param:
112  return status;
113 }
#define MLX_INVALID_PARAMETER
uint8_t status
Status.
Definition: ena.h:16
#define MLX_SUCCESS
mlx_status mlx_memory_free_dma_priv(IN mlx_utils *utils, IN mlx_size size, IN mlx_void *ptr)
uint8_t size
Entry size (in 32-bit words)
Definition: ena.h:16
int mlx_status
#define NULL
NULL pointer (VOID *)
Definition: Base.h:362

References 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  NumberOfBytes,
OUT mlx_physical_address PhysAddr,
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);
130 bad_param:
131  return status;
132 }
#define MLX_INVALID_PARAMETER
uint8_t status
Status.
Definition: ena.h:16
#define MLX_SUCCESS
u32 addr
Definition: sky2.h:8
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)
int mlx_status
#define NULL
NULL pointer (VOID *)
Definition: Base.h:362

References addr, 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_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);
146 bad_param:
147  return status;
148 }
#define MLX_INVALID_PARAMETER
uint8_t status
Status.
Definition: ena.h:16
#define MLX_SUCCESS
mlx_status mlx_memory_ummap_dma_priv(IN mlx_utils *utils, IN mlx_void *mapping)
int mlx_status
#define NULL
NULL pointer (VOID *)
Definition: Base.h:362

References 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);
166 bad_param:
167  return status;
168 }
#define MLX_INVALID_PARAMETER
uint8_t status
Status.
Definition: ena.h:16
__be32 out[4]
Definition: CIB_PRM.h:36
#define MLX_SUCCESS
uint8_t size
Entry size (in 32-bit words)
Definition: ena.h:16
int mlx_status
#define NULL
NULL pointer (VOID *)
Definition: Base.h:362
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 MLX_INVALID_PARAMETER, mlx_memory_cmp_priv(), MLX_SUCCESS, NULL, 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  }
184 bad_param:
185  return status;
186 }
#define MLX_INVALID_PARAMETER
uint16_t block
Definition: tftp.h:12
uint8_t status
Status.
Definition: ena.h:16
#define MLX_SUCCESS
pseudo_bit_t value[0x00020]
Definition: arbel.h:13
mlx_status mlx_memory_set_priv(IN mlx_utils *utils, IN mlx_void *block, IN mlx_int32 value, IN mlx_size size)
uint8_t size
Entry size (in 32-bit words)
Definition: ena.h:16
int mlx_status
#define NULL
NULL pointer (VOID *)
Definition: Base.h:362

References block, 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);
202 bad_param:
203  return status;
204 }
uint16_t length
Length.
Definition: intel.h:14
#define MLX_INVALID_PARAMETER
mlx_status mlx_memory_cpy_priv(IN mlx_utils *utils, OUT mlx_void *destination_buffer, IN mlx_void *source_buffer, IN mlx_size length)
uint8_t status
Status.
Definition: ena.h:16
#define MLX_SUCCESS
int mlx_status
#define NULL
NULL pointer (VOID *)
Definition: Base.h:362

References length, MLX_INVALID_PARAMETER, mlx_memory_cpy_priv(), MLX_SUCCESS, NULL, 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);
219 bad_param:
220  return status;
221 }
#define MLX_INVALID_PARAMETER
mlx_status mlx_memory_cpu_to_be32_priv(IN mlx_utils *utils, IN mlx_uint32 source, IN mlx_uint32 *destination)
uint8_t status
Status.
Definition: ena.h:16
#define MLX_SUCCESS
int mlx_status
#define NULL
NULL pointer (VOID *)
Definition: Base.h:362

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_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);
236 bad_param:
237  return status;
238 }
#define MLX_INVALID_PARAMETER
uint8_t status
Status.
Definition: ena.h:16
mlx_status mlx_memory_be32_to_cpu_priv(IN mlx_utils *utils, IN mlx_uint32 source, IN mlx_uint32 *destination)
#define MLX_SUCCESS
int mlx_status
#define NULL
NULL pointer (VOID *)
Definition: Base.h:362

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().