public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Pedro Falcato" <pedro.falcato@gmail.com>
To: devel@edk2.groups.io, rebecca@bsdio.com
Cc: Chasel Chiu <chasel.chiu@intel.com>,
	Nate DeSimone <nathaniel.l.desimone@intel.com>,
	 Sai Chaganty <rangasai.v.chaganty@intel.com>,
	Isaac Oram <isaac.w.oram@intel.com>
Subject: Re: [edk2-devel] [PATCH edk2-platforms 1/2] Platform/Intel/WhiskeylakeOpenBoardPkg: Fix ALIGN16 macro
Date: Mon, 15 May 2023 14:22:36 +0100	[thread overview]
Message-ID: <CAKbZUD39iaf=4iGgrTEz3yDEQXkd_MHT+uz=t-pYfg_CVeeOvQ@mail.gmail.com> (raw)
In-Reply-To: <20230515054329.3224434-2-rebecca@bsdio.com>

On Mon, May 15, 2023 at 6:43 AM Rebecca Cran <rebecca@bsdio.com> wrote:
>
> The IS_ALIGNED macro defined in PlatformBoardConfig.h conflicts with the
> definition from MdePkg/Include/Base.h. Delete it, and switch to
> ADDRESS_IS_ALIGNED.
>
> Signed-off-by: Rebecca Cran <rebecca@bsdio.com>
> ---
>  Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Include/PlatformBoardConfig.h | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Include/PlatformBoardConfig.h b/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Include/PlatformBoardConfig.h
> index 44b4059f8ebf..4872a0afc65a 100644
> --- a/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Include/PlatformBoardConfig.h
> +++ b/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Include/PlatformBoardConfig.h
> @@ -15,8 +15,7 @@
>  #include <GpioConfig.h>
>  #include <TbtBoardInfo.h>
>
> -#define IS_ALIGNED(addr, size) (((addr) & (size - 1)) ? 0 : 1)
> -#define ALIGN16(size)          (IS_ALIGNED(size, 16) ? size : ((size + 16) & 0xFFF0))
> +#define ALIGN16(size)          (ADDRESS_IS_ALIGNED(size, 16) ? size : ((size + 16) & 0xFFF0))

As I mentioned on Discord, ALIGN16 should not need a branch like this.
I propose switching ALIGN16 to use ALIGN_VALUE, or if you need compat
with older edk2s, even:

#define ALIGN16(size)         (((size) + 15) & -16)

Which is a common enough pattern that it hopefully is self-explanatory.

-- 
Pedro

  reply	other threads:[~2023-05-15 13:22 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-15  5:43 [PATCH edk2-platforms 0/2] Platform/Intel/WhiskeylakeOpenBoardPkg: Fix UpXtreme build Rebecca Cran
2023-05-15  5:43 ` [PATCH edk2-platforms 1/2] Platform/Intel/WhiskeylakeOpenBoardPkg: Fix ALIGN16 macro Rebecca Cran
2023-05-15 13:22   ` Pedro Falcato [this message]
2023-05-15 14:00     ` [edk2-devel] " Rebecca Cran
2023-05-15  5:43 ` [PATCH edk2-platforms 2/2] Platform/Intel/WhiskeylakeOpenBoardPkg: Delete unused include files Rebecca Cran

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-list 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='CAKbZUD39iaf=4iGgrTEz3yDEQXkd_MHT+uz=t-pYfg_CVeeOvQ@mail.gmail.com' \
    --to=devel@edk2.groups.io \
    /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