reboot.c 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. /*++
  2. Copyright (c) 2014 Minoca Corp. All Rights Reserved
  3. Module Name:
  4. reboot.c
  5. Abstract:
  6. This module implements reset support on the TI OMAP4430.
  7. Author:
  8. Evan Green 26-Mar-2014
  9. Environment:
  10. Firmware
  11. --*/
  12. //
  13. // ------------------------------------------------------------------- Includes
  14. //
  15. #include <uefifw.h>
  16. #include "../pandafw.h"
  17. //
  18. // ---------------------------------------------------------------- Definitions
  19. //
  20. #define OMAP4_PRM_DEVICE_RESET_CONTROL 0x00
  21. #define OMAP4_PRM_DEVICE_RESET_CONTROL_WARM_RESET 0x00000002
  22. //
  23. // ------------------------------------------------------ Data Type Definitions
  24. //
  25. //
  26. // ----------------------------------------------- Internal Function Prototypes
  27. //
  28. //
  29. // -------------------------------------------------------------------- Globals
  30. //
  31. VOID *EfiOmap4PrmDeviceBase =
  32. (VOID *)(OMAP4430_PRM_BASE + OMAP4430_PRM_DEVICE_OFFSET);
  33. //
  34. // ------------------------------------------------------------------ Functions
  35. //
  36. EFIAPI
  37. VOID
  38. EfipOmap4ResetSystem (
  39. EFI_RESET_TYPE ResetType,
  40. EFI_STATUS ResetStatus,
  41. UINTN DataSize,
  42. VOID *ResetData
  43. )
  44. /*++
  45. Routine Description:
  46. This routine resets the entire platform.
  47. Arguments:
  48. ResetType - Supplies the type of reset to perform.
  49. ResetStatus - Supplies the status code for this reset.
  50. DataSize - Supplies the size of the reset data.
  51. ResetData - Supplies an optional pointer for reset types of cold, warm, or
  52. shutdown to a null-terminated string, optionally followed by additional
  53. binary data.
  54. Return Value:
  55. None. This routine does not return.
  56. --*/
  57. {
  58. volatile UINT32 *ResetControl;
  59. //
  60. // Attempt to flush non-volatile variable data out to storage.
  61. //
  62. EfiCoreFlushVariableData();
  63. ResetControl = EfiOmap4PrmDeviceBase + OMAP4_PRM_DEVICE_RESET_CONTROL;
  64. *ResetControl = *ResetControl | OMAP4_PRM_DEVICE_RESET_CONTROL_WARM_RESET;
  65. while (TRUE) {
  66. if ((*ResetControl & OMAP4_PRM_DEVICE_RESET_CONTROL_WARM_RESET) != 0) {
  67. break;
  68. }
  69. }
  70. //
  71. // Execution really should not get this far.
  72. //
  73. return;
  74. }
  75. //
  76. // --------------------------------------------------------- Internal Functions
  77. //