[efi] Blacklist the Dell Ip4ConfigDxe driver
[ipxe.git] / src / interface / efi / efiprefix.c
1 /*
2 * Copyright (C) 2009 Michael Brown <mbrown@fensystems.co.uk>.
3 *
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.
8 *
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.
13 *
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
17 * 02110-1301, USA.
18 */
19
20 FILE_LICENCE ( GPL2_OR_LATER );
21
22 #include <stdlib.h>
23 #include <errno.h>
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>
29 #include <ipxe/efi/efi_watchdog.h>
30 #include <ipxe/efi/efi_blacklist.h>
31
32 /**
33 * EFI entry point
34 *
35 * @v image_handle Image handle
36 * @v systab System table
37 * @ret efirc EFI return status code
38 */
39 EFI_STATUS EFIAPI _efi_start ( EFI_HANDLE image_handle,
40 EFI_SYSTEM_TABLE *systab ) {
41 EFI_STATUS efirc;
42 int rc;
43
44 /* Initialise EFI environment */
45 if ( ( efirc = efi_init ( image_handle, systab ) ) != 0 )
46 goto err_init;
47
48 /* Record autoboot device (if any) */
49 efi_set_autoboot();
50
51 /* Claim SNP devices for use by iPXE */
52 efi_snp_claim();
53
54 /* Start watchdog holdoff timer */
55 efi_watchdog_start();
56
57 /* Call to main() */
58 if ( ( rc = main() ) != 0 ) {
59 efirc = EFIRC ( rc );
60 goto err_main;
61 }
62
63 err_main:
64 efi_watchdog_stop();
65 efi_snp_release();
66 efi_loaded_image->Unload ( image_handle );
67 efi_driver_reconnect_all();
68 err_init:
69 return efirc;
70 }
71
72 /**
73 * Probe EFI root bus
74 *
75 * @v rootdev EFI root device
76 */
77 static int efi_probe ( struct root_device *rootdev __unused ) {
78
79 /* Unloaded any blacklisted drivers */
80 efi_unload_blacklist();
81
82 /* Connect our drivers */
83 return efi_driver_connect_all();
84 }
85
86 /**
87 * Remove EFI root bus
88 *
89 * @v rootdev EFI root device
90 */
91 static void efi_remove ( struct root_device *rootdev __unused ) {
92
93 /* Disconnect our drivers */
94 efi_driver_disconnect_all();
95 }
96
97 /** EFI root device driver */
98 static struct root_driver efi_root_driver = {
99 .probe = efi_probe,
100 .remove = efi_remove,
101 };
102
103 /** EFI root device */
104 struct root_device efi_root_device __root_device = {
105 .dev = { .name = "EFI" },
106 .driver = &efi_root_driver,
107 };