]>
Commit | Line | Data |
---|---|---|
427e3573 MK |
1 | /** @file\r |
2 | Semaphore mechanism to indicate to the BSP that an AP has exited SMM\r | |
3 | after SMBASE relocation.\r | |
4 | \r | |
5 | Copyright (c) 2009 - 2015, Intel Corporation. All rights reserved.<BR>\r | |
6 | This program and the accompanying materials\r | |
7 | are licensed and made available under the terms and conditions of the BSD License\r | |
8 | which accompanies this distribution. The full text of the license may be found at\r | |
9 | http://opensource.org/licenses/bsd-license.php\r | |
10 | \r | |
11 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
12 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
13 | \r | |
14 | **/\r | |
15 | \r | |
16 | #include "PiSmmCpuDxeSmm.h"\r | |
17 | \r | |
18 | extern UINT32 mSmmRelocationOriginalAddressPtr32;\r | |
19 | extern UINT32 mRebasedFlagAddr32;\r | |
20 | \r | |
21 | UINTN mSmmRelocationOriginalAddress;\r | |
22 | volatile BOOLEAN *mRebasedFlag;\r | |
23 | \r | |
24 | /**\r | |
25 | AP Semaphore operation in 32-bit mode while BSP runs in 64-bit mode.\r | |
26 | **/\r | |
27 | VOID\r | |
28 | SmmRelocationSemaphoreComplete32 (\r | |
29 | VOID\r | |
30 | );\r | |
31 | \r | |
32 | /**\r | |
33 | Hook return address of SMM Save State so that semaphore code\r | |
34 | can be executed immediately after AP exits SMM to indicate to\r | |
35 | the BSP that an AP has exited SMM after SMBASE relocation.\r | |
36 | \r | |
37 | @param[in] CpuIndex The processor index.\r | |
38 | @param[in] RebasedFlag A pointer to a flag that is set to TRUE\r | |
39 | immediately after AP exits SMM.\r | |
40 | \r | |
41 | **/\r | |
42 | VOID\r | |
43 | SemaphoreHook (\r | |
44 | IN UINTN CpuIndex,\r | |
45 | IN volatile BOOLEAN *RebasedFlag\r | |
46 | )\r | |
47 | {\r | |
48 | SMRAM_SAVE_STATE_MAP *CpuState;\r | |
49 | UINTN TempValue;\r | |
50 | \r | |
51 | mRebasedFlag = RebasedFlag;\r | |
52 | mRebasedFlagAddr32 = (UINT32)(UINTN)mRebasedFlag;\r | |
53 | \r | |
54 | CpuState = (SMRAM_SAVE_STATE_MAP *)(UINTN)(SMM_DEFAULT_SMBASE + SMRAM_SAVE_STATE_MAP_OFFSET);\r | |
55 | mSmmRelocationOriginalAddress = HookReturnFromSmm (\r | |
56 | CpuIndex,\r | |
57 | CpuState,\r | |
58 | (UINT64)(UINTN)&SmmRelocationSemaphoreComplete32,\r | |
59 | (UINT64)(UINTN)&SmmRelocationSemaphoreComplete\r | |
60 | );\r | |
61 | \r | |
62 | //\r | |
63 | // Use temp value to fix ICC complier warning\r | |
64 | //\r | |
65 | TempValue = (UINTN)&mSmmRelocationOriginalAddress;\r | |
66 | mSmmRelocationOriginalAddressPtr32 = (UINT32)TempValue;\r | |
67 | }\r |