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