]> git.proxmox.com Git - mirror_edk2.git/blobdiff - DuetPkg/KbcResetDxe/Ipf/IpfReset.c
Porting Duet module from EDKI to EDKII
[mirror_edk2.git] / DuetPkg / KbcResetDxe / Ipf / IpfReset.c
diff --git a/DuetPkg/KbcResetDxe/Ipf/IpfReset.c b/DuetPkg/KbcResetDxe/Ipf/IpfReset.c
new file mode 100644 (file)
index 0000000..028fd13
--- /dev/null
@@ -0,0 +1,117 @@
+/*++\r
+\r
+Copyright (c) 2006, Intel Corporation                                                         \r
+All rights reserved. This program and the accompanying materials                          \r
+are licensed and made available under the terms and conditions of the BSD License         \r
+which accompanies this distribution.  The full text of the license may be found at        \r
+http://opensource.org/licenses/bsd-license.php                                            \r
+                                                                                          \r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
+\r
+Module Name:\r
+  IpfReset.c\r
+\r
+Abstract:\r
+\r
+--*/\r
+\r
+#include "Cf9Reset.h"\r
+\r
+SAL_RETURN_REGS\r
+ResetEsalServicesClassCommonEntry (\r
+  IN  UINT64                     FunctionId,\r
+  IN  UINT64                     Arg2,\r
+  IN  UINT64                     Arg3,\r
+  IN  UINT64                     Arg4,\r
+  IN  UINT64                     Arg5,\r
+  IN  UINT64                     Arg6,\r
+  IN  UINT64                     Arg7,\r
+  IN  UINT64                     Arg8,\r
+  IN  SAL_EXTENDED_SAL_PROC      ExtendedSalProc,\r
+  IN   BOOLEAN                   VirtualMode,\r
+  IN  VOID                       *Global\r
+  )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+  Main entry for Extended SAL Reset Services\r
+\r
+Arguments:\r
+\r
+  FunctionId    Function Id which needed to be called.\r
+  Arg2          EFI_RESET_TYPE, whether WARM of COLD reset\r
+  Arg3          Last EFI_STATUS \r
+  Arg4          Data Size of UNICODE STRING passed in ARG5\r
+  Arg5          Unicode String which CHAR16*\r
+\r
+Returns:\r
+\r
+  SAL_RETURN_REGS\r
+\r
+--*/\r
+// TODO:    Arg6 - add argument and description to function comment\r
+// TODO:    Arg7 - add argument and description to function comment\r
+// TODO:    Arg8 - add argument and description to function comment\r
+// TODO:    ExtendedSalProc - add argument and description to function comment\r
+// TODO:    VirtualMode - add argument and description to function comment\r
+// TODO:    Global - add argument and description to function comment\r
+{\r
+  SAL_RETURN_REGS ReturnVal;\r
+\r
+  switch (FunctionId) {\r
+  case ResetSystem:\r
+    KbcResetSystem (Arg2, Arg3, (UINTN) Arg4, (VOID *) Arg5);\r
+    ReturnVal.Status = EFI_SUCCESS;\r
+    break;\r
+\r
+  default:\r
+    ReturnVal.Status = EFI_SAL_INVALID_ARGUMENT;\r
+    break;\r
+  }\r
+\r
+  return ReturnVal;\r
+}\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+InitializeReset (\r
+  IN EFI_HANDLE        ImageHandle,\r
+  IN EFI_SYSTEM_TABLE  *SystemTable\r
+  )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+  Initialize the state information for the Reset Architectural Protocol\r
+\r
+Arguments:\r
+\r
+  ImageHandle of the loaded driver\r
+  Pointer to the System Table\r
+\r
+Returns:\r
+\r
+  Status\r
+\r
+  EFI_SUCCESS           - thread can be successfully created\r
+  EFI_OUT_OF_RESOURCES  - cannot allocate protocol data structure\r
+  EFI_DEVICE_ERROR      - cannot create the timer service\r
+\r
+--*/\r
+// TODO:    SystemTable - add argument and description to function comment\r
+{\r
+  EfiInitializeRuntimeDriverLib (ImageHandle, SystemTable, NULL);\r
+\r
+  RegisterEsalClass (\r
+    &gEfiExtendedSalResetServicesProtocolGuid,\r
+    NULL,\r
+    ResetEsalServicesClassCommonEntry,\r
+    ResetSystem,\r
+    NULL\r
+    );\r
+\r
+  return EFI_SUCCESS;\r
+}\r
+\r