public inbox for linux-efi@vger.kernel.org
 help / color / mirror / Atom feed
From: Peter Jones <pjones-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
To: Matt Fleming <matt-HNK1S37rvNbeXh+fF434Mdi2O/JbrIOy@public.gmane.org>
Cc: linux-efi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [RFC PATCH] Add esrt support.
Date: Mon, 5 Jan 2015 10:10:38 -0500	[thread overview]
Message-ID: <20150105151038.GA28206@fenchurch.internal.datastacks.com> (raw)
In-Reply-To: <20150105135113.GA3163-HNK1S37rvNbeXh+fF434Mdi2O/JbrIOy@public.gmane.org>

On Mon, Jan 05, 2015 at 01:51:13PM +0000, Matt Fleming wrote:
> On Thu, 11 Dec, at 03:22:04PM, Peter Jones wrote:
> > Add sysfs files for EFI System Resource Table under
> > /sys/firmware/efi/esrt and for each EFI System Resource Entry under
> > entries/ as a subdir.
> > 
> > v2 with suggestions from bpetkov.
> > v3 with me remembering checkpatch.
> > v4 without me typing struct decls completely wrong somehow.
> > 
> > Signed-off-by: Peter Jones <pjones-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
> > ---
> >  drivers/firmware/efi/Makefile |   2 +-
> >  drivers/firmware/efi/efi.c    |  46 ++++-
> >  drivers/firmware/efi/esrt.c   | 393 ++++++++++++++++++++++++++++++++++++++++++
> >  include/linux/efi.h           |   6 +
> >  4 files changed, 445 insertions(+), 2 deletions(-)
> >  create mode 100644 drivers/firmware/efi/esrt.c
>  
> When this patch moves out of RFC I'd ideally like to see a much more
> expansive commit message.
> 
> Why do we want this functionality, what's it going to be used for? What
> does the patch actaully do?  Where can we go looking for more
> information about ERST? You'll probably end up copying and pasting
> things from the top of erst.c, but that's fine.

Yeah, fair enough.

> 
> > @@ -220,6 +223,46 @@ err_put:
> >  
> >  subsys_initcall(efisubsys_init);
> >  
> > +/*
> > + * Given a physicall address, determine if it exists within an EFI Memory Map
> > + * entry, and if so, how much of that map exists at a higher address.  That
> > + * is, if this is the address of something in an EFI map, what's the highest
> > + * address at which it's likely to end.
> > + */
> > +u64 efi_mem_max_reasonable_size(u64 phys_addr)
> 
> Confused. I think I know what you're saying here, but I'm also doing a
> fair bit of a guesswork.
> 
> Instead, how about,
> 
> extern struct efi_memory_desc_t *efi_mem_desc_lookup(u64 phys_addr);
> 
> /*
>  * Return the end physical address of a EFI memory map region
>  */
> static inline u64 efi_mem_desc_end(struct efi_memory_desc_t *md)
> {
> 	u64 size = md->num_pages << EFI_PAGE_SHIFT;
> 
> 	return md->phys_addr + size;
> }
> 
> The caller can then do,
> 
> 	md = efi_mem_desc_lookup(phys_addr)
> 	if (!md)
> 		return -1;
> 
> 	bytes = efi_mem_desc_end(md) - phys_addr;
> 	ioremap(phys_addr, bytes);
> 
> I think leaving this "remaining bytes" logic in the ioremap() caller is
> the most robust solution because it's a quirky thing to want to do,
> whereas the other functions (efi_mem_desc_lookup() and
> efi_mem_desc_end()) are more general.
> 
> Thoughts?

I can be okay with this.

> 
> [...]
> 
> > +static inline int esrt_table_exists(void)
> > +{
> > +	if (!efi_enabled(EFI_CONFIG_TABLES))
> > +		return 0;
> > +	if (efi.esrt == EFI_INVALID_TABLE_ADDR)
> > +		return 0;
> > +	return 1;
> > +}
> 
> Minor detail: this should be using 'bool'.

Thanks.  I'll send a new patch soon.

-- 
        Peter

      parent reply	other threads:[~2015-01-05 15:10 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-25 19:28 [RFC PATCH] Add esrt support Peter Jones
     [not found] ` <1416943684-11246-1-git-send-email-pjones-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2014-12-08 18:57   ` Borislav Petkov
     [not found]     ` <20141208185720.GA11013-fF5Pk5pvG8Y@public.gmane.org>
2014-12-09 21:38       ` Peter Jones
     [not found]         ` <20141209213847.GB1159-FS9oOTXHwv9t4tGkRPVz9tcb/sdHg95EuydrBrBl+0sAvxtiuMwx3w@public.gmane.org>
2014-12-09 22:18           ` Peter Jones
     [not found]             ` <1418163514-22977-1-git-send-email-pjones-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2014-12-09 22:28               ` Peter Jones
     [not found]                 ` <1418164082-23534-1-git-send-email-pjones-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2014-12-10 10:42                   ` Parmeshwr_Prasad-DYMqY+WieiM
     [not found]                     ` <EAEC0BCD44614F499E7CCE37C3B71F113793F9A460-6n1rj5y50trWnfa2oNyE5AVY21JRvFwKV6yJEvX+wlw@public.gmane.org>
2014-12-10 14:41                       ` Peter Jones
     [not found]                         ` <20141210144148.GA24234-FS9oOTXHwv9t4tGkRPVz9tcb/sdHg95EuydrBrBl+0sAvxtiuMwx3w@public.gmane.org>
2014-12-11  9:32                           ` Parmeshwr_Prasad-DYMqY+WieiM
2014-12-11  0:19                   ` Neri, Ricardo
2014-12-11 14:08                     ` Peter Jones
2014-12-11 20:17                     ` Peter Jones
2014-12-11 20:18                     ` Peter Jones
     [not found]                       ` <1418329096-8675-1-git-send-email-pjones-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2014-12-11 20:21                         ` Peter Jones
     [not found]                           ` <20141211202119.GG17171-FS9oOTXHwv9t4tGkRPVz9tcb/sdHg95EuydrBrBl+0sAvxtiuMwx3w@public.gmane.org>
2014-12-11 20:22                             ` Peter Jones
     [not found]                               ` <1418329324-8975-1-git-send-email-pjones-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2014-12-16 12:58                                 ` Parmeshwr_Prasad-DYMqY+WieiM
2014-12-19 15:27                                 ` Borislav Petkov
2015-01-05 13:51                                 ` Matt Fleming
     [not found]                                   ` <20150105135113.GA3163-HNK1S37rvNbeXh+fF434Mdi2O/JbrIOy@public.gmane.org>
2015-01-05 15:10                                     ` Peter Jones [this message]

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=20150105151038.GA28206@fenchurch.internal.datastacks.com \
    --to=pjones-h+wxahxf7alqt0dzr+alfa@public.gmane.org \
    --cc=linux-efi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=matt-HNK1S37rvNbeXh+fF434Mdi2O/JbrIOy@public.gmane.org \
    /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