[edk2-devel] [PATCH edk2-platforms v3 1/4] SbsaQemu: introduce macro to compare platform version

Marcin Juszkiewicz posted 4 patches 2 years, 3 months ago
There is a newer version of this series
[edk2-devel] [PATCH edk2-platforms v3 1/4] SbsaQemu: introduce macro to compare platform version
Posted by Marcin Juszkiewicz 2 years, 3 months ago
We want to check "if platver < 0.3" in an easy way.
---
 .../IndustryStandard/SbsaQemuPlatformVersion.h       | 25 ++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/Silicon/Qemu/SbsaQemu/Include/IndustryStandard/SbsaQemuPlatformVersion.h b/Silicon/Qemu/SbsaQemu/Include/IndustryStandard/SbsaQemuPlatformVersion.h
new file mode 100644
index 000000000000..dd2483787002
--- /dev/null
+++ b/Silicon/Qemu/SbsaQemu/Include/IndustryStandard/SbsaQemuPlatformVersion.h
@@ -0,0 +1,25 @@
+/** @file
+*
+*  Copyright (c) Linaro Limited. All rights reserved.
+*
+*  SPDX-License-Identifier: BSD-2-Clause-Patent
+**/
+
+#ifndef SBSAQEMUPLATFORM_VERSION_H
+#define SBSAQEMUPLATFORM_VERSION_H
+
+/*
+ * Compare PlatformVersion
+ *
+ */
+
+#define PLATFORM_VERSION_LESS_THAN(Major, Minor) (     \
+  (                                                    \
+    ( PcdGet32 (PcdPlatformVersionMajor) < Major)   || \
+    (                                                  \
+      ( PcdGet32 (PcdPlatformVersionMajor) == Major) && \
+      ( PcdGet32 (PcdPlatformVersionMinor) < Minor)    \
+    )                                                  \
+  )                                                    \
+)
+#endif

-- 
2.41.0



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#109682): https://edk2.groups.io/g/devel/message/109682
Mute This Topic: https://groups.io/mt/102017313/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-
Re: [edk2-devel] [PATCH edk2-platforms v3 1/4] SbsaQemu: introduce macro to compare platform version
Posted by Ard Biesheuvel 2 years, 3 months ago
On Tue, 17 Oct 2023 at 15:23, Marcin Juszkiewicz
<marcin.juszkiewicz@linaro.org> wrote:
>
> We want to check "if platver < 0.3" in an easy way.
> ---
>  .../IndustryStandard/SbsaQemuPlatformVersion.h       | 25 ++++++++++++++++++++
>  1 file changed, 25 insertions(+)
>
> diff --git a/Silicon/Qemu/SbsaQemu/Include/IndustryStandard/SbsaQemuPlatformVersion.h b/Silicon/Qemu/SbsaQemu/Include/IndustryStandard/SbsaQemuPlatformVersion.h
> new file mode 100644
> index 000000000000..dd2483787002
> --- /dev/null
> +++ b/Silicon/Qemu/SbsaQemu/Include/IndustryStandard/SbsaQemuPlatformVersion.h
> @@ -0,0 +1,25 @@
> +/** @file
> +*
> +*  Copyright (c) Linaro Limited. All rights reserved.
> +*
> +*  SPDX-License-Identifier: BSD-2-Clause-Patent
> +**/
> +
> +#ifndef SBSAQEMUPLATFORM_VERSION_H
> +#define SBSAQEMUPLATFORM_VERSION_H
> +
> +/*
> + * Compare PlatformVersion
> + *
> + */
> +
> +#define PLATFORM_VERSION_LESS_THAN(Major, Minor) (     \
> +  (                                                    \
> +    ( PcdGet32 (PcdPlatformVersionMajor) < Major)   || \
> +    (                                                  \
> +      ( PcdGet32 (PcdPlatformVersionMajor) == Major) && \
> +      ( PcdGet32 (PcdPlatformVersionMinor) < Minor)    \
> +    )                                                  \
> +  )                                                    \
> +)
> +#endif
>

I don't mind adding this here but it is slightly unidiomatic so I'd
like Leif's take on this too.


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#109713): https://edk2.groups.io/g/devel/message/109713
Mute This Topic: https://groups.io/mt/102017313/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-
Re: [edk2-devel] [PATCH edk2-platforms v3 1/4] SbsaQemu: introduce macro to compare platform version
Posted by Ard Biesheuvel 2 years, 3 months ago
On Wed, 18 Oct 2023 at 10:45, Ard Biesheuvel <ardb@kernel.org> wrote:
>
> On Tue, 17 Oct 2023 at 15:23, Marcin Juszkiewicz
> <marcin.juszkiewicz@linaro.org> wrote:
> >
> > We want to check "if platver < 0.3" in an easy way.
> > ---
> >  .../IndustryStandard/SbsaQemuPlatformVersion.h       | 25 ++++++++++++++++++++
> >  1 file changed, 25 insertions(+)
> >
> > diff --git a/Silicon/Qemu/SbsaQemu/Include/IndustryStandard/SbsaQemuPlatformVersion.h b/Silicon/Qemu/SbsaQemu/Include/IndustryStandard/SbsaQemuPlatformVersion.h
> > new file mode 100644
> > index 000000000000..dd2483787002
> > --- /dev/null
> > +++ b/Silicon/Qemu/SbsaQemu/Include/IndustryStandard/SbsaQemuPlatformVersion.h
> > @@ -0,0 +1,25 @@
> > +/** @file
> > +*
> > +*  Copyright (c) Linaro Limited. All rights reserved.
> > +*
> > +*  SPDX-License-Identifier: BSD-2-Clause-Patent
> > +**/
> > +
> > +#ifndef SBSAQEMUPLATFORM_VERSION_H
> > +#define SBSAQEMUPLATFORM_VERSION_H
> > +
> > +/*
> > + * Compare PlatformVersion
> > + *
> > + */
> > +
> > +#define PLATFORM_VERSION_LESS_THAN(Major, Minor) (     \
> > +  (                                                    \
> > +    ( PcdGet32 (PcdPlatformVersionMajor) < Major)   || \
> > +    (                                                  \
> > +      ( PcdGet32 (PcdPlatformVersionMajor) == Major) && \
> > +      ( PcdGet32 (PcdPlatformVersionMinor) < Minor)    \
> > +    )                                                  \
> > +  )                                                    \
> > +)
> > +#endif
> >
>
> I don't mind adding this here but it is slightly unidiomatic so I'd
> like Leif's take on this too.

... and it also lacks a s-o-b line


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#109714): https://edk2.groups.io/g/devel/message/109714
Mute This Topic: https://groups.io/mt/102017313/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-
Re: [edk2-devel] [PATCH edk2-platforms v3 1/4] SbsaQemu: introduce macro to compare platform version
Posted by Marcin Juszkiewicz 2 years, 3 months ago
W dniu 18.10.2023 o 10:46, Ard Biesheuvel pisze:
>> I don't mind adding this here but it is slightly unidiomatic so I'd
>> like Leif's take on this too.
> ... and it also lacks a s-o-b line

Oops. Added in local copy.


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#109725): https://edk2.groups.io/g/devel/message/109725
Mute This Topic: https://groups.io/mt/102017313/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-