public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Zhichao Gao <zhichao.gao@intel.com>
To: edk2-devel@lists.01.org
Cc: Ray Ni <ray.ni@intel.com>, Liming Gao <liming.gao@intel.com>
Subject: [PATCH] MdeModulePkg[MdePkg]: Add a new API EfiResetSystem()
Date: Mon, 18 Feb 2019 11:16:36 +0800	[thread overview]
Message-ID: <20190218031636.13600-1-zhichao.gao@intel.com> (raw)

BZ:https://bugzilla.tianocore.org/show_bug.cgi?id=1460
Add a new API EfiReesetSystem():
VOID
EFIAPI
EfiResetSystem (
  IN EFI_RESET_TYPE               ResetType,
  IN EFI_STATUS                   ResetStatus,
  IN UINTN                        DataSize,
  IN VOID                         *ResetData OPTIONAL
  )
The Consumer of ResetSystemLib can use this new API to reset
system with additional reset data.
Because RuntimeLib has the same API name, change RuntimeLib
API's name from EfiResetSystem to EfiRuntimeResetSystem. And
change the related callings such as CapsuleRuntimeDxe.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Zhichao Gao <zhichao.gao@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
---
 MdeModulePkg/Include/Library/ResetSystemLib.h      | 25 ++++++++++++++++++-
 .../Library/DxeResetSystemLib/DxeResetSystemLib.c  | 28 +++++++++++++++++++++-
 .../Library/PeiResetSystemLib/PeiResetSystemLib.c  | 28 +++++++++++++++++++++-
 .../Universal/CapsuleRuntimeDxe/CapsuleService.c   |  4 ++--
 MdePkg/Include/Library/UefiRuntimeLib.h            |  6 ++---
 MdePkg/Library/UefiRuntimeLib/RuntimeLib.c         |  6 ++---
 6 files changed, 86 insertions(+), 11 deletions(-)

diff --git a/MdeModulePkg/Include/Library/ResetSystemLib.h b/MdeModulePkg/Include/Library/ResetSystemLib.h
index 55d1923ae1..c2aebd1c3a 100644
--- a/MdeModulePkg/Include/Library/ResetSystemLib.h
+++ b/MdeModulePkg/Include/Library/ResetSystemLib.h
@@ -2,7 +2,7 @@
   System reset Library Services.  This library class defines a set of
   methods that reset the whole system.
 
-Copyright (c) 2005 - 2018, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2005 - 2019, Intel Corporation. All rights reserved.<BR>
 This program and the accompanying materials are licensed and made available under
 the terms and conditions of the BSD License that accompanies this distribution.
 The full text of the license may be found at
@@ -83,4 +83,27 @@ ResetPlatformSpecific (
   IN VOID    *ResetData
   );
 
+/**
+  The EfiResetSystem function resets the entire platform.
+
+  @param[in] ResetType      The type of reset to perform.
+  @param[in] ResetStatus    The status code for the reset.
+  @param[in] DataSize       The size, in bytes, of ResetData.
+  @param[in] ResetData      For a ResetType of EfiResetCold, EfiResetWarm, or EfiResetShutdown
+                            the data buffer starts with a Null-terminated string, optionally
+                            followed by additional binary data. The string is a description
+                            that the caller may use to further indicate the reason for the
+                            system reset. ResetData is only valid if ResetStatus is something
+                            other than EFI_SUCCESS unless the ResetType is EfiResetPlatformSpecific
+                            where a minimum amount of ResetData is always required.
+**/
+VOID
+EFIAPI
+EfiResetSystem (
+  IN EFI_RESET_TYPE               ResetType,
+  IN EFI_STATUS                   ResetStatus,
+  IN UINTN                        DataSize,
+  IN VOID                         *ResetData OPTIONAL
+  );
+
 #endif
diff --git a/MdeModulePkg/Library/DxeResetSystemLib/DxeResetSystemLib.c b/MdeModulePkg/Library/DxeResetSystemLib/DxeResetSystemLib.c
index ea4878cab1..71c05e47dc 100644
--- a/MdeModulePkg/Library/DxeResetSystemLib/DxeResetSystemLib.c
+++ b/MdeModulePkg/Library/DxeResetSystemLib/DxeResetSystemLib.c
@@ -1,7 +1,7 @@
 /** @file
   DXE Reset System Library instance that calls gRT->ResetSystem().
 
-  Copyright (c) 2017 - 2018, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2017 - 2019, Intel Corporation. All rights reserved.<BR>
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD License
   which accompanies this distribution.  The full text of the license may be found at
@@ -96,3 +96,29 @@ ResetPlatformSpecific (
 {
   gRT->ResetSystem (EfiResetPlatformSpecific, EFI_SUCCESS, DataSize, ResetData);
 }
+
+/**
+  The EfiResetSystem function resets the entire platform.
+
+  @param[in] ResetType      The type of reset to perform.
+  @param[in] ResetStatus    The status code for the reset.
+  @param[in] DataSize       The size, in bytes, of ResetData.
+  @param[in] ResetData      For a ResetType of EfiResetCold, EfiResetWarm, or EfiResetShutdown
+                            the data buffer starts with a Null-terminated string, optionally
+                            followed by additional binary data. The string is a description
+                            that the caller may use to further indicate the reason for the
+                            system reset. ResetData is only valid if ResetStatus is something
+                            other than EFI_SUCCESS unless the ResetType is EfiResetPlatformSpecific
+                            where a minimum amount of ResetData is always required.
+**/
+VOID
+EFIAPI
+EfiResetSystem (
+  IN EFI_RESET_TYPE               ResetType,
+  IN EFI_STATUS                   ResetStatus,
+  IN UINTN                        DataSize,
+  IN VOID                         *ResetData OPTIONAL
+  )
+{
+  gRT->ResetSystem (ResetType, ResetStatus, DataSize, ResetData);
+}
diff --git a/MdeModulePkg/Library/PeiResetSystemLib/PeiResetSystemLib.c b/MdeModulePkg/Library/PeiResetSystemLib/PeiResetSystemLib.c
index d8219775d1..8dd28af3ce 100644
--- a/MdeModulePkg/Library/PeiResetSystemLib/PeiResetSystemLib.c
+++ b/MdeModulePkg/Library/PeiResetSystemLib/PeiResetSystemLib.c
@@ -1,7 +1,7 @@
 /** @file
   PEI Reset System Library instance that calls the ResetSystem2() PEI Service.
 
-  Copyright (c) 2017 - 2018, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2017 - 2019, Intel Corporation. All rights reserved.<BR>
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD License
   which accompanies this distribution.  The full text of the license may be found at
@@ -96,3 +96,29 @@ ResetPlatformSpecific (
 {
   PeiServicesResetSystem2 (EfiResetPlatformSpecific, EFI_SUCCESS, DataSize, ResetData);
 }
+
+/**
+  The EfiResetSystem function resets the entire platform.
+
+  @param[in] ResetType      The type of reset to perform.
+  @param[in] ResetStatus    The status code for the reset.
+  @param[in] DataSize       The size, in bytes, of ResetData.
+  @param[in] ResetData      For a ResetType of EfiResetCold, EfiResetWarm, or EfiResetShutdown
+                            the data buffer starts with a Null-terminated string, optionally
+                            followed by additional binary data. The string is a description
+                            that the caller may use to further indicate the reason for the
+                            system reset. ResetData is only valid if ResetStatus is something
+                            other than EFI_SUCCESS unless the ResetType is EfiResetPlatformSpecific
+                            where a minimum amount of ResetData is always required.
+**/
+VOID
+EFIAPI
+EfiResetSystem (
+  IN EFI_RESET_TYPE               ResetType,
+  IN EFI_STATUS                   ResetStatus,
+  IN UINTN                        DataSize,
+  IN VOID                         *ResetData OPTIONAL
+  )
+{
+  PeiServicesResetSystem2 (ResetType, ResetStatus, DataSize, ResetData);
+}
diff --git a/MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleService.c b/MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleService.c
index 9e5fc9f83b..10302a7e46 100644
--- a/MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleService.c
+++ b/MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleService.c
@@ -4,7 +4,7 @@
   It installs the Capsule Architectural Protocol defined in PI1.0a to signify
   the capsule runtime services are ready.
 
-Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.<BR>
 This program and the accompanying materials
 are licensed and made available under the terms and conditions of the BSD License
 which accompanies this distribution.  The full text of the license may be found at
@@ -216,7 +216,7 @@ UpdateCapsule (
        // will initiate a reset of the platform which is compatible with the passed-in capsule request and will
        // not return back to the caller.
        //
-       EfiResetSystem (EfiResetWarm, EFI_SUCCESS, 0, NULL);
+       EfiRuntimeResetSystem (EfiResetWarm, EFI_SUCCESS, 0, NULL);
      }
   }
   return Status;
diff --git a/MdePkg/Include/Library/UefiRuntimeLib.h b/MdePkg/Include/Library/UefiRuntimeLib.h
index 888410921b..8c1bf98b45 100644
--- a/MdePkg/Include/Library/UefiRuntimeLib.h
+++ b/MdePkg/Include/Library/UefiRuntimeLib.h
@@ -2,7 +2,7 @@
   Provides library functions for each of the UEFI Runtime Services.
   Only available to DXE and UEFI module types.
 
-Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.<BR>
 This program and the accompanying materials are licensed and made available under
 the terms and conditions of the BSD License that accompanies this distribution.
 The full text of the license may be found at
@@ -307,7 +307,7 @@ EfiGetNextHighMonotonicCount (
 /**
   This service is a wrapper for the UEFI Runtime Service ResetSystem().
 
-  The ResetSystem()function resets the entire platform, including all processors and devices,and reboots the system.
+  The EfiRuntimeResetSystem() function resets the entire platform, including all processors and devices,and reboots the system.
   Calling this interface with ResetType of EfiResetCold causes a system-wide reset. This sets all circuitry within
   the system to its initial state. This type of reset is asynchronous to system operation and operates without regard
   to cycle boundaries. EfiResetCold is tantamount to a system power cycle.
@@ -334,7 +334,7 @@ EfiGetNextHighMonotonicCount (
 **/
 VOID
 EFIAPI
-EfiResetSystem (
+EfiRuntimeResetSystem (
   IN EFI_RESET_TYPE               ResetType,
   IN EFI_STATUS                   ResetStatus,
   IN UINTN                        DataSize,
diff --git a/MdePkg/Library/UefiRuntimeLib/RuntimeLib.c b/MdePkg/Library/UefiRuntimeLib/RuntimeLib.c
index 86c7027655..35bfd0d7f1 100644
--- a/MdePkg/Library/UefiRuntimeLib/RuntimeLib.c
+++ b/MdePkg/Library/UefiRuntimeLib/RuntimeLib.c
@@ -6,7 +6,7 @@
   OS virtual address space. All pointer values are different for a virtual
   mapping than from the normal physical mapping at boot services time.
 
-Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.<BR>
 This program and the accompanying materials
 are licensed and made available under the terms and conditions of the BSD License
 which accompanies this distribution.  The full text of the license may be found at
@@ -204,7 +204,7 @@ EfiGoneVirtual (
 /**
   This service is a wrapper for the UEFI Runtime Service ResetSystem().
 
-  The ResetSystem()function resets the entire platform, including all processors and devices,and reboots the system.
+  The EfiRuntimeResetSystem() function resets the entire platform, including all processors and devices,and reboots the system.
   Calling this interface with ResetType of EfiResetCold causes a system-wide reset. This sets all circuitry within
   the system to its initial state. This type of reset is asynchronous to system operation and operates without regard
   to cycle boundaries. EfiResetCold is tantamount to a system power cycle.
@@ -232,7 +232,7 @@ EfiGoneVirtual (
 **/
 VOID
 EFIAPI
-EfiResetSystem (
+EfiRuntimeResetSystem (
   IN EFI_RESET_TYPE               ResetType,
   IN EFI_STATUS                   ResetStatus,
   IN UINTN                        DataSize,
-- 
2.16.2.windows.1



             reply	other threads:[~2019-02-18  3:17 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-18  3:16 Zhichao Gao [this message]
2019-02-18  5:28 ` [PATCH] MdeModulePkg[MdePkg]: Add a new API EfiResetSystem() Gao, Liming

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=20190218031636.13600-1-zhichao.gao@intel.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