From: Heinrich Schuchardt Date: Mon, 4 Dec 2017 19:52:41 +0000 (+0100) Subject: efi_loader: add comments to memory functions X-Git-Url: http://git.dujemihanovic.xyz/?a=commitdiff_plain;h=474a6f5aa1f2ce7ce277fb466a614e93e1b736bb;p=u-boot.git efi_loader: add comments to memory functions Add comments describing memory functions. Fix the formatting of a function declaration. Signed-off-by: Heinrich Schuchardt Signed-off-by: Alexander Graf --- diff --git a/lib/efi_loader/efi_memory.c b/lib/efi_loader/efi_memory.c index 0aa3e0881d..aaf64421a3 100644 --- a/lib/efi_loader/efi_memory.c +++ b/lib/efi_loader/efi_memory.c @@ -275,6 +275,15 @@ static uint64_t efi_find_free_memory(uint64_t len, uint64_t max_addr) return 0; } +/* + * Allocate memory pages. + * + * @type type of allocation to be performed + * @memory_type usage type of the allocated memory + * @pages number of pages to be allocated + * @memory allocated memory + * @return status code + */ efi_status_t efi_allocate_pages(int type, int memory_type, efi_uintn_t pages, uint64_t *memory) { @@ -338,6 +347,13 @@ void *efi_alloc(uint64_t len, int memory_type) return NULL; } +/* + * Free memory pages. + * + * @memory start of the memory area to be freed + * @pages number of pages to be freed + * @return status code + */ efi_status_t efi_free_pages(uint64_t memory, efi_uintn_t pages) { uint64_t r = 0; @@ -351,8 +367,15 @@ efi_status_t efi_free_pages(uint64_t memory, efi_uintn_t pages) return EFI_NOT_FOUND; } -efi_status_t efi_allocate_pool(int pool_type, efi_uintn_t size, - void **buffer) +/* + * Allocate memory from pool. + * + * @pool_type type of the pool from which memory is to be allocated + * @size number of bytes to be allocated + * @buffer allocated memory + * @return status code + */ +efi_status_t efi_allocate_pool(int pool_type, efi_uintn_t size, void **buffer) { efi_status_t r; efi_physical_addr_t t; @@ -375,6 +398,12 @@ efi_status_t efi_allocate_pool(int pool_type, efi_uintn_t size, return r; } +/* + * Free memory from pool. + * + * @buffer start of memory to be freed + * @return status code + */ efi_status_t efi_free_pool(void *buffer) { efi_status_t r; @@ -392,6 +421,17 @@ efi_status_t efi_free_pool(void *buffer) return r; } +/* + * Get map describing memory usage. + * + * @memory_map_size on entry the size, in bytes, of the memory map buffer, + * on exit the size of the copied memory map + * @memory_map buffer to which the memory map is written + * @map_key key for the memory map + * @descriptor_size size of an individual memory descriptor + * @descriptor_version version number of the memory descriptor structure + * @return status code + */ efi_status_t efi_get_memory_map(efi_uintn_t *memory_map_size, struct efi_mem_desc *memory_map, efi_uintn_t *map_key,