iPXE
Functions
mlx_memory_priv.h File Reference
#include "../../../mlx_utils/include/public/mlx_utils.h"

Go to the source code of this file.

Functions

 FILE_LICENCE (GPL2_OR_LATER)
 
mlx_status mlx_memory_alloc_priv (IN mlx_utils *utils, IN mlx_size size, OUT mlx_void **ptr)
 
mlx_status mlx_memory_zalloc_priv (IN mlx_utils *utils, IN mlx_size size, OUT mlx_void **ptr)
 
mlx_status mlx_memory_free_priv (IN mlx_utils *utils, IN mlx_void *ptr)
 
mlx_status mlx_memory_alloc_dma_priv (IN mlx_utils *utils, IN mlx_size size, IN mlx_size align, OUT mlx_void **ptr)
 
mlx_status mlx_memory_free_dma_priv (IN mlx_utils *utils, IN mlx_size size, IN mlx_void *ptr)
 
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)
 
mlx_status mlx_memory_ummap_dma_priv (IN mlx_utils *utils, IN mlx_void *mapping)
 
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)
 
mlx_status mlx_memory_set_priv (IN mlx_utils *utils, IN mlx_void *block, IN mlx_int32 value, IN mlx_size size)
 
mlx_status mlx_memory_cpy_priv (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_priv (IN mlx_utils *utils, IN mlx_uint32 source, IN mlx_uint32 *destination)
 
mlx_status mlx_memory_be32_to_cpu_priv (IN mlx_utils *utils, IN mlx_uint32 source, IN mlx_uint32 *destination)
 

Function Documentation

◆ FILE_LICENCE()

FILE_LICENCE ( GPL2_OR_LATER  )

◆ mlx_memory_alloc_priv()

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

Definition at line 16 of file mlx_memory_priv.c.

21 {
23  *ptr = malloc(size);
24  if(*ptr == NULL){
26  }
27  return status;
28 }
uint8_t status
Status.
Definition: ena.h:16
#define MLX_SUCCESS
void * malloc(size_t size)
Allocate memory.
Definition: malloc.c:583
#define MLX_OUT_OF_RESOURCES
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 malloc(), MLX_OUT_OF_RESOURCES, MLX_SUCCESS, NULL, size, and status.

Referenced by mlx_memory_alloc().

◆ mlx_memory_zalloc_priv()

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

Definition at line 31 of file mlx_memory_priv.c.

36 {
38  *ptr = zalloc(size);
39  if(*ptr == NULL){
41  }
42  return status;
43 }
uint8_t status
Status.
Definition: ena.h:16
#define MLX_SUCCESS
void * zalloc(size_t size)
Allocate cleared memory.
Definition: malloc.c:624
#define MLX_OUT_OF_RESOURCES
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_OUT_OF_RESOURCES, MLX_SUCCESS, NULL, size, status, and zalloc().

Referenced by mlx_memory_zalloc().

◆ mlx_memory_free_priv()

mlx_status mlx_memory_free_priv ( IN mlx_utils utils,
IN mlx_void ptr 
)

Definition at line 46 of file mlx_memory_priv.c.

50 {
52  free(ptr);
53  return status;
54 }
uint8_t status
Status.
Definition: ena.h:16
#define MLX_SUCCESS
static void(* free)(struct refcnt *refcnt))
Definition: refcnt.h:54
int mlx_status

References free, MLX_SUCCESS, and status.

Referenced by mlx_memory_free().

◆ mlx_memory_alloc_dma_priv()

mlx_status mlx_memory_alloc_dma_priv ( IN mlx_utils utils,
IN mlx_size  size,
IN mlx_size  align,
OUT mlx_void **  ptr 
)

Definition at line 56 of file mlx_memory_priv.c.

62 {
64  *ptr = malloc_dma(size, align);
65  if (*ptr == NULL) {
67  } else {
68  memset(*ptr, 0, size);
69  }
70  return status;
71 }
uint8_t status
Status.
Definition: ena.h:16
mlx_uint8 align
Definition: mlx_port.h:58
#define MLX_SUCCESS
#define MLX_OUT_OF_RESOURCES
static void *__malloc malloc_dma(size_t size, size_t phys_align)
Allocate memory for DMA.
Definition: malloc.h:66
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
void * memset(void *dest, int character, size_t len) __nonnull

References malloc_dma(), memset(), MLX_OUT_OF_RESOURCES, MLX_SUCCESS, NULL, size, and status.

Referenced by mlx_memory_alloc_dma().

◆ mlx_memory_free_dma_priv()

mlx_status mlx_memory_free_dma_priv ( IN mlx_utils utils,
IN mlx_size  size,
IN mlx_void ptr 
)

Definition at line 74 of file mlx_memory_priv.c.

79 {
81  free_dma(ptr, size);
82  return status;
83 }
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
static void free_dma(void *ptr, size_t size)
Free memory allocated with malloc_dma()
Definition: malloc.h:81

References free_dma(), MLX_SUCCESS, size, and status.

Referenced by mlx_memory_free_dma().

◆ mlx_memory_map_dma_priv()

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 
)

Definition at line 85 of file mlx_memory_priv.c.

92 {
94  *phys_addr = virt_to_bus(addr);
95  return status;
96 }
uint8_t status
Status.
Definition: ena.h:16
static __always_inline unsigned long virt_to_bus(volatile const void *addr)
Convert virtual address to a bus address.
Definition: io.h:183
#define MLX_SUCCESS
u32 addr
Definition: sky2.h:8
int mlx_status

References addr, MLX_SUCCESS, status, and virt_to_bus().

Referenced by mlx_memory_map_dma().

◆ mlx_memory_ummap_dma_priv()

mlx_status mlx_memory_ummap_dma_priv ( IN mlx_utils utils,
IN mlx_void mapping 
)

Definition at line 99 of file mlx_memory_priv.c.

103 {
105  return status;
106 }
uint8_t status
Status.
Definition: ena.h:16
#define MLX_SUCCESS
int mlx_status

References MLX_SUCCESS, and status.

Referenced by mlx_memory_ummap_dma().

◆ mlx_memory_cmp_priv()

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 
)

Referenced by mlx_memory_cmp().

◆ mlx_memory_set_priv()

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

Referenced by mlx_memory_set().

◆ mlx_memory_cpy_priv()

mlx_status mlx_memory_cpy_priv ( IN mlx_utils utils,
OUT mlx_void destination_buffer,
IN mlx_void source_buffer,
IN mlx_size  length 
)

Referenced by mlx_memory_cpy().

◆ mlx_memory_cpu_to_be32_priv()

mlx_status mlx_memory_cpu_to_be32_priv ( IN mlx_utils utils,
IN mlx_uint32  source,
IN mlx_uint32 destination 
)

Referenced by mlx_memory_cpu_to_be32().

◆ mlx_memory_be32_to_cpu_priv()

mlx_status mlx_memory_be32_to_cpu_priv ( IN mlx_utils utils,
IN mlx_uint32  source,
IN mlx_uint32 destination 
)

Referenced by mlx_memory_be32_to_cpu().