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