1
0

reboot.c 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  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 <minoca/soc/am335x.h>
  17. #include "../bbonefw.h"
  18. //
  19. // ---------------------------------------------------------------- Definitions
  20. //
  21. //
  22. // ------------------------------------------------------ Data Type Definitions
  23. //
  24. //
  25. // ----------------------------------------------- Internal Function Prototypes
  26. //
  27. //
  28. // -------------------------------------------------------------------- Globals
  29. //
  30. //
  31. // Define the base of the AM335 PRM Device registers.
  32. //
  33. VOID *EfiAm335PrmDeviceBase = (VOID *)AM335_PRM_DEVICE_REGISTERS;
  34. //
  35. // ------------------------------------------------------------------ Functions
  36. //
  37. EFIAPI
  38. VOID
  39. EfipAm335ResetSystem (
  40. EFI_RESET_TYPE ResetType,
  41. EFI_STATUS ResetStatus,
  42. UINTN DataSize,
  43. VOID *ResetData
  44. )
  45. /*++
  46. Routine Description:
  47. This routine resets the entire platform.
  48. Arguments:
  49. ResetType - Supplies the type of reset to perform.
  50. ResetStatus - Supplies the status code for this reset.
  51. DataSize - Supplies the size of the reset data.
  52. ResetData - Supplies an optional pointer for reset types of cold, warm, or
  53. shutdown to a null-terminated string, optionally followed by additional
  54. binary data.
  55. Return Value:
  56. None. This routine does not return.
  57. --*/
  58. {
  59. volatile UINT32 *ResetControl;
  60. UINT32 ResetFlag;
  61. //
  62. // Attempt to flush non-volatile variable data out to storage.
  63. //
  64. EfiCoreFlushVariableData();
  65. ResetControl = EfiAm335PrmDeviceBase + AM335_PRM_DEVICE_RESET_CONTROL;
  66. if (ResetType == EfiResetWarm) {
  67. ResetFlag = AM335_PRM_DEVICE_RESET_CONTROL_WARM_RESET;
  68. } else {
  69. ResetFlag = AM335_PRM_DEVICE_RESET_CONTROL_COLD_RESET;
  70. }
  71. *ResetControl = *ResetControl | ResetFlag;
  72. while (TRUE) {
  73. if ((*ResetControl & ResetFlag) != 0) {
  74. break;
  75. }
  76. }
  77. //
  78. // Execution really should not get this far.
  79. //
  80. return;
  81. }
  82. //
  83. // --------------------------------------------------------- Internal Functions
  84. //