From: Matt Fleming <matt.fleming@intel.com>
To: Leif Lindholm <leif.lindholm@linaro.org>
Cc: linux-efi@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-ia64@vger.kernel.org, hpa@zytor.com, tglx@linutronix.de,
patches@linaro.org
Subject: Re: [PATCH 4/4] efi: x86: make efi_lookup_mapped_addr() a common function
Date: Wed, 31 Jul 2013 09:58:20 +0100 [thread overview]
Message-ID: <51F8D1AC.4040501@intel.com> (raw)
In-Reply-To: <1375202858-28470-5-git-send-email-leif.lindholm@linaro.org>
On 07/30/2013 05:47 PM, Leif Lindholm wrote:
> efi_lookup_mapped_addr() is a handy utility for other platforms
> than x86. Move it from arch/x86 to drivers/firmware/efi.
>
> This function will be used by future ARM patches.
>
> Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org>
> ---
> arch/x86/platform/efi/efi.c | 28 ----------------------------
> drivers/firmware/efi/efi.c | 30 ++++++++++++++++++++++++++++++
> 2 files changed, 30 insertions(+), 28 deletions(-)
>
[...]
> +#if defined(CONFIG_X86)
> +/*
> + * We can't ioremap data in EFI boot services RAM, because we've already mapped
> + * it as RAM. So, look it up in the existing EFI memory map instead. Only
> + * callable after efi_enter_virtual_mode and before efi_free_boot_services.
> + */
> +void __iomem *efi_lookup_mapped_addr(u64 phys_addr)
> +{
> + void *p;
> + if (WARN_ON(!memmap.map))
> + return NULL;
> + for (p = memmap.map; p < memmap.map_end; p += memmap.desc_size) {
> + efi_memory_desc_t *md = p;
> + u64 size = md->num_pages << EFI_PAGE_SHIFT;
> + u64 end = md->phys_addr + size;
> + if (!(md->attribute & EFI_MEMORY_RUNTIME) &&
> + md->type != EFI_BOOT_SERVICES_CODE &&
> + md->type != EFI_BOOT_SERVICES_DATA)
> + continue;
> + if (!md->virt_addr)
> + continue;
> + if (phys_addr >= md->phys_addr && phys_addr < end) {
> + phys_addr += md->virt_addr - md->phys_addr;
> + return (__force void __iomem *)(unsigned long)phys_addr;
> + }
> + }
> + return NULL;
> +}
> +#endif
> +
If we hang a 'struct efi_memory_map' off of 'struct efi', can we get rid
of this #ifdef?
next prev parent reply other threads:[~2013-07-31 8:58 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-30 16:47 [PATCH 0/4] Make commonly useful UEFI functions common Leif Lindholm
2013-07-30 16:47 ` [PATCH 1/4] efi: provide a generic efi_config_init() Leif Lindholm
[not found] ` <1375202858-28470-2-git-send-email-leif.lindholm-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2013-07-30 17:53 ` Tony Luck
2013-07-30 18:02 ` Leif Lindholm
2013-07-30 18:14 ` Tony Luck
2013-07-30 16:47 ` [PATCH 2/4] efi: x86: use common code for (U)EFI configuration scanning Leif Lindholm
2013-07-30 16:47 ` [PATCH 3/4] efi: ia64: " Leif Lindholm
2013-07-30 16:47 ` [PATCH 4/4] efi: x86: make efi_lookup_mapped_addr() a common function Leif Lindholm
2013-07-31 8:58 ` Matt Fleming [this message]
[not found] ` <51F8D1AC.4040501-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2013-08-01 10:11 ` Leif Lindholm
[not found] ` <1375202858-28470-1-git-send-email-leif.lindholm-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2013-07-30 19:57 ` [PATCH 0/4] Make commonly useful UEFI functions common Tony Luck
2013-08-01 20:26 ` H. Peter Anvin
2013-08-01 20:45 ` Fleming, Matt
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=51F8D1AC.4040501@intel.com \
--to=matt.fleming@intel.com \
--cc=hpa@zytor.com \
--cc=leif.lindholm@linaro.org \
--cc=linux-efi@vger.kernel.org \
--cc=linux-ia64@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=patches@linaro.org \
--cc=tglx@linutronix.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