lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Wed, 31 Jul 2013 09:58:20 +0100
From:	Matt Fleming <matt.fleming@...el.com>
To:	Leif Lindholm <leif.lindholm@...aro.org>
CC:	linux-efi@...r.kernel.org, linux-kernel@...r.kernel.org,
	linux-ia64@...r.kernel.org, hpa@...or.com, tglx@...utronix.de,
	patches@...aro.org
Subject: Re: [PATCH 4/4] efi: x86: make efi_lookup_mapped_addr() a common
 function

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@...aro.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?
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ