diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2014-10-23 14:45:09 -0700 | 
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-10-23 14:45:09 -0700 | 
| commit | 8c81f48e16fbe103e682d7ee7b2f16d065c42954 (patch) | |
| tree | 1eac3abf36ed9330b3d5f9e550d1ccbc0c174f9b /drivers/firmware/efi/efi.c | |
| parent | 5de551e0eeddf470928e9fee59825a3645641bc7 (diff) | |
| parent | 75b128573b275d5a5a7210b98c4b8cb3b39c12e7 (diff) | |
| download | talos-op-linux-8c81f48e16fbe103e682d7ee7b2f16d065c42954.tar.gz talos-op-linux-8c81f48e16fbe103e682d7ee7b2f16d065c42954.zip | |
Merge branch 'x86-efi-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull x86 EFI updates from Peter Anvin:
 "This patchset falls under the "maintainers that grovel" clause in the
  v3.18-rc1 announcement.  We had intended to push it late in the merge
  window since we got it into the -tip tree relatively late.
  Many of these are relatively simple things, but there are a couple of
  key bits, especially Ard's and Matt's patches"
* 'x86-efi-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (24 commits)
  rtc: Disable EFI rtc for x86
  efi: rtc-efi: Export platform:rtc-efi as module alias
  efi: Delete the in_nmi() conditional runtime locking
  efi: Provide a non-blocking SetVariable() operation
  x86/efi: Adding efi_printks on memory allocationa and pci.reads
  x86/efi: Mark initialization code as such
  x86/efi: Update comment regarding required phys mapped EFI services
  x86/efi: Unexport add_efi_memmap variable
  x86/efi: Remove unused efi_call* macros
  efi: Resolve some shadow warnings
  arm64: efi: Format EFI memory type & attrs with efi_md_typeattr_format()
  ia64: efi: Format EFI memory type & attrs with efi_md_typeattr_format()
  x86: efi: Format EFI memory type & attrs with efi_md_typeattr_format()
  efi: Introduce efi_md_typeattr_format()
  efi: Add macro for EFI_MEMORY_UCE memory attribute
  x86/efi: Clear EFI_RUNTIME_SERVICES if failing to enter virtual mode
  arm64/efi: Do not enter virtual mode if booting with efi=noruntime or noefi
  arm64/efi: uefi_init error handling fix
  efi: Add kernel param efi=noruntime
  lib: Add a generic cmdline parse function parse_option_str
  ...
Diffstat (limited to 'drivers/firmware/efi/efi.c')
| -rw-r--r-- | drivers/firmware/efi/efi.c | 79 | 
1 files changed, 79 insertions, 0 deletions
| diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c index 64ecbb501c50..8590099ac148 100644 --- a/drivers/firmware/efi/efi.c +++ b/drivers/firmware/efi/efi.c @@ -41,6 +41,28 @@ struct efi __read_mostly efi = {  };  EXPORT_SYMBOL(efi); +static bool disable_runtime; +static int __init setup_noefi(char *arg) +{ +	disable_runtime = true; +	return 0; +} +early_param("noefi", setup_noefi); + +bool efi_runtime_disabled(void) +{ +	return disable_runtime; +} + +static int __init parse_efi_cmdline(char *str) +{ +	if (parse_option_str(str, "noruntime")) +		disable_runtime = true; + +	return 0; +} +early_param("efi", parse_efi_cmdline); +  static struct kobject *efi_kobj;  static struct kobject *efivars_kobj; @@ -423,3 +445,60 @@ int __init efi_get_fdt_params(struct efi_fdt_params *params, int verbose)  	return ret;  }  #endif /* CONFIG_EFI_PARAMS_FROM_FDT */ + +static __initdata char memory_type_name[][20] = { +	"Reserved", +	"Loader Code", +	"Loader Data", +	"Boot Code", +	"Boot Data", +	"Runtime Code", +	"Runtime Data", +	"Conventional Memory", +	"Unusable Memory", +	"ACPI Reclaim Memory", +	"ACPI Memory NVS", +	"Memory Mapped I/O", +	"MMIO Port Space", +	"PAL Code" +}; + +char * __init efi_md_typeattr_format(char *buf, size_t size, +				     const efi_memory_desc_t *md) +{ +	char *pos; +	int type_len; +	u64 attr; + +	pos = buf; +	if (md->type >= ARRAY_SIZE(memory_type_name)) +		type_len = snprintf(pos, size, "[type=%u", md->type); +	else +		type_len = snprintf(pos, size, "[%-*s", +				    (int)(sizeof(memory_type_name[0]) - 1), +				    memory_type_name[md->type]); +	if (type_len >= size) +		return buf; + +	pos += type_len; +	size -= type_len; + +	attr = md->attribute; +	if (attr & ~(EFI_MEMORY_UC | EFI_MEMORY_WC | EFI_MEMORY_WT | +		     EFI_MEMORY_WB | EFI_MEMORY_UCE | EFI_MEMORY_WP | +		     EFI_MEMORY_RP | EFI_MEMORY_XP | EFI_MEMORY_RUNTIME)) +		snprintf(pos, size, "|attr=0x%016llx]", +			 (unsigned long long)attr); +	else +		snprintf(pos, size, "|%3s|%2s|%2s|%2s|%3s|%2s|%2s|%2s|%2s]", +			 attr & EFI_MEMORY_RUNTIME ? "RUN" : "", +			 attr & EFI_MEMORY_XP      ? "XP"  : "", +			 attr & EFI_MEMORY_RP      ? "RP"  : "", +			 attr & EFI_MEMORY_WP      ? "WP"  : "", +			 attr & EFI_MEMORY_UCE     ? "UCE" : "", +			 attr & EFI_MEMORY_WB      ? "WB"  : "", +			 attr & EFI_MEMORY_WT      ? "WT"  : "", +			 attr & EFI_MEMORY_WC      ? "WC"  : "", +			 attr & EFI_MEMORY_UC      ? "UC"  : ""); +	return buf; +} | 

