mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Jan Beulich" <JBeulich@suse.com>
To: <xen-devel@lists.xensource.com>, <konrad.wilk@oracle.com>,
	<liang.tang@oracle.com>, <mjg59@srcf.ucam.org>,
	<linux-acpi@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [Xen-devel] [PATCH 1/5] EFI: Provide registration for efi_init.. etc efi public function
Date: Fri, 10 Feb 2012 16:58:29 +0000	[thread overview]
Message-ID: <4F355AC50200007800072701@nat28.tlf.novell.com> (raw)
In-Reply-To: <1328758328-24156-1-git-send-email-liang.tang@oracle.com>

>>> On 09.02.12 at 04:32, Tang Liang <liang.tang@oracle.com> wrote:
> --- a/arch/x86/platform/efi/efi.c
> +++ b/arch/x86/platform/efi/efi.c
> @@ -50,6 +50,23 @@
>  #define PFX 		"EFI: "
>  
>  int efi_enabled;
> +
> +static void efi_init_generic(void);
> +
> +static void efi_enter_virtual_mode_generic(void);
> +static u32 efi_mem_type_generic(unsigned long phys_addr);
> +static u64 efi_mem_attributes_generic(unsigned long phys_addr);
> +
> +struct efi_init_funcs efi_generic_funcs = {

static const.

> +	.__efi_init		     = efi_init_generic,
> +	.__efi_reserve_boot_services = efi_reserve_boot_services_generic,
> +	.__efi_enter_virtual_mode    = efi_enter_virtual_mode_generic,
> +	.__efi_mem_type		     = efi_mem_type_generic,
> +	.__efi_mem_attributes	     = efi_mem_attributes_generic
> +};
> +
> +struct efi_init_funcs *efi_override_funcs =  &efi_generic_funcs;

const struct ...

> +
>  EXPORT_SYMBOL(efi_enabled);
>  
>  struct efi __read_mostly efi = {
> @@ -781,3 +798,41 @@ u64 efi_mem_attributes(unsigned long phys_addr)
>  	}
>  	return 0;
>  }
> +
> +void efi_init_function_register(struct efi_init_funcs *funcs)

... (const struct ...

> +{
> +	efi_override_funcs = funcs;
> +}
> +
> +void __init efi_init(void)
> +{
> +	if (efi_override_funcs->__efi_init)
> +		efi_override_funcs->__efi_init();
> +}
> +
> +void __init efi_reserve_boot_services(void)
> +{
> +	if (efi_override_funcs->__efi_reserve_boot_services)
> +		efi_override_funcs->__efi_reserve_boot_services();
> +}
> +
> +void __init efi_enter_virtual_mode(void)
> +{
> +	if (efi_override_funcs->__efi_enter_virtual_mode)
> +		efi_override_funcs->__efi_enter_virtual_mode();
> +}
> +
> +
> +u32 efi_mem_type(unsigned long phys_addr)
> +{
> +	if (efi_override_funcs->__efi_mem_type)
> +		return efi_override_funcs->__efi_mem_type(phys_addr);
> +	return EFI_INVALID_TYPE;
> +}
> +
> +u64 efi_mem_attributes(unsigned long phys_addr)
> +{
> +	if (efi_override_funcs->__efi_mem_attributes)
> +		return efi_override_funcs->__efi_mem_attributes(phys_addr);
> +	return EFI_INVALID_ATTRIBUTE;
> +}
> --- a/include/linux/efi.h
> +++ b/include/linux/efi.h
> @@ -79,8 +79,9 @@ typedef	struct {
>  #define EFI_MEMORY_MAPPED_IO_PORT_SPACE	12
>  #define EFI_PAL_CODE			13
>  #define EFI_MAX_MEMORY_TYPE		14
> -

I would suggest to retain the newline.

> +#define EFI_INVALID_TYPE		0xffffffff
>  /* Attribute values: */
> +#define EFI_INVALID_ATTRIBUTE	((u64)0x0000000000000000ULL)	/* invalid attribute*/
>  #define EFI_MEMORY_UC		((u64)0x0000000000000001ULL)	/* uncached */
>  #define EFI_MEMORY_WC		((u64)0x0000000000000002ULL)	/* write-coalescing */
>  #define EFI_MEMORY_WT		((u64)0x0000000000000004ULL)	/* write-through */
> @@ -434,6 +435,14 @@ extern struct efi {
>  	efi_set_virtual_address_map_t *set_virtual_address_map;
>  } efi;
>  
> +struct efi_init_funcs {
> +	void (*__efi_init)(void);
> +	void (*__efi_reserve_boot_services)(void);
> +	void (*__efi_enter_virtual_mode)(void);
> +	u32 (*__efi_mem_type)(unsigned long phys_addr);
> +	u64 (*__efi_mem_attributes)(unsigned long phys_addr);

What is the reason for having the __ (or even the whole __efi_) at
their beginning?

Jan

> +};
> +
>  static inline int
>  efi_guidcmp (efi_guid_t left, efi_guid_t right)
>  {



  parent reply	other threads:[~2012-02-10 16:58 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-09  3:30 [PATCH 0/5] xen: patches for supporting efi Tang Liang
2012-02-09  3:32 ` [PATCH 1/5] EFI: Provide registration for efi_init.. etc efi public function Tang Liang
2012-02-09 16:01   ` Konrad Rzeszutek Wilk
2012-02-10 16:58   ` Jan Beulich [this message]
2012-02-09  3:32 ` [PATCH 2/5] EFI: seperate get efi table info code to single function Tang Liang
2012-02-09  3:33 ` [PATCH 3/5] EFI: add efi driver for Xen efi Tang Liang
2012-02-09 19:47   ` Matthew Garrett
2012-02-10  7:24     ` liang tang
2012-02-10 13:45       ` Matthew Garrett
2012-02-10 15:49   ` [Xen-devel] " Jan Beulich
2012-02-09  3:33 ` [PATCH 4/5] Xen efi: Add xen efi enabled detect Tang Liang
2012-02-09  3:33 ` [PATCH 5/5] Xen vga: add the xen efi video mode support Tang Liang

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=4F355AC50200007800072701@nat28.tlf.novell.com \
    --to=jbeulich@suse.com \
    --cc=konrad.wilk@oracle.com \
    --cc=liang.tang@oracle.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mjg59@srcf.ucam.org \
    --cc=xen-devel@lists.xensource.com \
    /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

all inboxes | Powered by JetHome®