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