]> git.proxmox.com Git - mirror_edk2.git/blob - MdeModulePkg/Core/Pei/Ipf/SwitchToCacheMode.c
e0faa27013e5ec0156ea57485fbb4c76d17ca7c3
[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
26 VOID
27 SwitchToCacheMode (
28 IN PEI_CORE_INSTANCE *CoreData
29 )
30 /*++
31
32 Routine Description:
33
34 Switch the PHIT pointers to cache mode after InstallPeiMemory in CAR.
35
36 Arguments:
37
38 CoreData - The PEI core Private Data
39
40 Returns:
41
42 --*/
43 {
44 EFI_HOB_HANDOFF_INFO_TABLE *Phit;
45
46 if (CoreData == NULL) {
47 //
48 // the first call with CoreData as NULL.
49 //
50 return;
51 }
52
53 if ((GetHandOffStatus().r10 & 0xFF) == RecoveryFn) {
54 CoreData->StackBase = CoreData->StackBase & CACHE_MODE_ADDRESS_MASK;
55 CoreData->HobList.Raw = (UINT8 *)((UINTN)CoreData->HobList.Raw & CACHE_MODE_ADDRESS_MASK);
56
57 //
58 // Change the PHIT pointer value to cache mode
59 //
60 Phit = CoreData->HobList.HandoffInformationTable;
61
62 Phit->EfiMemoryTop = Phit->EfiMemoryTop & CACHE_MODE_ADDRESS_MASK;
63 Phit->EfiFreeMemoryTop = Phit->EfiFreeMemoryTop & CACHE_MODE_ADDRESS_MASK;
64 Phit->EfiMemoryBottom = Phit->EfiMemoryBottom & CACHE_MODE_ADDRESS_MASK;
65 Phit->EfiFreeMemoryBottom = Phit->EfiFreeMemoryBottom & CACHE_MODE_ADDRESS_MASK;
66 Phit->EfiEndOfHobList = Phit->EfiEndOfHobList & CACHE_MODE_ADDRESS_MASK;
67 }
68
69 return;
70 }