All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tim Gardner <rtg.canonical-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: Matt Fleming <matt-HNK1S37rvNbeXh+fF434Mdi2O/JbrIOy@public.gmane.org>
Cc: Steve Langasek
	<steve.langasek-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org>,
	Matthew Garrett <mjg59-1xO5oi07KQx4cg9Nei1l7Q@public.gmane.org>,
	linux-efi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	"H. Peter Anvin" <hpa-YMNOUZJC4hwAvxtiuMwx3w@public.gmane.org>,
	Olof Johansson <olof-nZhT3qVonbNeoWH0uzbU5w@public.gmane.org>,
	Tony Luck <tony.luck-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
	David Airlie <airlied-cv59FeDIM0c@public.gmane.org>,
	Corentin Chary
	<corentincj-EjuBZuxMvz2sTnJN9+BGXg@public.gmane.org>,
	Dave Jiang <dave.jiang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
	Peter Jones <pjones-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>,
	Konrad Rzeszutek Wilk
	<konrad-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	"Rafael J. Wysocki" <rjw-KKrjLPT3xs0@public.gmane.org>,
	tim.gardner-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org
Subject: Re: [RFC PATCH 1/2] efi: Make 'efi_enabled' a function to query EFI facilities
Date: Fri, 04 Jan 2013 09:42:54 -0700	[thread overview]
Message-ID: <50E7068E.8080101@gmail.com> (raw)
In-Reply-To: <1357316128.8203.33.camel-ZqTwcBeJ+wsBof6jY8KHXm7IUlhRatedral2JQCrhuEAvxtiuMwx3w@public.gmane.org>

On 01/04/2013 09:15 AM, Matt Fleming wrote:
> On Fri, 2013-01-04 at 08:08 -0700, Tim Gardner wrote:
>> On 01/03/2013 06:18 AM, Matt Fleming wrote:
>>> From: Matt Fleming <matt.fleming-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
>>>
>>
>> snip
>>
>>>   /*
>>> - * We play games with efi_enabled so that the compiler will, if possible, remove
>>> - * EFI-related code altogether.
>>> + * We play games with efi_enabled so that the compiler will, if
>>> + * possible, remove EFI-related code altogether.
>>>    */
>>> +#define EFI_BOOT		0x00000001 /* Were we booted from EFI? */
>>> +#define EFI_SYSTEM_TABLES	0x00000002 /* Can we use EFI system tables? */
>>> +#define EFI_CONFIG_TABLES	0x00000004 /* Can we use EFI config tables? */
>>> +#define EFI_RUNTIME_SERVICES	0x00000004 /* Can we use runtime services? */
>>> +#define EFI_MEMMAP		0x00000008 /* Can we use EFI memory map? */
>>> +#define EFI_64BIT		0x00000010 /* Is the firmware 64-bit? */
>>> +
>>
>> Your use of test_bit() and set_bit() imply that these macros should be
>> bit numbers, not bit masks. It'll work until you define a mask with an
>> integer value greater then 31.
>
> They're not intended to be bitmasks in the sense that no two bits are
> set in each constant (and I am aware of the upper limit).
>
> I have no problem changing the above values to bit numbers if that would
> be less confusing.
>

When you do change them to bit numbers you should also note that 
EFI_CONFIG_TABLES and EFI_RUNTIME_SERVICES have the same value, which I 
believe is in error.

rtg
-- 
Tim Gardner tim.gardner-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org

WARNING: multiple messages have this Message-ID (diff)
From: Tim Gardner <rtg.canonical@gmail.com>
To: Matt Fleming <matt@console-pimps.org>
Cc: Steve Langasek <steve.langasek@canonical.com>,
	Matthew Garrett <mjg59@srcf.ucam.org>,
	linux-efi@vger.kernel.org, linux-kernel@vger.kernel.org,
	"H. Peter Anvin" <hpa@zytor.com>, Olof Johansson <olof@lixom.net>,
	Tony Luck <tony.luck@intel.com>, David Airlie <airlied@linux.ie>,
	Corentin Chary <corentincj@iksaif.net>,
	Dave Jiang <dave.jiang@intel.com>,
	Peter Jones <pjones@redhat.com>,
	Konrad Rzeszutek Wilk <konrad@kernel.org>,
	"Rafael J. Wysocki" <rjw@sisk.pl>,
	tim.gardner@canonical.com
Subject: Re: [RFC PATCH 1/2] efi: Make 'efi_enabled' a function to query EFI facilities
Date: Fri, 04 Jan 2013 09:42:54 -0700	[thread overview]
Message-ID: <50E7068E.8080101@gmail.com> (raw)
In-Reply-To: <1357316128.8203.33.camel@mfleming-mobl1.ger.corp.intel.com>

On 01/04/2013 09:15 AM, Matt Fleming wrote:
> On Fri, 2013-01-04 at 08:08 -0700, Tim Gardner wrote:
>> On 01/03/2013 06:18 AM, Matt Fleming wrote:
>>> From: Matt Fleming <matt.fleming@intel.com>
>>>
>>
>> snip
>>
>>>   /*
>>> - * We play games with efi_enabled so that the compiler will, if possible, remove
>>> - * EFI-related code altogether.
>>> + * We play games with efi_enabled so that the compiler will, if
>>> + * possible, remove EFI-related code altogether.
>>>    */
>>> +#define EFI_BOOT		0x00000001 /* Were we booted from EFI? */
>>> +#define EFI_SYSTEM_TABLES	0x00000002 /* Can we use EFI system tables? */
>>> +#define EFI_CONFIG_TABLES	0x00000004 /* Can we use EFI config tables? */
>>> +#define EFI_RUNTIME_SERVICES	0x00000004 /* Can we use runtime services? */
>>> +#define EFI_MEMMAP		0x00000008 /* Can we use EFI memory map? */
>>> +#define EFI_64BIT		0x00000010 /* Is the firmware 64-bit? */
>>> +
>>
>> Your use of test_bit() and set_bit() imply that these macros should be
>> bit numbers, not bit masks. It'll work until you define a mask with an
>> integer value greater then 31.
>
> They're not intended to be bitmasks in the sense that no two bits are
> set in each constant (and I am aware of the upper limit).
>
> I have no problem changing the above values to bit numbers if that would
> be less confusing.
>

When you do change them to bit numbers you should also note that 
EFI_CONFIG_TABLES and EFI_RUNTIME_SERVICES have the same value, which I 
believe is in error.

rtg
-- 
Tim Gardner tim.gardner@canonical.com

  parent reply	other threads:[~2013-01-04 16:42 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-03 13:18 [RFC PATCH 0/2] EFI facilities bitfield Matt Fleming
2013-01-03 13:18 ` Matt Fleming
2013-01-03 13:18 ` [RFC PATCH 1/2] efi: Make 'efi_enabled' a function to query EFI facilities Matt Fleming
     [not found]   ` <1357219085-4312-2-git-send-email-matt-HNK1S37rvNbeXh+fF434Mdi2O/JbrIOy@public.gmane.org>
2013-01-03 17:41     ` H. Peter Anvin
2013-01-03 17:41       ` H. Peter Anvin
2013-01-04 15:08   ` Tim Gardner
     [not found]     ` <50E6F086.5020209-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2013-01-04 16:15       ` Matt Fleming
2013-01-04 16:15         ` Matt Fleming
     [not found]         ` <1357316128.8203.33.camel-ZqTwcBeJ+wsBof6jY8KHXm7IUlhRatedral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2013-01-04 16:17           ` H. Peter Anvin
2013-01-04 16:17             ` H. Peter Anvin
2013-01-04 16:42           ` Tim Gardner [this message]
2013-01-04 16:42             ` Tim Gardner
2013-01-03 13:18 ` [RFC PATCH 2/2] samsung-laptop: Disable on EFI hardware Matt Fleming

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=50E7068E.8080101@gmail.com \
    --to=rtg.canonical-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=airlied-cv59FeDIM0c@public.gmane.org \
    --cc=corentincj-EjuBZuxMvz2sTnJN9+BGXg@public.gmane.org \
    --cc=dave.jiang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    --cc=hpa-YMNOUZJC4hwAvxtiuMwx3w@public.gmane.org \
    --cc=konrad-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=linux-efi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=matt-HNK1S37rvNbeXh+fF434Mdi2O/JbrIOy@public.gmane.org \
    --cc=mjg59-1xO5oi07KQx4cg9Nei1l7Q@public.gmane.org \
    --cc=olof-nZhT3qVonbNeoWH0uzbU5w@public.gmane.org \
    --cc=pjones-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=rjw-KKrjLPT3xs0@public.gmane.org \
    --cc=steve.langasek-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org \
    --cc=tim.gardner-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org \
    --cc=tony.luck-ral2JQCrhuEAvxtiuMwx3w@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.