public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [edk2-devel] [PATCH v2] EmulatorPkg: Add EFI_STATUS return to EMU_THUNK_PROTOCOL.SetTime()
@ 2023-09-29 22:11 Nate DeSimone
  0 siblings, 0 replies; 3+ messages in thread
From: Nate DeSimone @ 2023-09-29 22:11 UTC (permalink / raw)
  To: devel; +Cc: Andrew Fish, Ray Ni, Michael D Kinney, Chasel Chiu

There is an inconsistency between the UNIX and Windows
implementations of EMU_THUNK_PROTOCOL.SetTime(). The Windows
version returns an EFI_STATUS value whereas the the UNIX
implementation is VOID. However, the UNIX implementation is an
unimplemented stub whereas the Windows version is implementated.

The current EMU_THUNK_PROTOCOL function pointer definition
specifies a VOID return type. However, EMU_THUNK_PROTOCOL.SetTime()
is close to the spec defined gRT->SetTime() except for missing the
EFI_STATUS return type.

Therefore, I conclude that the most sensible reconciliation is to
add the EFI_STATUS return type to the protocol definition.

Cc: Andrew Fish <afish@apple.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Chasel Chiu <chasel.chiu@intel.com>
Signed-off-by: Nate DeSimone <nathaniel.l.desimone@intel.com>
---
 EmulatorPkg/Include/Protocol/EmuThunk.h | 5 +++--
 EmulatorPkg/Unix/Host/EmuThunk.c        | 4 ++--
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/EmulatorPkg/Include/Protocol/EmuThunk.h b/EmulatorPkg/Include/Protocol/EmuThunk.h
index c419d0a677..bdd57f410b 100644
--- a/EmulatorPkg/Include/Protocol/EmuThunk.h
+++ b/EmulatorPkg/Include/Protocol/EmuThunk.h
@@ -2,6 +2,7 @@
   Emulator Thunk to abstract OS services from pure EFI code
 
   Copyright (c) 2008 - 2011, Apple Inc. All rights reserved.<BR>
+  Copyright (c) 2023, Intel Corporation. All rights reserved.<BR>
 
   SPDX-License-Identifier: BSD-2-Clause-Patent
 
@@ -148,12 +149,12 @@ VOID
 typedef
 VOID
 (EFIAPI *EMU_GET_TIME)(
-  OUT  EFI_TIME               *Time,
+  OUT EFI_TIME                *Time,
   OUT EFI_TIME_CAPABILITIES   *Capabilities OPTIONAL
   );
 
 typedef
-VOID
+EFI_STATUS
 (EFIAPI *EMU_SET_TIME)(
   IN   EFI_TIME               *Time
   );
diff --git a/EmulatorPkg/Unix/Host/EmuThunk.c b/EmulatorPkg/Unix/Host/EmuThunk.c
index ee0843eebf..c57c105a53 100644
--- a/EmulatorPkg/Unix/Host/EmuThunk.c
+++ b/EmulatorPkg/Unix/Host/EmuThunk.c
@@ -387,14 +387,14 @@ SecGetTime (
   }
 }
 
-VOID
+EFI_STATUS
 SecSetTime (
   IN  EFI_TIME  *Time
   )
 {
   // Don't change the time on the system
   // We could save delta to localtime() and have SecGetTime adjust return values?
-  return;
+  return EFI_UNSUPPORTED;
 }
 
 EFI_STATUS
-- 
2.39.2.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#109228): https://edk2.groups.io/g/devel/message/109228
Mute This Topic: https://groups.io/mt/101667678/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [edk2-devel] [PATCH v2] EmulatorPkg: Add EFI_STATUS return to EMU_THUNK_PROTOCOL.SetTime()
       [not found] <17897E3A091481E6.9230@groups.io>
@ 2023-12-22  3:28 ` Ni, Ray
  2024-01-05 20:57 ` Nate DeSimone
  1 sibling, 0 replies; 3+ messages in thread
From: Ni, Ray @ 2023-12-22  3:28 UTC (permalink / raw)
  To: devel@edk2.groups.io, Desimone, Nathaniel L
  Cc: Andrew Fish, Kinney, Michael D, Chiu, Chasel

Reviewed-by: Ray Ni <ray.ni@intel.com>

Thanks,
Ray
> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of
> Desimone, Nathaniel L
> Sent: Saturday, September 30, 2023 6:12 AM
> To: devel@edk2.groups.io
> Cc: Andrew Fish <afish@apple.com>; Ni, Ray <ray.ni@intel.com>; Kinney,
> Michael D <michael.d.kinney@intel.com>; Chiu, Chasel
> <chasel.chiu@intel.com>
> Subject: [edk2-devel] [PATCH v2] EmulatorPkg: Add EFI_STATUS return to
> EMU_THUNK_PROTOCOL.SetTime()
> 
> There is an inconsistency between the UNIX and Windows
> implementations of EMU_THUNK_PROTOCOL.SetTime(). The Windows
> version returns an EFI_STATUS value whereas the the UNIX
> implementation is VOID. However, the UNIX implementation is an
> unimplemented stub whereas the Windows version is implementated.
> 
> The current EMU_THUNK_PROTOCOL function pointer definition
> specifies a VOID return type. However, EMU_THUNK_PROTOCOL.SetTime()
> is close to the spec defined gRT->SetTime() except for missing the
> EFI_STATUS return type.
> 
> Therefore, I conclude that the most sensible reconciliation is to
> add the EFI_STATUS return type to the protocol definition.
> 
> Cc: Andrew Fish <afish@apple.com>
> Cc: Ray Ni <ray.ni@intel.com>
> Cc: Michael D Kinney <michael.d.kinney@intel.com>
> Cc: Chasel Chiu <chasel.chiu@intel.com>
> Signed-off-by: Nate DeSimone <nathaniel.l.desimone@intel.com>
> ---
>  EmulatorPkg/Include/Protocol/EmuThunk.h | 5 +++--
>  EmulatorPkg/Unix/Host/EmuThunk.c        | 4 ++--
>  2 files changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/EmulatorPkg/Include/Protocol/EmuThunk.h
> b/EmulatorPkg/Include/Protocol/EmuThunk.h
> index c419d0a677..bdd57f410b 100644
> --- a/EmulatorPkg/Include/Protocol/EmuThunk.h
> +++ b/EmulatorPkg/Include/Protocol/EmuThunk.h
> @@ -2,6 +2,7 @@
>    Emulator Thunk to abstract OS services from pure EFI code
> 
>    Copyright (c) 2008 - 2011, Apple Inc. All rights reserved.<BR>
> +  Copyright (c) 2023, Intel Corporation. All rights reserved.<BR>
> 
>    SPDX-License-Identifier: BSD-2-Clause-Patent
> 
> @@ -148,12 +149,12 @@ VOID
>  typedef
>  VOID
>  (EFIAPI *EMU_GET_TIME)(
> -  OUT  EFI_TIME               *Time,
> +  OUT EFI_TIME                *Time,
>    OUT EFI_TIME_CAPABILITIES   *Capabilities OPTIONAL
>    );
> 
>  typedef
> -VOID
> +EFI_STATUS
>  (EFIAPI *EMU_SET_TIME)(
>    IN   EFI_TIME               *Time
>    );
> diff --git a/EmulatorPkg/Unix/Host/EmuThunk.c
> b/EmulatorPkg/Unix/Host/EmuThunk.c
> index ee0843eebf..c57c105a53 100644
> --- a/EmulatorPkg/Unix/Host/EmuThunk.c
> +++ b/EmulatorPkg/Unix/Host/EmuThunk.c
> @@ -387,14 +387,14 @@ SecGetTime (
>    }
>  }
> 
> -VOID
> +EFI_STATUS
>  SecSetTime (
>    IN  EFI_TIME  *Time
>    )
>  {
>    // Don't change the time on the system
>    // We could save delta to localtime() and have SecGetTime adjust return
> values?
> -  return;
> +  return EFI_UNSUPPORTED;
>  }
> 
>  EFI_STATUS
> --
> 2.39.2.windows.1
> 
> 
> 
> 
> 



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#112829): https://edk2.groups.io/g/devel/message/112829
Mute This Topic: https://groups.io/mt/103312902/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/leave/12367111/7686176/1913456212/xyzzy [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [edk2-devel] [PATCH v2] EmulatorPkg: Add EFI_STATUS return to EMU_THUNK_PROTOCOL.SetTime()
       [not found] <17897E3A091481E6.9230@groups.io>
  2023-12-22  3:28 ` [edk2-devel] [PATCH v2] EmulatorPkg: Add EFI_STATUS return to EMU_THUNK_PROTOCOL.SetTime() Ni, Ray
@ 2024-01-05 20:57 ` Nate DeSimone
  1 sibling, 0 replies; 3+ messages in thread
From: Nate DeSimone @ 2024-01-05 20:57 UTC (permalink / raw)
  To: devel@edk2.groups.io, Desimone, Nathaniel L
  Cc: Andrew Fish, Ni, Ray, Kinney, Michael D, Chiu, Chasel

Pushed as 9cf1d03

> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Nate
> DeSimone
> Sent: Friday, September 29, 2023 3:12 PM
> To: devel@edk2.groups.io
> Cc: Andrew Fish <afish@apple.com>; Ni, Ray <ray.ni@intel.com>; Kinney,
> Michael D <michael.d.kinney@intel.com>; Chiu, Chasel
> <chasel.chiu@intel.com>
> Subject: [edk2-devel] [PATCH v2] EmulatorPkg: Add EFI_STATUS return to
> EMU_THUNK_PROTOCOL.SetTime()
> 
> There is an inconsistency between the UNIX and Windows implementations of
> EMU_THUNK_PROTOCOL.SetTime(). The Windows version returns an
> EFI_STATUS value whereas the the UNIX implementation is VOID. However,
> the UNIX implementation is an unimplemented stub whereas the Windows
> version is implementated.
> 
> The current EMU_THUNK_PROTOCOL function pointer definition specifies a
> VOID return type. However, EMU_THUNK_PROTOCOL.SetTime() is close to the
> spec defined gRT->SetTime() except for missing the EFI_STATUS return type.
> 
> Therefore, I conclude that the most sensible reconciliation is to add the
> EFI_STATUS return type to the protocol definition.
> 
> Cc: Andrew Fish <afish@apple.com>
> Cc: Ray Ni <ray.ni@intel.com>
> Cc: Michael D Kinney <michael.d.kinney@intel.com>
> Cc: Chasel Chiu <chasel.chiu@intel.com>
> Signed-off-by: Nate DeSimone <nathaniel.l.desimone@intel.com>
> ---
>  EmulatorPkg/Include/Protocol/EmuThunk.h | 5 +++--
>  EmulatorPkg/Unix/Host/EmuThunk.c        | 4 ++--
>  2 files changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/EmulatorPkg/Include/Protocol/EmuThunk.h
> b/EmulatorPkg/Include/Protocol/EmuThunk.h
> index c419d0a677..bdd57f410b 100644
> --- a/EmulatorPkg/Include/Protocol/EmuThunk.h
> +++ b/EmulatorPkg/Include/Protocol/EmuThunk.h
> @@ -2,6 +2,7 @@
>    Emulator Thunk to abstract OS services from pure EFI code
> 
>    Copyright (c) 2008 - 2011, Apple Inc. All rights reserved.<BR>
> +  Copyright (c) 2023, Intel Corporation. All rights reserved.<BR>
> 
>    SPDX-License-Identifier: BSD-2-Clause-Patent
> 
> @@ -148,12 +149,12 @@ VOID
>  typedef
>  VOID
>  (EFIAPI *EMU_GET_TIME)(
> -  OUT  EFI_TIME               *Time,
> +  OUT EFI_TIME                *Time,
>    OUT EFI_TIME_CAPABILITIES   *Capabilities OPTIONAL
>    );
> 
>  typedef
> -VOID
> +EFI_STATUS
>  (EFIAPI *EMU_SET_TIME)(
>    IN   EFI_TIME               *Time
>    );
> diff --git a/EmulatorPkg/Unix/Host/EmuThunk.c
> b/EmulatorPkg/Unix/Host/EmuThunk.c
> index ee0843eebf..c57c105a53 100644
> --- a/EmulatorPkg/Unix/Host/EmuThunk.c
> +++ b/EmulatorPkg/Unix/Host/EmuThunk.c
> @@ -387,14 +387,14 @@ SecGetTime (
>    }
>  }
> 
> -VOID
> +EFI_STATUS
>  SecSetTime (
>    IN  EFI_TIME  *Time
>    )
>  {
>    // Don't change the time on the system
>    // We could save delta to localtime() and have SecGetTime adjust return
> values?
> -  return;
> +  return EFI_UNSUPPORTED;
>  }
> 
>  EFI_STATUS
> --
> 2.39.2.windows.1
> 
> 
> 
> 
> 



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#113320): https://edk2.groups.io/g/devel/message/113320
Mute This Topic: https://groups.io/mt/103312902/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-01-05 20:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <17897E3A091481E6.9230@groups.io>
2023-12-22  3:28 ` [edk2-devel] [PATCH v2] EmulatorPkg: Add EFI_STATUS return to EMU_THUNK_PROTOCOL.SetTime() Ni, Ray
2024-01-05 20:57 ` Nate DeSimone
2023-09-29 22:11 Nate DeSimone

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox