VirtualBox

source: vbox/trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/PeiServicesTablePointerLibKs0/PeiServicesTablePointer.c

最後變更 在這個檔案是 105670,由 vboxsync 提交於 5 月 前

Devices/EFI/FirmwareNew: Merge edk2-stable-202405 and make it build on aarch64, bugref:4643

  • 屬性 svn:eol-style 設為 native
檔案大小: 2.5 KB
 
1/** @file
2 PEI Services Table Pointer Library For Reigseter Mechanism.
3
4 This library is used for PEIM which does executed from flash device directly but
5 executed in memory.
6
7 Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
8 Copyright (c) 2011 Hewlett-Packard Corporation. All rights reserved.<BR>
9 Copyright (c) 2024 Loongson Technology Corporation Limited. All rights reserved.<BR>
10
11 SPDX-License-Identifier: BSD-2-Clause-Patent
12
13**/
14
15#include <PiPei.h>
16#include <Library/DebugLib.h>
17#include <Library/PeiServicesTablePointerLib.h>
18#include <Register/LoongArch64/Csr.h>
19
20/**
21 Caches a pointer PEI Services Table.
22
23 Caches the pointer to the PEI Services Table specified by PeiServicesTablePointer
24 in a platform specific manner.
25
26 If PeiServicesTablePointer is NULL, then ASSERT().
27
28 @param PeiServicesTablePointer The address of PeiServices pointer.
29**/
30VOID
31EFIAPI
32SetPeiServicesTablePointer (
33 IN CONST EFI_PEI_SERVICES **PeiServicesTablePointer
34 )
35{
36 ASSERT (PeiServicesTablePointer != NULL);
37 CsrWrite (LOONGARCH_CSR_KS0, (UINTN)PeiServicesTablePointer);
38}
39
40/**
41 Retrieves the cached value of the PEI Services Table pointer.
42
43 Returns the cached value of the PEI Services Table pointer in a CPU specific manner
44 as specified in the CPU binding section of the Platform Initialization Pre-EFI
45 Initialization Core Interface Specification.
46
47 If the cached PEI Services Table pointer is NULL, then ASSERT().
48
49 @return The pointer to PeiServices.
50
51**/
52CONST EFI_PEI_SERVICES **
53EFIAPI
54GetPeiServicesTablePointer (
55 VOID
56 )
57{
58 CONST EFI_PEI_SERVICES **PeiServices;
59
60 PeiServices = (CONST EFI_PEI_SERVICES **)(CsrRead (LOONGARCH_CSR_KS0));
61 ASSERT (PeiServices != NULL);
62 return PeiServices;
63}
64
65/**
66 Perform CPU specific actions required to migrate the PEI Services Table
67 pointer from temporary RAM to permanent RAM.
68
69 For IA32 CPUs, the PEI Services Table pointer is stored in the 4 bytes
70 immediately preceding the Interrupt Descriptor Table (IDT) in memory.
71 For X64 CPUs, the PEI Services Table pointer is stored in the 8 bytes
72 immediately preceding the Interrupt Descriptor Table (IDT) in memory.
73 For Itanium, ARM and LoongArch CPUs, a the PEI Services Table Pointer
74 is stored in a dedicated CPU register. This means that there is no
75 memory storage associated with storing the PEI Services Table pointer,
76 so no additional migration actions are required for Itanium, ARM and
77 LoongArch CPUs.
78
79**/
80VOID
81EFIAPI
82MigratePeiServicesTablePointer (
83 VOID
84 )
85{
86 return;
87}
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette