]> git.proxmox.com Git - mirror_edk2.git/blob - EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/PeiServicesTablePointerLibMm7/PeiServicesTablePointer.c
Update the copyright notice format
[mirror_edk2.git] / EdkCompatibilityPkg / Foundation / Library / EdkIIGlueLib / Library / PeiServicesTablePointerLibMm7 / PeiServicesTablePointer.c
1 /*++
2
3 Copyright (c) 2004 - 2006, Intel Corporation. All rights reserved.<BR>
4 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
13 Module Name:
14
15 PeiServicesTablePointer.c
16
17 Abstract:
18
19 PEI Services Table Pointer Library.
20
21 --*/
22
23 #include "EdkIIGluePeim.h"
24
25 /**
26 The function returns the pointer to PeiServices.
27
28 The function returns the pointer to PeiServices.
29 It will ASSERT() if the pointer to PeiServices is NULL.
30
31 @retval The pointer to PeiServices.
32
33 **/
34 EFI_PEI_SERVICES **
35 EFIAPI
36 GetPeiServicesTablePointer (
37 VOID
38 )
39 {
40 IA32_DESCRIPTOR Idtr;
41 EFI_PEI_SERVICES **PeiServices;
42
43 AsmReadIdtr (&Idtr);
44 PeiServices = (EFI_PEI_SERVICES **)(UINTN)(*(UINTN*)(Idtr.Base - sizeof (UINTN)));
45
46 if ((*PeiServices)->Hdr.Signature == PEI_SERVICES_SIGNATURE) {
47 return PeiServices;
48 } else {
49 PeiServices = (EFI_PEI_SERVICES **)(UINTN)AsmReadMm7 ();
50 ASSERT (PeiServices != NULL);
51 return PeiServices;
52 }
53 }
54
55 /**
56 The constructor function caches the pointer to PEI services.
57
58 The constructor function caches the pointer to PEI services.
59 It will always return EFI_SUCCESS.
60
61 @param FfsHeader Pointer to FFS header the loaded driver.
62 @param PeiServices Pointer to the PEI services.
63
64 @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS.
65
66 **/
67 EFI_STATUS
68 EFIAPI
69 PeiServicesTablePointerLibConstructor (
70 IN EFI_FFS_FILE_HEADER *FfsHeader,
71 IN EFI_PEI_SERVICES **PeiServices
72 )
73 {
74 #if (PI_SPECIFICATION_VERSION < 0x00010000)
75 AsmWriteMm7 ((UINT64)(UINTN)PeiServices);
76 #endif
77 return EFI_SUCCESS;
78 }