iPXE
efidrvprefix.c
Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2009 Michael Brown <mbrown@fensystems.co.uk>.
00003  *
00004  * This program is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU General Public License as
00006  * published by the Free Software Foundation; either version 2 of the
00007  * License, or any later version.
00008  *
00009  * This program is distributed in the hope that it will be useful, but
00010  * WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012  * General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU General Public License
00015  * along with this program; if not, write to the Free Software
00016  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
00017  * 02110-1301, USA.
00018  */
00019 
00020 FILE_LICENCE ( GPL2_OR_LATER );
00021 
00022 #include <stdlib.h>
00023 #include <ipxe/init.h>
00024 #include <ipxe/device.h>
00025 #include <ipxe/efi/efi.h>
00026 #include <ipxe/efi/efi_driver.h>
00027 
00028 /**
00029  * EFI entry point
00030  *
00031  * @v image_handle      Image handle
00032  * @v systab            System table
00033  * @ret efirc           EFI return status code
00034  */
00035 EFI_STATUS EFIAPI _efidrv_start ( EFI_HANDLE image_handle,
00036                                   EFI_SYSTEM_TABLE *systab ) {
00037         EFI_STATUS efirc;
00038 
00039         /* Initialise EFI environment */
00040         if ( ( efirc = efi_init ( image_handle, systab ) ) != 0 )
00041                 return efirc;
00042 
00043         /* Initialise iPXE environment */
00044         initialise();
00045         startup();
00046 
00047         return 0;
00048 }
00049 
00050 /**
00051  * Probe EFI root bus
00052  *
00053  * @v rootdev           EFI root device
00054  */
00055 static int efi_probe ( struct root_device *rootdev __unused ) {
00056 
00057         /* Do nothing */
00058         return 0;
00059 }
00060 
00061 /**
00062  * Remove EFI root bus
00063  *
00064  * @v rootdev           EFI root device
00065  */
00066 static void efi_remove ( struct root_device *rootdev __unused ) {
00067 
00068         efi_driver_disconnect_all();
00069 }
00070 
00071 /** EFI root device driver */
00072 static struct root_driver efi_root_driver = {
00073         .probe = efi_probe,
00074         .remove = efi_remove,
00075 };
00076 
00077 /** EFI root device */
00078 struct root_device efi_root_device __root_device = {
00079         .dev = { .name = "EFI" },
00080         .driver = &efi_root_driver,
00081 };