From: Randy Dunlap <rdunlap@infradead.org>
To: Heinrich Schuchardt <xypron.glpk@gmx.de>,
Ard Biesheuvel <ardb@kernel.org>
Cc: linux-efi@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 1/1] efi/libstub: describe memory functions
Date: Mon, 17 Feb 2020 15:50:57 -0800 [thread overview]
Message-ID: <3fbbd26d-2de0-08b3-e41e-6ab58bf792a6@infradead.org> (raw)
In-Reply-To: <20200217215443.3004-1-xypron.glpk@gmx.de>
On 2/17/20 1:54 PM, Heinrich Schuchardt wrote:
> Provide descriptions of:
>
> * efi_get_memory_map()
> * efi_low_alloc_above()
> * efi_free()
>
> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
> ---
> v2:
> point out how efi_free() is rounding up the memory size
> ---
> drivers/firmware/efi/libstub/mem.c | 36 ++++++++++++++++++++++++++++--
> 1 file changed, 34 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/firmware/efi/libstub/mem.c b/drivers/firmware/efi/libstub/mem.c
> index c25fd9174b74..49116b9b0801 100644
> --- a/drivers/firmware/efi/libstub/mem.c
> +++ b/drivers/firmware/efi/libstub/mem.c
> @@ -16,6 +16,15 @@ static inline bool mmap_has_headroom(unsigned long buff_size,
> return slack / desc_size >= EFI_MMAP_NR_SLACK_SLOTS;
> }
>
Hi,
Please use proper kernel-doc notation. See below...
> +/**
> + * efi_get_memory_map() - get memory map
> + * @map on return pointer to memory map
* @map:
> + *
> + * Retrieve the UEFI memory map. The allocated memory leaves room for
> + * up to EFI_MMAP_NR_SLACK_SLOTS additional memory map entries.
> + *
> + * Return: status code
> + */
> efi_status_t efi_get_memory_map(struct efi_boot_memmap *map)
> {
> efi_memory_desc_t *m = NULL;
> @@ -109,8 +118,20 @@ efi_status_t efi_allocate_pages(unsigned long size, unsigned long *addr,
> }
> return EFI_SUCCESS;
> }
> -/*
> - * Allocate at the lowest possible address that is not below 'min'.
> +/**
> + * efi_low_alloc_above() - allocate pages at or above given address
> + * @size: size of the memory area to allocate
> + * @align: minimum alignment of the allocated memory area. It should
> + * a power of two.
> + * @addr: on exit the address of the allocated memory
> + * @min: minimum address to used for the memory allocation
> + *
> + * Allocate at the lowest possible address that is not below 'min' as
> + * EFI_LOADER_DATA. The allocated pages are aligned according to 'align' but at
> + * least EFI_ALLOC_ALIGN. The first allocated page will not below the address
> + * given by 'min'.
> + *
> + * Return: status code
> */
> efi_status_t efi_low_alloc_above(unsigned long size, unsigned long align,
> unsigned long *addr, unsigned long min)
> @@ -187,6 +208,17 @@ efi_status_t efi_low_alloc_above(unsigned long size, unsigned long align,
> return status;
> }
>
> +/**
> + * efi_free() - free memory pages
> + * @size size of the memory area to free in bytes
* @size:
* @addr:
> + * @addr start of the memory area to free (must be EFI_PAGE_SIZE
> + * aligned)
> + *
> + * 'size' is rounded up to a multiple of EFI_ALLOC_ALIGN which is an
> + * architecture specific multiple of EFI_PAGE_SIZE. So this function should
> + * only be used to return pages allocated with efi_allocate_pages() or
> + * efi_low_alloc_above().
> + */
> void efi_free(unsigned long size, unsigned long addr)
> {
> unsigned long nr_pages;
> --
> 2.25.0
>
Thanks.
--
~Randy
prev parent reply other threads:[~2020-02-17 23:51 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-17 21:54 [PATCH v2 1/1] efi/libstub: describe memory functions Heinrich Schuchardt
2020-02-17 23:50 ` Randy Dunlap [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3fbbd26d-2de0-08b3-e41e-6ab58bf792a6@infradead.org \
--to=rdunlap@infradead.org \
--cc=ardb@kernel.org \
--cc=linux-efi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=xypron.glpk@gmx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).