OvmfPkg/MemEncryptSevLib: find pages of initial SMRAM save state map
[mirror_edk2.git] / OvmfPkg / Include / Library / LoadLinuxLib.h
CommitLineData
f6c6c020 1/** @file\r
2 Load/boot UEFI Linux.\r
3\r
c61a56f2 4 Copyright (c) 2011 - 2013, Intel Corporation. All rights reserved.<BR>\r
f6c6c020 5 This program and the accompanying materials\r
6 are licensed and made available under the terms and conditions of the BSD License\r
7 which accompanies this distribution. The full text of the license may be found at\r
8 http://opensource.org/licenses/bsd-license.php\r
9\r
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
12\r
13**/\r
14\r
15#ifndef __LOAD_LINUX_LIB__\r
16#define __LOAD_LINUX_LIB__\r
17\r
18\r
19/**\r
20 Verifies that the kernel setup image is valid and supported.\r
21 The kernel setup image should be checked before using other library\r
22 routines which take the kernel setup as an input.\r
23\r
24 @param[in] KernelSetup - The kernel setup image\r
25 @param[in] KernelSetupSize - The kernel setup size\r
26\r
27 @retval EFI_SUCCESS - The Linux kernel setup is valid and supported\r
28 @retval EFI_INVALID_PARAMETER - KernelSetup was NULL\r
29 @retval EFI_UNSUPPORTED - The Linux kernel is not supported\r
30\r
31**/\r
32EFI_STATUS\r
33EFIAPI\r
34LoadLinuxCheckKernelSetup (\r
35 IN VOID *KernelSetup,\r
36 IN UINTN KernelSetupSize\r
37 );\r
38\r
39\r
40/**\r
41 Gets the initial runtime size of the Linux kernel image by examining\r
42 the kernel setup image.\r
43\r
44 @param[in] KernelSetup - The kernel setup image\r
45 @param[in] KernelSize - The kernel size on disk.\r
46\r
b6b33f67 47 @retval 0 An error occurred\r
f6c6c020 48 @retval !0 The initial size required by the kernel to\r
49 begin execution.\r
50\r
51**/\r
52UINTN\r
53EFIAPI\r
54LoadLinuxGetKernelSize (\r
55 IN VOID *KernelSetup,\r
56 IN UINTN KernelSize\r
57 );\r
58\r
59\r
60/**\r
61 Loads and boots UEFI Linux.\r
62\r
63 Note: If successful, then this routine will not return\r
64\r
65 @param[in] Kernel - The main kernel image\r
66 @param[in,out] KernelSetup - The kernel setup image\r
67\r
68 @retval EFI_NOT_FOUND - The Linux kernel was not found\r
69 @retval EFI_INVALID_PARAMETER - Kernel or KernelSetup was NULL\r
70 @retval EFI_UNSUPPORTED - The Linux kernel version is not supported\r
71\r
72**/\r
73EFI_STATUS\r
74EFIAPI\r
75LoadLinux (\r
76 IN VOID *Kernel,\r
77 IN OUT VOID *KernelSetup\r
78 );\r
79\r
80\r
81/**\r
82 Allocates pages for the kernel setup image.\r
83\r
84 @param[in] Pages - The number of pages\r
85\r
86 @retval NULL - Unable to allocate pages\r
87 @retval !NULL - The address of the pages allocated\r
88\r
89**/\r
90VOID*\r
91EFIAPI\r
92LoadLinuxAllocateKernelSetupPages (\r
93 IN UINTN Pages\r
94 );\r
95\r
96\r
c61a56f2 97/**\r
98 Clears the uninitialised space before and after the struct setup_header\r
99 in the kernel setup image. The kernel requires that these be zeroed\r
100 unless explicitly initialised, so this function should be called after\r
101 the setup_header has been copied in from a bzImage, before setting up\r
102 anything else.\r
103\r
104 @param[in] KernelSetup - The kernel setup image\r
105\r
106 @retval EFI_SUCCESS - The Linux kernel setup was successfully initialized\r
107 @retval EFI_INVALID_PARAMETER - KernelSetup was NULL\r
108 @retval EFI_UNSUPPORTED - The Linux kernel is not supported\r
109\r
110**/\r
111EFI_STATUS\r
112EFIAPI\r
113LoadLinuxInitializeKernelSetup (\r
114 IN VOID *KernelSetup\r
115 );\r
116\r
f6c6c020 117/**\r
118 Allocates pages for the kernel.\r
119\r
120 @param[in] KernelSetup - The kernel setup image\r
121 @param[in] Pages - The number of pages. (It is recommended to use the\r
122 size returned from LoadLinuxGetKernelSize.)\r
123\r
124 @retval NULL - Unable to allocate pages\r
125 @retval !NULL - The address of the pages allocated\r
126\r
127**/\r
128VOID*\r
129EFIAPI\r
130LoadLinuxAllocateKernelPages (\r
131 IN VOID *KernelSetup,\r
132 IN UINTN Pages\r
133 );\r
134\r
135\r
136/**\r
137 Allocates pages for the kernel command line.\r
138\r
139 @param[in] Pages - The number of pages.\r
140\r
141 @retval NULL - Unable to allocate pages\r
142 @retval !NULL - The address of the pages allocated\r
143\r
144**/\r
145VOID*\r
146EFIAPI\r
147LoadLinuxAllocateCommandLinePages (\r
148 IN UINTN Pages\r
149 );\r
150\r
151\r
152/**\r
153 Allocates pages for the initrd image.\r
154\r
155 @param[in,out] KernelSetup - The kernel setup image\r
156 @param[in] Pages - The number of pages.\r
157\r
158 @retval NULL - Unable to allocate pages\r
159 @retval !NULL - The address of the pages allocated\r
160\r
161**/\r
162VOID*\r
163EFIAPI\r
164LoadLinuxAllocateInitrdPages (\r
165 IN VOID *KernelSetup,\r
166 IN UINTN Pages\r
167 );\r
168\r
169\r
170/**\r
171 Sets the kernel command line parameter within the setup image.\r
172\r
173 @param[in,out] KernelSetup - The kernel setup image\r
174 @param[in] CommandLine - The kernel command line\r
175\r
176 @retval EFI_SUCCESS - The Linux kernel setup is valid and supported\r
177 @retval EFI_INVALID_PARAMETER - KernelSetup was NULL\r
178 @retval EFI_UNSUPPORTED - The Linux kernel is not supported\r
179\r
180**/\r
181EFI_STATUS\r
182EFIAPI\r
183LoadLinuxSetCommandLine (\r
184 IN OUT VOID *KernelSetup,\r
185 IN CHAR8 *CommandLine\r
186 );\r
187\r
188\r
189/**\r
190 Sets the kernel initial ram disk pointer within the setup image.\r
191\r
192 @param[in,out] KernelSetup - The kernel setup image\r
193 @param[in] Initrd - Pointer to the initial ram disk\r
194 @param[in] InitrdSize - The initial ram disk image size\r
195\r
196 @retval EFI_SUCCESS - The Linux kernel setup is valid and supported\r
197 @retval EFI_INVALID_PARAMETER - KernelSetup was NULL\r
198 @retval EFI_UNSUPPORTED - The Linux kernel is not supported\r
199\r
200**/\r
201EFI_STATUS\r
202EFIAPI\r
203LoadLinuxSetInitrd (\r
204 IN OUT VOID *KernelSetup,\r
205 IN VOID *Initrd,\r
206 IN UINTN InitrdSize\r
207 );\r
208\r
209\r
210#endif\r
211\r