]> git.proxmox.com Git - mirror_edk2.git/blame - OvmfPkg/Include/Library/LoadLinuxLib.h
UefiCpuPkg: Move AsmRelocateApLoopStart from Mpfuncs.nasm to AmdSev.nasm
[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
b26f0cf9 5 SPDX-License-Identifier: BSD-2-Clause-Patent\r
f6c6c020 6\r
7**/\r
8\r
9#ifndef __LOAD_LINUX_LIB__\r
10#define __LOAD_LINUX_LIB__\r
11\r
f6c6c020 12/**\r
13 Verifies that the kernel setup image is valid and supported.\r
14 The kernel setup image should be checked before using other library\r
15 routines which take the kernel setup as an input.\r
16\r
17 @param[in] KernelSetup - The kernel setup image\r
18 @param[in] KernelSetupSize - The kernel setup size\r
19\r
20 @retval EFI_SUCCESS - The Linux kernel setup is valid and supported\r
21 @retval EFI_INVALID_PARAMETER - KernelSetup was NULL\r
22 @retval EFI_UNSUPPORTED - The Linux kernel is not supported\r
23\r
24**/\r
25EFI_STATUS\r
26EFIAPI\r
27LoadLinuxCheckKernelSetup (\r
ac0a286f
MK
28 IN VOID *KernelSetup,\r
29 IN UINTN KernelSetupSize\r
f6c6c020 30 );\r
31\r
f6c6c020 32/**\r
33 Gets the initial runtime size of the Linux kernel image by examining\r
34 the kernel setup image.\r
35\r
36 @param[in] KernelSetup - The kernel setup image\r
37 @param[in] KernelSize - The kernel size on disk.\r
38\r
b6b33f67 39 @retval 0 An error occurred\r
f6c6c020 40 @retval !0 The initial size required by the kernel to\r
41 begin execution.\r
42\r
43**/\r
44UINTN\r
45EFIAPI\r
46LoadLinuxGetKernelSize (\r
ac0a286f
MK
47 IN VOID *KernelSetup,\r
48 IN UINTN KernelSize\r
f6c6c020 49 );\r
50\r
f6c6c020 51/**\r
52 Loads and boots UEFI Linux.\r
53\r
54 Note: If successful, then this routine will not return\r
55\r
56 @param[in] Kernel - The main kernel image\r
57 @param[in,out] KernelSetup - The kernel setup image\r
58\r
59 @retval EFI_NOT_FOUND - The Linux kernel was not found\r
60 @retval EFI_INVALID_PARAMETER - Kernel or KernelSetup was NULL\r
61 @retval EFI_UNSUPPORTED - The Linux kernel version is not supported\r
62\r
63**/\r
64EFI_STATUS\r
65EFIAPI\r
66LoadLinux (\r
67 IN VOID *Kernel,\r
68 IN OUT VOID *KernelSetup\r
69 );\r
70\r
f6c6c020 71/**\r
72 Allocates pages for the kernel setup image.\r
73\r
74 @param[in] Pages - The number of pages\r
75\r
76 @retval NULL - Unable to allocate pages\r
77 @retval !NULL - The address of the pages allocated\r
78\r
79**/\r
ac0a286f 80VOID *\r
f6c6c020 81EFIAPI\r
82LoadLinuxAllocateKernelSetupPages (\r
ac0a286f 83 IN UINTN Pages\r
f6c6c020 84 );\r
85\r
c61a56f2 86/**\r
87 Clears the uninitialised space before and after the struct setup_header\r
88 in the kernel setup image. The kernel requires that these be zeroed\r
89 unless explicitly initialised, so this function should be called after\r
90 the setup_header has been copied in from a bzImage, before setting up\r
91 anything else.\r
92\r
93 @param[in] KernelSetup - The kernel setup image\r
94\r
95 @retval EFI_SUCCESS - The Linux kernel setup was successfully initialized\r
96 @retval EFI_INVALID_PARAMETER - KernelSetup was NULL\r
97 @retval EFI_UNSUPPORTED - The Linux kernel is not supported\r
98\r
99**/\r
100EFI_STATUS\r
101EFIAPI\r
102LoadLinuxInitializeKernelSetup (\r
ac0a286f 103 IN VOID *KernelSetup\r
c61a56f2 104 );\r
105\r
f6c6c020 106/**\r
107 Allocates pages for the kernel.\r
108\r
109 @param[in] KernelSetup - The kernel setup image\r
110 @param[in] Pages - The number of pages. (It is recommended to use the\r
111 size returned from LoadLinuxGetKernelSize.)\r
112\r
113 @retval NULL - Unable to allocate pages\r
114 @retval !NULL - The address of the pages allocated\r
115\r
116**/\r
ac0a286f 117VOID *\r
f6c6c020 118EFIAPI\r
119LoadLinuxAllocateKernelPages (\r
ac0a286f
MK
120 IN VOID *KernelSetup,\r
121 IN UINTN Pages\r
f6c6c020 122 );\r
123\r
f6c6c020 124/**\r
125 Allocates pages for the kernel command line.\r
126\r
127 @param[in] Pages - The number of pages.\r
128\r
129 @retval NULL - Unable to allocate pages\r
130 @retval !NULL - The address of the pages allocated\r
131\r
132**/\r
ac0a286f 133VOID *\r
f6c6c020 134EFIAPI\r
135LoadLinuxAllocateCommandLinePages (\r
ac0a286f 136 IN UINTN Pages\r
f6c6c020 137 );\r
138\r
f6c6c020 139/**\r
140 Allocates pages for the initrd image.\r
141\r
142 @param[in,out] KernelSetup - The kernel setup image\r
143 @param[in] Pages - The number of pages.\r
144\r
145 @retval NULL - Unable to allocate pages\r
146 @retval !NULL - The address of the pages allocated\r
147\r
148**/\r
ac0a286f 149VOID *\r
f6c6c020 150EFIAPI\r
151LoadLinuxAllocateInitrdPages (\r
ac0a286f
MK
152 IN VOID *KernelSetup,\r
153 IN UINTN Pages\r
f6c6c020 154 );\r
155\r
f6c6c020 156/**\r
157 Sets the kernel command line parameter within the setup image.\r
158\r
159 @param[in,out] KernelSetup - The kernel setup image\r
160 @param[in] CommandLine - The kernel command line\r
161\r
162 @retval EFI_SUCCESS - The Linux kernel setup is valid and supported\r
163 @retval EFI_INVALID_PARAMETER - KernelSetup was NULL\r
164 @retval EFI_UNSUPPORTED - The Linux kernel is not supported\r
165\r
166**/\r
167EFI_STATUS\r
168EFIAPI\r
169LoadLinuxSetCommandLine (\r
ac0a286f
MK
170 IN OUT VOID *KernelSetup,\r
171 IN CHAR8 *CommandLine\r
f6c6c020 172 );\r
173\r
f6c6c020 174/**\r
175 Sets the kernel initial ram disk pointer within the setup image.\r
176\r
177 @param[in,out] KernelSetup - The kernel setup image\r
178 @param[in] Initrd - Pointer to the initial ram disk\r
179 @param[in] InitrdSize - The initial ram disk image size\r
180\r
181 @retval EFI_SUCCESS - The Linux kernel setup is valid and supported\r
182 @retval EFI_INVALID_PARAMETER - KernelSetup was NULL\r
183 @retval EFI_UNSUPPORTED - The Linux kernel is not supported\r
184\r
185**/\r
186EFI_STATUS\r
187EFIAPI\r
188LoadLinuxSetInitrd (\r
ac0a286f
MK
189 IN OUT VOID *KernelSetup,\r
190 IN VOID *Initrd,\r
191 IN UINTN InitrdSize\r
f6c6c020 192 );\r
193\r
f6c6c020 194#endif\r