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