iPXE
efi_veto.c
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2019 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_OR_UBDL );
21 
22 #include <stddef.h>
23 #include <stdlib.h>
24 #include <string.h>
25 #include <errno.h>
26 #include <ipxe/settings.h>
27 #include <ipxe/pci.h>
28 #include <ipxe/efi/efi.h>
33 #include <ipxe/efi/efi_veto.h>
34 
35 /** @file
36  *
37  * EFI driver vetoes
38  *
39  */
40 
41 /** A driver veto candidate */
43  /** Veto name (for debugging) */
44  const char *name;
45  /**
46  * Check if driver is vetoed
47  *
48  * @v binding Driver binding protocol
49  * @v loaded Loaded image protocol
50  * @v manufacturer Manufacturer name, if present
51  * @v name Driver name, if present
52  * @ret vetoed Driver is to be vetoed
53  */
54  int ( * veto ) ( EFI_DRIVER_BINDING_PROTOCOL *binding,
56  const char *manufacturer, const CHAR16 *name );
57 };
58 
59 /** A driver veto */
60 struct efi_veto {
61  /** Driver binding handle */
63  /** Driving binding protocol */
65  /** Image handle */
67  /** Loaded image protocol */
69 };
70 
71 /**
72  * Unload an EFI driver
73  *
74  * @v veto Driver veto
75  * @ret rc Return status code
76  */
77 static int efi_veto_unload ( struct efi_veto *veto ) {
79  EFI_HANDLE driver = veto->driver;
80  EFI_HANDLE image = veto->image;
81  EFI_STATUS efirc;
82  int rc;
83 
84  /* Unload the driver */
85  if ( ( efirc = bs->UnloadImage ( image ) ) != 0 ) {
86  rc = -EEFI ( efirc );
87  DBGC ( driver, "EFIVETO %s could not unload",
88  efi_handle_name ( driver ) );
89  DBGC ( driver, " %s: %s\n", efi_handle_name ( image ),
90  strerror ( rc ) );
91  return rc;
92  }
93 
94  return 0;
95 }
96 
97 /**
98  * Disconnect an EFI driver from all handles
99  *
100  * @v veto Driver veto
101  * @ret rc Return status code
102  */
103 static int efi_veto_disconnect ( struct efi_veto *veto ) {
105  EFI_HANDLE driver = veto->driver;
106  EFI_HANDLE *handles;
108  UINTN count;
109  unsigned int i;
110  EFI_STATUS efirc;
111  int rc;
112 
113  /* Enumerate all handles */
114  if ( ( efirc = bs->LocateHandleBuffer ( AllHandles, NULL, NULL,
115  &count, &handles ) ) != 0 ) {
116  rc = -EEFI ( efirc );
117  DBGC ( driver, "EFIVETO %s could not enumerate handles: %s\n",
118  efi_handle_name ( driver ), strerror ( rc ) );
119  goto err_list;
120  }
121 
122  /* Disconnect driver from all handles, in reverse order */
123  for ( i = 0 ; i < count ; i++ ) {
124  handle = handles[ count - i - 1 ];
125  if ( ( rc = efi_disconnect ( handle, driver ) ) != 0 ) {
126  DBGC ( driver, "EFIVETO %s could not disconnect",
127  efi_handle_name ( driver ) );
128  DBGC ( driver, " %s: %s\n",
129  efi_handle_name ( handle ), strerror ( rc ) );
130  goto err_disconnect;
131  }
132  }
133 
134  /* Success */
135  rc = 0;
136  DBGC2 ( driver, "EFIVETO %s disconnected all handles\n",
137  efi_handle_name ( driver ) );
138 
139  err_disconnect:
140  bs->FreePool ( handles );
141  err_list:
142  return rc;
143 }
144 
145 /**
146  * Uninstall an EFI driver binding protocol
147  *
148  * @v veto Driver veto
149  * @ret rc Return status code
150  */
151 static int efi_veto_uninstall ( struct efi_veto *veto ) {
153  EFI_HANDLE driver = veto->driver;
155  EFI_STATUS efirc;
156  int rc;
157 
158  /* Open driver binding protocol */
159  if ( ( rc = efi_open ( driver, &efi_driver_binding_protocol_guid,
160  &binding ) ) != 0 ) {
161  DBGC ( driver, "EFIVETO %s could not open driver binding "
162  "protocol: %s\n", efi_handle_name ( driver ),
163  strerror ( rc ) );
164  return rc;
165  }
166 
167  /* Uninstall driver binding protocol */
168  if ( ( efirc = bs->UninstallMultipleProtocolInterfaces (
170  binding, NULL ) ) != 0 ) {
171  rc = -EEFI ( efirc );
172  DBGC ( driver, "EFIVETO %s could not uninstall driver "
173  "binding protocol: %s\n",
174  efi_handle_name ( driver ), strerror ( rc ) );
175  return rc;
176  }
177 
178  DBGC2 ( driver, "EFIVETO %s uninstalled driver binding protocol\n",
179  efi_handle_name ( driver ) );
180  return 0;
181 }
182 
183 /**
184  * Close protocol on handle potentially opened by an EFI driver
185  *
186  * @v veto Driver veto
187  * @v handle Potentially opened handle
188  * @v protocol Opened protocol
189  * @ret rc Return status code
190  */
192  EFI_GUID *protocol ) {
194  EFI_HANDLE driver = veto->driver;
195  EFI_HANDLE image = veto->image;
199  UINTN count;
200  unsigned int i;
201  EFI_STATUS efirc;
202  int rc;
203 
204  /* Retrieve list of openers */
205  if ( ( efirc = bs->OpenProtocolInformation ( handle, protocol, &openers,
206  &count ) ) != 0 ) {
207  rc = -EEFI ( efirc );
208  DBGC ( driver, "EFIVETO %s could not retrieve openers",
209  efi_handle_name ( driver ) );
210  DBGC ( driver, " of %s %s: %s", efi_handle_name ( handle ),
211  efi_guid_ntoa ( protocol ), strerror ( rc ) );
212  goto err_list;
213  }
214 
215  /* Close anything opened by this driver */
216  for ( i = 0 ; i < count ; i++ ) {
217  opener = &openers[ count - i - 1 ];
218  if ( ( opener->AgentHandle != driver ) &&
219  ( opener->AgentHandle != image ) ) {
220  continue;
221  }
222  controller = opener->ControllerHandle;
223  DBGC_EFI_OPENER ( driver, handle, protocol, opener );
224  if ( ( efirc = bs->CloseProtocol ( handle, protocol, driver,
225  controller ) ) != 0 ) {
226  rc = -EEFI ( efirc );
227  DBGC ( driver, "EFIVETO %s could not close stray open",
228  efi_handle_name ( driver ) );
229  DBGC ( driver, " of %s: %s\n",
230  efi_handle_name ( handle ), strerror ( rc ) );
231  goto err_close;
232  }
233  }
234 
235  /* Success */
236  rc = 0;
237 
238  err_close:
239  bs->FreePool ( openers );
240  err_list:
241  return rc;
242 }
243 
244 /**
245  * Close handle potentially opened by an EFI driver
246  *
247  * @v veto Driver veto
248  * @v handle Potentially opened handle
249  * @ret rc Return status code
250  */
251 static int efi_veto_close_handle ( struct efi_veto *veto, EFI_HANDLE handle ) {
253  EFI_HANDLE driver = veto->driver;
254  EFI_GUID **protocols;
256  UINTN count;
257  unsigned int i;
258  EFI_STATUS efirc;
259  int rc;
260 
261  /* Retrieve list of protocols */
262  if ( ( efirc = bs->ProtocolsPerHandle ( handle, &protocols,
263  &count ) ) != 0 ) {
264  rc = -EEFI ( efirc );
265  DBGC ( driver, "EFIVETO %s could not retrieve protocols",
266  efi_handle_name ( driver ) );
267  DBGC ( driver, " for %s: %s\n",
268  efi_handle_name ( handle ), strerror ( rc ) );
269  goto err_list;
270  }
271 
272  /* Close each protocol */
273  for ( i = 0 ; i < count ; i++ ) {
274  protocol = protocols[ count - i - 1];
275  if ( ( rc = efi_veto_close_protocol ( veto, handle,
276  protocol ) ) != 0 )
277  goto err_close;
278  }
279 
280  /* Success */
281  rc = 0;
282 
283  err_close:
284  bs->FreePool ( protocols );
285  err_list:
286  return rc;
287 }
288 
289 /**
290  * Close all remaining handles opened by an EFI driver
291  *
292  * @v veto Driver veto
293  * @ret rc Return status code
294  */
295 static int efi_veto_close ( struct efi_veto *veto ) {
297  EFI_HANDLE driver = veto->driver;
298  EFI_HANDLE *handles;
300  UINTN count;
301  unsigned int i;
302  EFI_STATUS efirc;
303  int rc;
304 
305  /* Enumerate all handles */
306  if ( ( efirc = bs->LocateHandleBuffer ( AllHandles, NULL, NULL,
307  &count, &handles ) ) != 0 ) {
308  rc = -EEFI ( efirc );
309  DBGC ( driver, "EFIVETO %s could not enumerate handles: %s\n",
310  efi_handle_name ( driver ), strerror ( rc ) );
311  goto err_list;
312  }
313 
314  /* Close each handle */
315  for ( i = 0 ; i < count ; i++ ) {
316  handle = handles[ count - i - 1 ];
317  if ( ( rc = efi_veto_close_handle ( veto, handle ) ) != 0 )
318  goto err_close;
319  }
320 
321  /* Success */
322  rc = 0;
323  DBGC2 ( driver, "EFIVETO %s closed all remaining handles\n",
324  efi_handle_name ( driver ) );
325 
326  err_close:
327  bs->FreePool ( handles );
328  err_list:
329  return rc;
330 }
331 
332 /**
333  * Terminate an EFI driver with extreme prejudice
334  *
335  * @v veto Driver veto
336  * @ret rc Return status code
337  */
338 static int efi_veto_destroy ( struct efi_veto *veto ) {
339  EFI_HANDLE driver = veto->driver;
340  int rc;
341 
342  /* Disconnect driver from all handles */
343  if ( ( rc = efi_veto_disconnect ( veto ) ) != 0 )
344  return rc;
345 
346  /* Uninstall driver binding protocol */
347  if ( ( rc = efi_veto_uninstall ( veto ) ) != 0 )
348  return rc;
349 
350  /* Close any remaining opened handles */
351  if ( ( rc = efi_veto_close ( veto ) ) != 0 )
352  return rc;
353 
354  DBGC ( driver, "EFIVETO %s forcibly removed\n",
355  efi_handle_name ( driver ) );
356  return 0;
357 }
358 
359 /**
360  * Veto an EFI driver
361  *
362  * @v veto Driver veto
363  * @ret rc Return status code
364  */
365 static int efi_veto_driver ( struct efi_veto *veto ) {
366  int rc;
367 
368  /* Try gracefully unloading the driver */
369  if ( ( rc = efi_veto_unload ( veto ) ) == 0 )
370  return 0;
371 
372  /* If that fails, use a hammer */
373  if ( ( rc = efi_veto_destroy ( veto ) ) == 0 )
374  return 0;
375 
376  return rc;
377 }
378 
379 /**
380  * Veto Ip4ConfigDxe driver on some platforms
381  *
382  * @v binding Driver binding protocol
383  * @v loaded Loaded image protocol
384  * @v manufacturer Manufacturer name, if present
385  * @v name Driver name, if present
386  * @ret vetoed Driver is to be vetoed
387  */
388 static int
391  const char *manufacturer, const CHAR16 *name ) {
392  static const CHAR16 ip4cfg[] = L"IP4 CONFIG Network Service Driver";
393  static const char *dell = "Dell Inc.";
394  static const char *itautec = "Itautec S.A.";
395 
396  /* Check manufacturer and driver name */
397  if ( ! manufacturer )
398  return 0;
399  if ( ! name )
400  return 0;
401  if ( ( strcmp ( manufacturer, dell ) != 0 ) &&
402  ( strcmp ( manufacturer, itautec ) != 0 ) )
403  return 0;
404  if ( memcmp ( name, ip4cfg, sizeof ( ip4cfg ) ) != 0 )
405  return 0;
406 
407  return 1;
408 }
409 
410 /**
411  * Veto HP XhciDxe driver
412  *
413  * @v binding Driver binding protocol
414  * @v loaded Loaded image protocol
415  * @v manufacturer Manufacturer name, if present
416  * @v name Driver name, if present
417  * @ret vetoed Driver is to be vetoed
418  */
419 static int
422  const char *manufacturer, const CHAR16 *name ) {
423  static const CHAR16 xhci[] = L"Usb Xhci Driver";
424  static const char *hp = "HP";
425  struct pci_driver *driver;
426 
427  /* Check manufacturer and driver name */
428  if ( ! manufacturer )
429  return 0;
430  if ( ! name )
431  return 0;
432  if ( strcmp ( manufacturer, hp ) != 0 )
433  return 0;
434  if ( memcmp ( name, xhci, sizeof ( xhci ) ) != 0 )
435  return 0;
436 
437  /* Veto driver only if we have our own xHCI driver */
438  for_each_table_entry ( driver, PCI_DRIVERS ) {
439  if ( driver->class.class ==
442  return 1;
443  }
444  }
445 
446  return 0;
447 }
448 
449 /**
450  * Veto VMware UefiPxeBcDxe driver
451  *
452  * @v binding Driver binding protocol
453  * @v loaded Loaded image protocol
454  * @v manufacturer Manufacturer name, if present
455  * @v name Driver name, if present
456  * @ret vetoed Driver is to be vetoed
457  */
458 static int
461  const char *manufacturer, const CHAR16 *name ) {
462  static const CHAR16 uefipxebc[] = L"UEFI PXE Base Code Driver";
463  static const char *vmware = "VMware, Inc.";
464 
465  /* Check manufacturer and driver name */
466  if ( ! manufacturer )
467  return 0;
468  if ( ! name )
469  return 0;
470  if ( strcmp ( manufacturer, vmware ) != 0 )
471  return 0;
472  if ( memcmp ( name, uefipxebc, sizeof ( uefipxebc ) ) != 0 )
473  return 0;
474 
475  return 1;
476 }
477 
478 /**
479  * Veto Dhcp6Dxe driver
480  *
481  * @v binding Driver binding protocol
482  * @v loaded Loaded image protocol
483  * @v manufacturer Manufacturer name, if present
484  * @v name Driver name, if present
485  * @ret vetoed Driver is to be vetoed
486  */
489  const char *manufacturer __unused,
490  const CHAR16 *name ) {
491  static const CHAR16 dhcp6[] = L"DHCP6 Protocol Driver";
492 
493  /* Check driver name */
494  if ( ! name )
495  return 0;
496  if ( memcmp ( name, dhcp6, sizeof ( dhcp6 ) ) != 0 )
497  return 0;
498 
499  return 1;
500 }
501 
502 /** Driver vetoes */
503 static struct efi_veto_candidate efi_vetoes[] = {
504  {
505  .name = "Ip4Config",
506  .veto = efi_veto_ip4config,
507  },
508  {
509  .name = "HP Xhci",
510  .veto = efi_veto_hp_xhci,
511  },
512  {
513  .name = "VMware UefiPxeBc",
515  },
516  {
517  .name = "Dhcp6",
518  .veto = efi_veto_dhcp6,
519  },
520 };
521 
522 /**
523  * Find driver veto, if any
524  *
525  * @v driver Driver binding handle
526  * @v manufacturer Manufacturer name, if present
527  * @ret veto Driver veto to fill in
528  * @ret rc Return status code
529  */
530 static int efi_veto_find ( EFI_HANDLE driver, const char *manufacturer,
531  struct efi_veto *veto ) {
536  CHAR16 *name;
537  unsigned int i;
539  EFI_STATUS efirc;
540  int rc;
541 
542  /* Mark as not vetoed */
543  memset ( veto, 0, sizeof ( *veto ) );
544 
545  /* Open driver binding protocol */
546  if ( ( rc = efi_open ( driver, &efi_driver_binding_protocol_guid,
547  &binding ) ) != 0 ) {
548  DBGC ( driver, "EFIVETO %s could not open driver binding "
549  "protocol: %s\n", efi_handle_name ( driver ),
550  strerror ( rc ) );
551  return rc;
552  }
553  image = binding->ImageHandle;
554 
555  /* Open loaded image protocol */
557  &loaded ) ) != 0 ) {
558  DBGC ( driver, "EFIVETO %s could not open",
559  efi_handle_name ( driver ) );
560  DBGC ( driver, " %s loaded image protocol: %s\n",
561  efi_handle_name ( image ), strerror ( rc ) );
562  return rc;
563  }
564 
565  /* Open component name protocol, if present */
567  &wtf2 ) ) != 0 ) {
568  /* Ignore failure; is not required to be present */
569  }
570 
571  /* Open obsolete component name protocol, if present */
573  &wtf ) ) != 0 ) {
574  /* Ignore failure; is not required to be present */
575  }
576 
577  /* Get driver name, if available */
578  if ( ( wtf2 && ( ( efirc = wtf2->GetDriverName ( wtf2, "en",
579  &name ) == 0 ) ) ) ||
580  ( wtf && ( ( efirc = wtf->GetDriverName ( wtf, "eng",
581  &name ) == 0 ) ) ) ) {
582  /* Driver has a name */
583  } else {
584  /* Ignore failure; name is not required to be present */
585  name = NULL;
586  }
587 
588  /* Check vetoes */
589  DBGC2 ( &efi_vetoes, "EFIVETO checking %s [%p,%p)\n",
590  efi_handle_name ( driver ), loaded->ImageBase,
591  ( loaded->ImageBase + loaded->ImageSize ) );
592  for ( i = 0 ; i < ( sizeof ( efi_vetoes ) /
593  sizeof ( efi_vetoes[0] ) ) ; i++ ) {
594  if ( efi_vetoes[i].veto ( binding, loaded, manufacturer,
595  name ) ) {
596  DBGC ( driver, "EFIVETO %s is vetoed (%s)\n",
597  efi_handle_name ( driver ),
598  efi_vetoes[i].name );
599  veto->driver = driver;
600  veto->binding = binding;
601  veto->image = image;
602  veto->loaded = loaded;
603  break;
604  }
605  }
606 
607  return 0;
608 }
609 
610 /**
611  * Remove any vetoed drivers
612  *
613  */
614 void efi_veto ( void ) {
616  struct efi_veto veto;
617  EFI_HANDLE *drivers;
619  UINTN count;
620  unsigned int i;
621  char *manufacturer;
622  EFI_STATUS efirc;
623  int rc;
624 
625  /* Locate all driver binding protocol handles */
626  if ( ( efirc = bs->LocateHandleBuffer (
628  NULL, &count, &drivers ) ) != 0 ) {
629  rc = -EEFI ( efirc );
630  DBGC ( &efi_vetoes, "EFIVETO could not list all drivers: "
631  "%s\n", strerror ( rc ) );
632  return;
633  }
634 
635  /* Get manufacturer name */
636  fetch_string_setting_copy ( NULL, &manufacturer_setting,
637  &manufacturer );
638  DBGC ( &efi_vetoes, "EFIVETO manufacturer is \"%s\"\n", manufacturer );
639 
640  /* Unload any vetoed drivers */
641  for ( i = 0 ; i < count ; i++ ) {
642  driver = drivers[ count - i - 1 ];
643  if ( ( rc = efi_veto_find ( driver, manufacturer,
644  &veto ) ) != 0 ) {
645  DBGC ( driver, "EFIVETO %s could not determine "
646  "vetoing: %s\n",
647  efi_handle_name ( driver ), strerror ( rc ) );
648  continue;
649  }
650  if ( ! veto.driver )
651  continue;
652  if ( ( rc = efi_veto_driver ( &veto ) ) != 0 ) {
653  DBGC ( driver, "EFIVETO %s could not veto: %s\n",
654  efi_handle_name ( driver ), strerror ( rc ) );
655  }
656  }
657 
658  /* Free manufacturer name */
659  free ( manufacturer );
660 
661  /* Free handle list */
662  bs->FreePool ( drivers );
663 }
UEFI DriverBinding Protocol is defined in UEFI specification.
static int efi_veto_vmware_uefipxebc(EFI_DRIVER_BINDING_PROTOCOL *binding __unused, EFI_LOADED_IMAGE_PROTOCOL *loaded __unused, const char *manufacturer, const CHAR16 *name)
Veto VMware UefiPxeBcDxe driver.
Definition: efi_veto.c:459
EFI_BOOT_SERVICES * BootServices
A pointer to the EFI Boot Services Table.
Definition: UefiSpec.h:2098
const char * name
Veto name (for debugging)
Definition: efi_veto.c:44
int(* veto)(EFI_DRIVER_BINDING_PROTOCOL *binding, EFI_LOADED_IMAGE_PROTOCOL *loaded, const char *manufacturer, const CHAR16 *name)
Check if driver is vetoed.
Definition: efi_veto.c:54
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
const char * name
Definition: ath9k_hw.c:1984
EFI Oprn Protocol Information Entry.
Definition: UefiSpec.h:1431
This protocol is used to retrieve user readable names of drivers and controllers managed by UEFI Driv...
struct pci_class_id class
PCI class ID.
Definition: pci.h:257
#define EEFI(efirc)
Convert an EFI status code to an iPXE status code.
Definition: efi.h:174
static int efi_veto_close_handle(struct efi_veto *veto, EFI_HANDLE handle)
Close handle potentially opened by an EFI driver.
Definition: efi_veto.c:251
A PCI driver.
Definition: pci.h:251
EFI_HANDLE ControllerHandle
Definition: UefiSpec.h:1433
This protocol is used to retrieve user readable names of drivers and controllers managed by UEFI Driv...
void efi_veto(void)
Remove any vetoed drivers.
Definition: efi_veto.c:614
EFI_HANDLE AgentHandle
Definition: UefiSpec.h:1432
EFI_HANDLE image
Image handle.
Definition: efi_veto.c:66
static int efi_veto_driver(struct efi_veto *veto)
Veto an EFI driver.
Definition: efi_veto.c:365
128 bit buffer containing a unique identifier value.
Definition: Base.h:215
UINT64 ImageSize
The size in bytes of the loaded image.
Definition: LoadedImage.h:70
Error codes.
Retrieve all the handles in the handle database.
Definition: UefiSpec.h:1521
static int efi_veto_uninstall(struct efi_veto *veto)
Uninstall an EFI driver binding protocol.
Definition: efi_veto.c:151
#define DBGC(...)
Definition: compiler.h:505
EFI_GUID efi_loaded_image_protocol_guid
Loaded image protocol GUID.
Definition: efi_guid.c:272
A driver veto candidate.
Definition: efi_veto.c:42
static int efi_veto_ip4config(EFI_DRIVER_BINDING_PROTOCOL *binding __unused, EFI_LOADED_IMAGE_PROTOCOL *loaded __unused, const char *manufacturer, const CHAR16 *name)
Veto Ip4ConfigDxe driver on some platforms.
Definition: efi_veto.c:389
EFI driver vetoes.
unsigned short CHAR16
uint32_t class
Class.
Definition: pci.h:191
EFI_IMAGE_UNLOAD UnloadImage
Definition: UefiSpec.h:1980
An executable image.
Definition: image.h:23
VOID * ImageBase
The base address at which the image was loaded.
Definition: LoadedImage.h:69
EFI Component Name Protocol as defined in the EFI 1.1 specification.
EFI_CLOSE_PROTOCOL CloseProtocol
Definition: UefiSpec.h:2000
static int efi_veto_find(EFI_HANDLE driver, const char *manufacturer, struct efi_veto *veto)
Find driver veto, if any.
Definition: efi_veto.c:530
#define PCI_CLASS_SERIAL_USB_XHCI
xHCI USB controller
Definition: pci.h:140
#define PCI_CLASS_SERIAL
Definition: Pci22.h:266
UEFI 2.0 Loaded image protocol definition.
EFI_HANDLE driver
Driver binding handle.
Definition: efi_veto.c:62
Can be used on any image handle to obtain information about the loaded image.
Definition: LoadedImage.h:45
char wtf[42]
Authenticator response string.
Definition: mschapv2.h:18
#define __unused
Declare a variable or data structure as unused.
Definition: compiler.h:573
static struct efi_veto_candidate efi_vetoes[]
Driver vetoes.
Definition: efi_veto.c:503
UEFI Component Name 2 Protocol as defined in the UEFI 2.1 specification.
EFI_COMPONENT_NAME2_GET_DRIVER_NAME GetDriverName
#define PCI_CLASS(base, sub, progif)
Construct PCI class.
Definition: pci.h:166
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)
static unsigned int count
Number of entries.
Definition: dwmac.h:225
int fetch_string_setting_copy(struct settings *settings, const struct setting *setting, char **data)
Fetch value of string setting.
Definition: settings.c:873
static int efi_veto_unload(struct efi_veto *veto)
Unload an EFI driver.
Definition: efi_veto.c:77
Configuration settings.
const char * efi_handle_name(EFI_HANDLE handle)
Get name of an EFI handle.
Definition: efi_debug.c:652
char * strerror(int errno)
Retrieve string representation of error number.
Definition: strerror.c:78
static void(* free)(struct refcnt *refcnt))
Definition: refcnt.h:54
EFI Boot Services Table.
Definition: UefiSpec.h:1930
#define PCI_CLASS_SERIAL_USB
Definition: Pci22.h:272
PCI bus.
#define for_each_table_entry(pointer, table)
Iterate through all entries within a linker table.
Definition: tables.h:385
EFI_UNINSTALL_MULTIPLE_PROTOCOL_INTERFACES UninstallMultipleProtocolInterfaces
Definition: UefiSpec.h:2010
#define efi_open(handle, protocol, interface)
Open protocol for ephemeral use.
Definition: efi.h:443
UINT64 UINTN
Unsigned value of native width.
This protocol provides the services required to determine if a driver supports a given controller.
const char * efi_guid_ntoa(CONST EFI_GUID *guid)
Convert GUID to a printable string.
Definition: efi_guid.c:725
EFI_DRIVER_BINDING_PROTOCOL * binding
Driving binding protocol.
Definition: efi_veto.c:64
EFI_GUID efi_component_name2_protocol_guid
Component name 2 protocol GUID.
Definition: efi_guid.c:160
EFI_HANDLE ImageHandle
The image handle of the UEFI driver that produced this instance of the EFI_DRIVER_BINDING_PROTOCOL.
EFI_FREE_POOL FreePool
Definition: UefiSpec.h:1949
uint8_t manufacturer
Manufacturer string.
Definition: smbios.h:14
EFI_OPEN_PROTOCOL_INFORMATION OpenProtocolInformation
Definition: UefiSpec.h:2001
EFI API.
static int efi_veto_hp_xhci(EFI_DRIVER_BINDING_PROTOCOL *binding __unused, EFI_LOADED_IMAGE_PROTOCOL *loaded __unused, const char *manufacturer, const CHAR16 *name)
Veto HP XhciDxe driver.
Definition: efi_veto.c:420
static int efi_veto_destroy(struct efi_veto *veto)
Terminate an EFI driver with extreme prejudice.
Definition: efi_veto.c:338
EFI_LOADED_IMAGE_PROTOCOL * loaded
Loaded image protocol.
Definition: efi_veto.c:68
uint8_t controller
CD-ROM controller number.
Definition: int13.h:18
EFI_PROTOCOLS_PER_HANDLE ProtocolsPerHandle
Definition: UefiSpec.h:2006
#define DBGC2(...)
Definition: compiler.h:522
int strcmp(const char *first, const char *second)
Compare strings.
Definition: string.c:173
RETURN_STATUS EFI_STATUS
Function return status for EFI API.
Definition: UefiBaseType.h:31
static int efi_veto_close_protocol(struct efi_veto *veto, EFI_HANDLE handle, EFI_GUID *protocol)
Close protocol on handle potentially opened by an EFI driver.
Definition: efi_veto.c:191
static int efi_veto_dhcp6(EFI_DRIVER_BINDING_PROTOCOL *binding __unused, EFI_LOADED_IMAGE_PROTOCOL *loaded __unused, const char *manufacturer __unused, const CHAR16 *name)
Veto Dhcp6Dxe driver.
Definition: efi_veto.c:487
Retrieve the set of handles from the handle database that support a specified protocol.
Definition: UefiSpec.h:1530
EFI_SYSTEM_TABLE * efi_systab
EFI_GUID efi_component_name_protocol_guid
Component name protocol GUID.
Definition: efi_guid.c:156
uint16_t protocol
Protocol ID.
Definition: stp.h:18
static int efi_veto_disconnect(struct efi_veto *veto)
Disconnect an EFI driver from all handles.
Definition: efi_veto.c:103
static int efi_veto_close(struct efi_veto *veto)
Close all remaining handles opened by an EFI driver.
Definition: efi_veto.c:295
uint16_t handle
Handle.
Definition: smbios.h:16
int memcmp(const void *first, const void *second, size_t len)
Compare memory regions.
Definition: string.c:114
EFI_GUID efi_driver_binding_protocol_guid
Driver binding protocol GUID.
Definition: efi_guid.c:208
#define NULL
NULL pointer (VOID *)
Definition: Base.h:321
String functions.
A driver veto.
Definition: efi_veto.c:60
Definition: efi.h:61
EFI_LOCATE_HANDLE_BUFFER LocateHandleBuffer
Definition: UefiSpec.h:2007
int efi_disconnect(EFI_HANDLE device, EFI_HANDLE driver)
Disconnect UEFI driver(s)
Definition: efi_connect.c:89
#define PCI_DRIVERS
PCI driver table.
Definition: pci.h:274
void * memset(void *dest, int character, size_t len) __nonnull
#define DBGC_EFI_OPENER(...)
Definition: efi.h:342