1 /** @file 2 Load/boot UEFI Linux. 3 4 Copyright (c) 2011 - 2013, 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 occurred 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 Clears the uninitialised space before and after the struct setup_header 99 in the kernel setup image. The kernel requires that these be zeroed 100 unless explicitly initialised, so this function should be called after 101 the setup_header has been copied in from a bzImage, before setting up 102 anything else. 103 104 @param[in] KernelSetup - The kernel setup image 105 106 @retval EFI_SUCCESS - The Linux kernel setup was successfully initialized 107 @retval EFI_INVALID_PARAMETER - KernelSetup was NULL 108 @retval EFI_UNSUPPORTED - The Linux kernel is not supported 109 110 **/ 111 EFI_STATUS 112 EFIAPI 113 LoadLinuxInitializeKernelSetup ( 114 IN VOID *KernelSetup 115 ); 116 117 /** 118 Allocates pages for the kernel. 119 120 @param[in] KernelSetup - The kernel setup image 121 @param[in] Pages - The number of pages. (It is recommended to use the 122 size returned from LoadLinuxGetKernelSize.) 123 124 @retval NULL - Unable to allocate pages 125 @retval !NULL - The address of the pages allocated 126 127 **/ 128 VOID* 129 EFIAPI 130 LoadLinuxAllocateKernelPages ( 131 IN VOID *KernelSetup, 132 IN UINTN Pages 133 ); 134 135 136 /** 137 Allocates pages for the kernel command line. 138 139 @param[in] Pages - The number of pages. 140 141 @retval NULL - Unable to allocate pages 142 @retval !NULL - The address of the pages allocated 143 144 **/ 145 VOID* 146 EFIAPI 147 LoadLinuxAllocateCommandLinePages ( 148 IN UINTN Pages 149 ); 150 151 152 /** 153 Allocates pages for the initrd image. 154 155 @param[in,out] KernelSetup - The kernel setup image 156 @param[in] Pages - The number of pages. 157 158 @retval NULL - Unable to allocate pages 159 @retval !NULL - The address of the pages allocated 160 161 **/ 162 VOID* 163 EFIAPI 164 LoadLinuxAllocateInitrdPages ( 165 IN VOID *KernelSetup, 166 IN UINTN Pages 167 ); 168 169 170 /** 171 Sets the kernel command line parameter within the setup image. 172 173 @param[in,out] KernelSetup - The kernel setup image 174 @param[in] CommandLine - The kernel command line 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 LoadLinuxSetCommandLine ( 184 IN OUT VOID *KernelSetup, 185 IN CHAR8 *CommandLine 186 ); 187 188 189 /** 190 Sets the kernel initial ram disk pointer within the setup image. 191 192 @param[in,out] KernelSetup - The kernel setup image 193 @param[in] Initrd - Pointer to the initial ram disk 194 @param[in] InitrdSize - The initial ram disk image size 195 196 @retval EFI_SUCCESS - The Linux kernel setup is valid and supported 197 @retval EFI_INVALID_PARAMETER - KernelSetup was NULL 198 @retval EFI_UNSUPPORTED - The Linux kernel is not supported 199 200 **/ 201 EFI_STATUS 202 EFIAPI 203 LoadLinuxSetInitrd ( 204 IN OUT VOID *KernelSetup, 205 IN VOID *Initrd, 206 IN UINTN InitrdSize 207 ); 208 209 210 #endif 211 212