]> git.proxmox.com Git - mirror_edk2.git/blob - MdeModulePkg/Core/Pei/Ipf/SwitchToCacheMode.c
Removed CommonHeader.h from MdePkg & MdeModulePkg
[mirror_edk2.git] / MdeModulePkg / Core / Pei / Ipf / SwitchToCacheMode.c
1 /*++
2
3 Copyright (c) 2006, Intel Corporation
4 All rights reserved. This program and the accompanying materials
5 are licensed and made available under the terms and conditions of the BSD License
6 which accompanies this distribution. The full text of the license may be found at
7 http://opensource.org/licenses/bsd-license.php
8
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
11
12 Module Name:
13
14 SwitchToCacheMode.c
15
16 Abstract:
17
18 Ipf CAR specific function used to switch to cache mode for the later memory access
19
20 Revision History
21
22 --*/
23
24 #include "IpfPeiMain.h"
25 #include "IpfCpuCore.i"
26
27 VOID
28 SwitchToCacheMode (
29 IN PEI_CORE_INSTANCE *CoreData
30 )
31 /*++
32
33 Routine Description:
34
35 Switch the PHIT pointers to cache mode after InstallPeiMemory in CAR.
36
37 Arguments:
38
39 CoreData - The PEI core Private Data
40
41 Returns:
42
43 --*/
44 {
45 EFI_HOB_HANDOFF_INFO_TABLE *Phit;
46
47 if (CoreData == NULL) {
48 //
49 // the first call with CoreData as NULL.
50 //
51 return;
52 }
53
54 if ((GetHandOffStatus().r10 & 0xFF) == RecoveryFn) {
55 CoreData->StackBase = CoreData->StackBase & CACHE_MODE_ADDRESS_MASK;
56 CoreData->HobList.Raw = (UINT8 *)((UINTN)CoreData->HobList.Raw & CACHE_MODE_ADDRESS_MASK);
57
58 //
59 // Change the PHIT pointer value to cache mode
60 //
61 Phit = CoreData->HobList.HandoffInformationTable;
62
63 Phit->EfiMemoryTop = Phit->EfiMemoryTop & CACHE_MODE_ADDRESS_MASK;
64 Phit->EfiFreeMemoryTop = Phit->EfiFreeMemoryTop & CACHE_MODE_ADDRESS_MASK;
65 Phit->EfiMemoryBottom = Phit->EfiMemoryBottom & CACHE_MODE_ADDRESS_MASK;
66 Phit->EfiFreeMemoryBottom = Phit->EfiFreeMemoryBottom & CACHE_MODE_ADDRESS_MASK;
67 Phit->EfiEndOfHobList = Phit->EfiEndOfHobList & CACHE_MODE_ADDRESS_MASK;
68 }
69
70 return;
71 }