]> git.proxmox.com Git - mirror_edk2.git/blob - MdeModulePkg/Core/Pei/Ipf/SwitchToCacheMode.c
1) If PeiLoadImage fails, the section extraction PPI or Decompress PPI may not be...
[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 #define RecoveryFn 0x03
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 ((GetHandOffStatus().r10 & 0xFF) == RecoveryFn) {
48 CoreData->StackBase = CoreData->StackBase & CACHE_MODE_ADDRESS_MASK;
49 CoreData->HobList.Raw = (UINT8 *)((UINTN)CoreData->HobList.Raw & CACHE_MODE_ADDRESS_MASK);
50
51 //
52 // Change the PHIT pointer value to cache mode
53 //
54 Phit = CoreData->HobList.HandoffInformationTable;
55
56 Phit->EfiMemoryTop = Phit->EfiMemoryTop & CACHE_MODE_ADDRESS_MASK;
57 Phit->EfiFreeMemoryTop = Phit->EfiFreeMemoryTop & CACHE_MODE_ADDRESS_MASK;
58 Phit->EfiMemoryBottom = Phit->EfiMemoryBottom & CACHE_MODE_ADDRESS_MASK;
59 Phit->EfiFreeMemoryBottom = Phit->EfiFreeMemoryBottom & CACHE_MODE_ADDRESS_MASK;
60 Phit->EfiEndOfHobList = Phit->EfiEndOfHobList & CACHE_MODE_ADDRESS_MASK;
61 }
62
63 return;
64 }