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