[PATCH v5 08/14] efi: export efi runtime memory mapping to sysfs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 12/13/13 at 12:30pm, Matt Fleming wrote:
> I agree with Borislav that this should be invoked from efisubsys_init().
> Also Dave, there's nothing inherently x86-specific about runtime-map.c -
> we've been trying not to dump arch-specific code in
> drivers/firmware/efi/.
> 
> How about something like this, just to give you an idea? This would
> allow the ARM/ia64 folks to enable this code if they want at some later
> date. But more than that, it makes the code more self-contained and uses
> some real interfaces instead of relying on global variables,
> 
> (not compile tested)
> 
> ---
> 
> diff --git a/arch/x86/platform/efi/efi.c b/arch/x86/platform/efi/efi.c
> index 94a1cbcf6e2e..f45ea41deae0 100644
> --- a/arch/x86/platform/efi/efi.c
> +++ b/arch/x86/platform/efi/efi.c
> @@ -76,8 +76,8 @@ static __initdata efi_config_table_type_t arch_tables[] = {
>  	{NULL_GUID, NULL, NULL},
>  };
>  
> -void *efi_runtime_map;
> -int nr_efi_runtime_map;
> +static void *efi_runtime_map;
> +static int nr_efi_runtime_map;
>  static u64 efi_setup; /* efi setup_data physical address */
>  
>  /*
> @@ -1084,6 +1084,9 @@ void __init efi_enter_virtual_mode(void)
>  		}
>  	}
>  
> +	efi_runtime_map_setup(efi_runtime_map, nr_efi_runtime_map,
> +			      boot_params.efi_info.efi_memdesc_size);
> +
>  	BUG_ON(!efi.systab);

After this change, nr_efi_runtime_map become static, but since I'm moving
the parse_efi_setup to efi_64.c and nr_efi_runtime_map is set there for
kexec kernel use..

So I will just save the setup_data paddr as efi_setup in efi_64.c, and
move other code from parse_efi_setup() to below function which is called
in efi_init();

+static void __init efi_setup_init(void)
+{
+	struct setup_data *sd;
+
+	if (!efi_setup)
+		return;
+
+	sd = early_memremap(efi_setup, sizeof(struct setup_data));
+	if (!sd) {
+		pr_warn("early_memremap setup_data failed\n");
+		efi_setup = 0;
+		return;
+	}
+	efi_setup += sizeof(struct setup_data);
+	nr_efi_runtime_map = (sd->len - sizeof(struct efi_setup_data)) /
+			     sizeof(efi_memory_desc_t);
+	early_memunmap(sd, sizeof(struct setup_data));
+}



[Index of Archives]     [LM Sensors]     [Linux Sound]     [ALSA Users]     [ALSA Devel]     [Linux Audio Users]     [Linux Media]     [Kernel]     [Gimp]     [Yosemite News]     [Linux Media]

  Powered by Linux