3 Copyright (c) 2008-2009, Apple Inc. All rights reserved.
5 All rights reserved. This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
17 #include <Library/ArmLib.h>
18 #include <Library/CacheMaintenanceLib.h>
19 #include <Library/MemoryAllocationLib.h>
20 #include <Library/IoLib.h>
21 #include <Library/PcdLib.h>
22 #include <Library/DebugLib.h>
23 #include <Library/UefiBootServicesTableLib.h>
24 #include <Library/BeagleBoardSystemLib.h>
26 #include <Omap3530/Omap3530.h>
30 IN EFI_RESET_TYPE ResetType
35 //Perform warm reset of the system.
36 GoLittleEndian(PcdGet32(PcdFlashFvMainBase
));
39 case EfiResetShutdown
:
41 //Perform cold reset of the system.
42 MmioOr32(PRM_RSTCTRL
, RST_DPLL3
);
43 while ((MmioRead32(PRM_RSTST
) & GLOBAL_COLD_RST
) != 0x1);
47 //Should never come here.
58 EFI_MEMORY_DESCRIPTOR
*MemoryMap
;
61 UINTN DescriptorVersion
;
67 Status
= gBS
->GetMemoryMap (
74 if (Status
== EFI_BUFFER_TOO_SMALL
) {
76 Pages
= EFI_SIZE_TO_PAGES (MemoryMapSize
) + 1;
77 MemoryMap
= AllocatePages (Pages
);
80 // Get System MemoryMap
82 Status
= gBS
->GetMemoryMap (
89 // Don't do anything between the GetMemoryMap() and ExitBootServices()
90 if (!EFI_ERROR (Status
)) {
91 Status
= gBS
->ExitBootServices (gImageHandle
, MapKey
);
92 if (EFI_ERROR (Status
)) {
93 FreePages (MemoryMap
, Pages
);
99 } while (EFI_ERROR (Status
));
101 //Clean and invalidate caches.
102 WriteBackInvalidateDataCache();
103 InvalidateInstructionCache();
105 //Turning off Caches and MMU
106 ArmDisableDataCache();
107 ArmDisableInstructionCache();