2 * Copyright (C) 2009 Michael Brown <mbrown@fensystems.co.uk>.
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License as
6 * published by the Free Software Foundation; either version 2 of the
7 * License, or any later version.
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
20 FILE_LICENCE ( GPL2_OR_LATER );
24 #include <ipxe/device.h>
25 #include <ipxe/efi/efi.h>
26 #include <ipxe/efi/efi_driver.h>
27 #include <ipxe/efi/efi_snp.h>
28 #include <ipxe/efi/efi_autoboot.h>
33 * @v image_handle Image handle
34 * @v systab System table
35 * @ret efirc EFI return status code
37 EFI_STATUS EFIAPI _efi_start ( EFI_HANDLE image_handle,
38 EFI_SYSTEM_TABLE *systab ) {
42 /* Initialise EFI environment */
43 if ( ( efirc = efi_init ( image_handle, systab ) ) != 0 )
46 /* Record autoboot device (if any) */
49 /* Claim SNP devices for use by iPXE */
53 if ( ( rc = main() ) != 0 ) {
60 efi_loaded_image->Unload ( image_handle );
61 efi_driver_reconnect_all();
69 * @v rootdev EFI root device
71 static int efi_probe ( struct root_device *rootdev __unused ) {
73 return efi_driver_connect_all();
79 * @v rootdev EFI root device
81 static void efi_remove ( struct root_device *rootdev __unused ) {
83 efi_driver_disconnect_all();
86 /** EFI root device driver */
87 static struct root_driver efi_root_driver = {
92 /** EFI root device */
93 struct root_device efi_root_device __root_device = {
94 .dev = { .name = "EFI" },
95 .driver = &efi_root_driver,