Merge tag 'v2022.04-rc5' into next
[platform/kernel/u-boot.git] / doc / develop / uefi / uefi.rst
1 .. SPDX-License-Identifier: GPL-2.0+
2 .. Copyright (c) 2018 Heinrich Schuchardt
3
4 UEFI on U-Boot
5 ==============
6
7 The Unified Extensible Firmware Interface Specification (UEFI) [1] has become
8 the default for booting on AArch64 and x86 systems. It provides a stable API for
9 the interaction of drivers and applications with the firmware. The API comprises
10 access to block storage, network, and console to name a few. The Linux kernel
11 and boot loaders like GRUB or the FreeBSD loader can be executed.
12
13 Development target
14 ------------------
15
16 The implementation of UEFI in U-Boot strives to reach the requirements described
17 in the "Embedded Base Boot Requirements (EBBR) Specification - Release v1.0"
18 [2]. The "Server Base Boot Requirements System Software on ARM Platforms" [3]
19 describes a superset of the EBBR specification and may be used as further
20 reference.
21
22 A full blown UEFI implementation would contradict the U-Boot design principle
23 "keep it small".
24
25 Building U-Boot for UEFI
26 ------------------------
27
28 The UEFI standard supports only little-endian systems. The UEFI support can be
29 activated for ARM and x86 by specifying::
30
31     CONFIG_CMD_BOOTEFI=y
32     CONFIG_EFI_LOADER=y
33
34 in the .config file.
35
36 Support for attaching virtual block devices, e.g. iSCSI drives connected by the
37 loaded UEFI application [4], requires::
38
39     CONFIG_BLK=y
40     CONFIG_PARTITIONS=y
41
42 Executing a UEFI binary
43 ~~~~~~~~~~~~~~~~~~~~~~~
44
45 The bootefi command is used to start UEFI applications or to install UEFI
46 drivers. It takes two parameters::
47
48     bootefi <image address> [fdt address]
49
50 * image address - the memory address of the UEFI binary
51 * fdt address - the memory address of the flattened device tree
52
53 Below you find the output of an example session starting GRUB::
54
55     => load mmc 0:2 ${fdt_addr_r} boot/dtb
56     29830 bytes read in 14 ms (2 MiB/s)
57     => load mmc 0:1 ${kernel_addr_r} efi/debian/grubaa64.efi
58     reading efi/debian/grubaa64.efi
59     120832 bytes read in 7 ms (16.5 MiB/s)
60     => bootefi ${kernel_addr_r} ${fdt_addr_r}
61
62 When booting from a memory location it is unknown from which file it was loaded.
63 Therefore the bootefi command uses the device path of the block device partition
64 or the network adapter and the file name of the most recently loaded PE-COFF
65 file when setting up the loaded image protocol.
66
67 Launching a UEFI binary from a FIT image
68 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
69
70 A signed FIT image can be used to securely boot a UEFI image via the
71 bootm command. This feature is available if U-Boot is configured with::
72
73     CONFIG_BOOTM_EFI=y
74
75 A sample configuration is provided as file doc/uImage.FIT/uefi.its.
76
77 Below you find the output of an example session starting GRUB::
78
79     => load mmc 0:1 ${kernel_addr_r} image.fit
80     4620426 bytes read in 83 ms (53.1 MiB/s)
81     => bootm ${kernel_addr_r}#config-grub-nofdt
82     ## Loading kernel from FIT Image at 40400000 ...
83        Using 'config-grub-nofdt' configuration
84        Verifying Hash Integrity ... sha256,rsa2048:dev+ OK
85        Trying 'efi-grub' kernel subimage
86          Description:  GRUB EFI Firmware
87          Created:      2019-11-20   8:18:16 UTC
88          Type:         Kernel Image (no loading done)
89          Compression:  uncompressed
90          Data Start:   0x404000d0
91          Data Size:    450560 Bytes = 440 KiB
92          Hash algo:    sha256
93          Hash value:   4dbee00021112df618f58b3f7cf5e1595533d543094064b9ce991e8b054a9eec
94        Verifying Hash Integrity ... sha256+ OK
95        XIP Kernel Image (no loading done)
96     ## Transferring control to EFI (at address 404000d0) ...
97     Welcome to GRUB!
98
99 See doc/uImage.FIT/howto.txt for an introduction to FIT images.
100
101 Configuring UEFI secure boot
102 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
103
104 The UEFI specification[1] defines a secure way of executing UEFI images
105 by verifying a signature (or message digest) of image with certificates.
106 This feature on U-Boot is enabled with::
107
108     CONFIG_EFI_SECURE_BOOT=y
109
110 To make the boot sequence safe, you need to establish a chain of trust;
111 In UEFI secure boot the chain trust is defined by the following UEFI variables
112
113 * PK - Platform Key
114 * KEK - Key Exchange Keys
115 * db - white list database
116 * dbx - black list database
117
118 An in depth description of UEFI secure boot is beyond the scope of this
119 document. Please, refer to the UEFI specification and available online
120 documentation. Here is a simple example that you can follow for your initial
121 attempt (Please note that the actual steps will depend on your system and
122 environment.):
123
124 Install the required tools on your host
125
126 * openssl
127 * efitools
128 * sbsigntool
129
130 Create signing keys and the key database on your host:
131
132 The platform key
133
134 .. code-block:: bash
135
136     openssl req -x509 -sha256 -newkey rsa:2048 -subj /CN=TEST_PK/ \
137             -keyout PK.key -out PK.crt -nodes -days 365
138     cert-to-efi-sig-list -g 11111111-2222-3333-4444-123456789abc \
139             PK.crt PK.esl;
140     sign-efi-sig-list -c PK.crt -k PK.key PK PK.esl PK.auth
141
142 The key exchange keys
143
144 .. code-block:: bash
145
146     openssl req -x509 -sha256 -newkey rsa:2048 -subj /CN=TEST_KEK/ \
147             -keyout KEK.key -out KEK.crt -nodes -days 365
148     cert-to-efi-sig-list -g 11111111-2222-3333-4444-123456789abc \
149             KEK.crt KEK.esl
150     sign-efi-sig-list -c PK.crt -k PK.key KEK KEK.esl KEK.auth
151
152 The whitelist database
153
154 .. code-block:: bash
155
156     openssl req -x509 -sha256 -newkey rsa:2048 -subj /CN=TEST_db/ \
157             -keyout db.key -out db.crt -nodes -days 365
158     cert-to-efi-sig-list -g 11111111-2222-3333-4444-123456789abc \
159             db.crt db.esl
160     sign-efi-sig-list -c KEK.crt -k KEK.key db db.esl db.auth
161
162 Copy the \*.auth files to media, say mmc, that is accessible from U-Boot.
163
164 Sign an image with one of the keys in "db" on your host
165
166 .. code-block:: bash
167
168     sbsign --key db.key --cert db.crt helloworld.efi
169
170 Now in U-Boot install the keys on your board::
171
172     fatload mmc 0:1 <tmpaddr> PK.auth
173     setenv -e -nv -bs -rt -at -i <tmpaddr>:$filesize PK
174     fatload mmc 0:1 <tmpaddr> KEK.auth
175     setenv -e -nv -bs -rt -at -i <tmpaddr>:$filesize KEK
176     fatload mmc 0:1 <tmpaddr> db.auth
177     setenv -e -nv -bs -rt -at -i <tmpaddr>:$filesize db
178
179 Set up boot parameters on your board::
180
181     efidebug boot add -b 1 HELLO mmc 0:1 /helloworld.efi.signed ""
182
183 Since kernel 5.7 there's an alternative way of loading an initrd using
184 LoadFile2 protocol if CONFIG_EFI_LOAD_FILE2_INITRD is enabled.
185 The initrd path can be specified with::
186
187     efidebug boot add -b ABE0 'kernel' mmc 0:1 Image -i mmc 0:1 initrd
188
189 Now your board can run the signed image via the boot manager (see below).
190 You can also try this sequence by running Pytest, test_efi_secboot,
191 on the sandbox
192
193 .. code-block:: bash
194
195     cd <U-Boot source directory>
196     pytest.py test/py/tests/test_efi_secboot/test_signed.py --bd sandbox
197
198 UEFI binaries may be signed by Microsoft using the following certificates:
199
200 * KEK: Microsoft Corporation KEK CA 2011
201   http://go.microsoft.com/fwlink/?LinkId=321185.
202 * db: Microsoft Windows Production PCA 2011
203   http://go.microsoft.com/fwlink/p/?linkid=321192.
204 * db: Microsoft Corporation UEFI CA 2011
205   http://go.microsoft.com/fwlink/p/?linkid=321194.
206
207 Using OP-TEE for EFI variables
208 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
209
210 Instead of implementing UEFI variable services inside U-Boot they can
211 also be provided in the secure world by a module for OP-TEE[1]. The
212 interface between U-Boot and OP-TEE for variable services is enabled by
213 CONFIG_EFI_MM_COMM_TEE=y.
214
215 Tianocore EDK II's standalone management mode driver for variables can
216 be linked to OP-TEE for this purpose. This module uses the Replay
217 Protected Memory Block (RPMB) of an eMMC device for persisting
218 non-volatile variables. When calling the variable services via the
219 OP-TEE API U-Boot's OP-TEE supplicant relays calls to the RPMB driver
220 which has to be enabled via CONFIG_SUPPORT_EMMC_RPMB=y.
221
222 EDK2 Build instructions
223 ***********************
224
225 .. code-block:: bash
226
227     $ git clone https://github.com/tianocore/edk2.git
228     $ git clone https://github.com/tianocore/edk2-platforms.git
229     $ cd edk2
230     $ git submodule init && git submodule update --init --recursive
231     $ cd ..
232     $ export WORKSPACE=$(pwd)
233     $ export PACKAGES_PATH=$WORKSPACE/edk2:$WORKSPACE/edk2-platforms
234     $ export ACTIVE_PLATFORM="Platform/StandaloneMm/PlatformStandaloneMmPkg/PlatformStandaloneMmRpmb.dsc"
235     $ export GCC5_AARCH64_PREFIX=aarch64-linux-gnu-
236     $ source edk2/edksetup.sh
237     $ make -C edk2/BaseTools
238     $ build -p $ACTIVE_PLATFORM -b RELEASE -a AARCH64 -t GCC5 -n `nproc`
239
240 OP-TEE Build instructions
241 *************************
242
243 .. code-block:: bash
244
245     $ git clone https://github.com/OP-TEE/optee_os.git
246     $ cd optee_os
247     $ ln -s ../Build/MmStandaloneRpmb/RELEASE_GCC5/FV/BL32_AP_MM.fd
248     $ export ARCH=arm
249     $ CROSS_COMPILE32=arm-linux-gnueabihf- make -j32 CFG_ARM64_core=y \
250         PLATFORM=<myboard> CFG_STMM_PATH=BL32_AP_MM.fd CFG_RPMB_FS=y \
251         CFG_RPMB_FS_DEV_ID=0 CFG_CORE_HEAP_SIZE=524288 CFG_RPMB_WRITE_KEY=y \
252         CFG_CORE_DYN_SHM=y CFG_RPMB_TESTKEY=y CFG_REE_FS=n \
253         CFG_CORE_ARM64_PA_BITS=48 CFG_TEE_CORE_LOG_LEVEL=1 \
254         CFG_TEE_TA_LOG_LEVEL=1 CFG_SCTLR_ALIGNMENT_CHECK=n
255
256 U-Boot Build instructions
257 *************************
258
259 Although the StandAloneMM binary comes from EDK2, using and storing the
260 variables is currently available in U-Boot only.
261
262 .. code-block:: bash
263
264     $ git clone https://github.com/u-boot/u-boot.git
265     $ cd u-boot
266     $ export CROSS_COMPILE=aarch64-linux-gnu-
267     $ export ARCH=<arch>
268     $ make <myboard>_defconfig
269     $ make menuconfig
270
271 Enable ``CONFIG_OPTEE``, ``CONFIG_CMD_OPTEE_RPMB`` and ``CONFIG_EFI_MM_COMM_TEE``
272
273 .. warning::
274
275     - Your OP-TEE platform port must support Dynamic shared memory, since that's
276       the only kind of memory U-Boot supports for now.
277
278 [1] https://optee.readthedocs.io/en/latest/building/efi_vars/stmm.html
279
280 Enabling UEFI Capsule Update feature
281 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
282
283 Support has been added for the UEFI capsule update feature which
284 enables updating the U-Boot image using the UEFI firmware management
285 protocol (FMP). The capsules are not passed to the firmware through
286 the UpdateCapsule runtime service. Instead, capsule-on-disk
287 functionality is used for fetching capsules from the EFI System
288 Partition (ESP) by placing capsule files under the directory::
289
290     \EFI\UpdateCapsule
291
292 The directory is checked for capsules only within the
293 EFI system partition on the device specified in the active boot option,
294 which is determined by BootXXXX variable in BootNext, or if not, the highest
295 priority one within BootOrder. Any BootXXXX variables referring to devices
296 not present are ignored when determining the active boot option.
297
298 Please note that capsules will be applied in the alphabetic order of
299 capsule file names.
300
301 Creating a capsule file
302 ***********************
303
304 A capsule file can be created by using tools/mkeficapsule.
305 To build this tool, enable::
306
307     CONFIG_TOOLS_MKEFICAPSULE=y
308     CONFIG_TOOLS_LIBCRYPTO=y
309
310 Run the following command
311
312 .. code-block:: console
313
314     $ mkeficapsule \
315       --index 1 --instance 0 \
316       [--fit <FIT image> | --raw <raw image>] \
317       <capsule_file_name>
318
319 Performing the update
320 *********************
321
322 Put capsule files under the directory mentioned above.
323 Then, following the UEFI specification, you'll need to set
324 the EFI_OS_INDICATIONS_FILE_CAPSULE_DELIVERY_SUPPORTED
325 bit in OsIndications variable with
326
327 .. code-block:: console
328
329     => setenv -e -nv -bs -rt -v OsIndications =0x04
330
331 Since U-boot doesn't currently support SetVariable at runtime, its value
332 won't be taken over across the reboot. If this is the case, you can skip
333 this feature check with the Kconfig option (CONFIG_EFI_IGNORE_OSINDICATIONS)
334 set.
335
336 Finally, the capsule update can be initiated by rebooting the board.
337
338 Enabling Capsule Authentication
339 *******************************
340
341 The UEFI specification defines a way of authenticating the capsule to
342 be updated by verifying the capsule signature. The capsule signature
343 is computed and prepended to the capsule payload at the time of
344 capsule generation. This signature is then verified by using the
345 public key stored as part of the X509 certificate. This certificate is
346 in the form of an efi signature list (esl) file, which is embedded in
347 a device tree.
348
349 The capsule authentication feature can be enabled through the
350 following config, in addition to the configs listed above for capsule
351 update::
352
353     CONFIG_EFI_CAPSULE_AUTHENTICATE=y
354
355 The public and private keys used for the signing process are generated
356 and used by the steps highlighted below.
357
358 1. Install utility commands on your host
359        * openssl
360        * efitools
361
362 2. Create signing keys and certificate files on your host
363
364 .. code-block:: console
365
366     $ openssl req -x509 -sha256 -newkey rsa:2048 -subj /CN=CRT/ \
367         -keyout CRT.key -out CRT.crt -nodes -days 365
368     $ cert-to-efi-sig-list CRT.crt CRT.esl
369
370 3. Run the following command to create and sign the capsule file
371
372 .. code-block:: console
373
374     $ mkeficapsule --monotonic-count 1 \
375       --private-key CRT.key \
376       --certificate CRT.crt \
377       --index 1 --instance 0 \
378       [--fit | --raw | --guid <guid-string] \
379       <image_blob> <capsule_file_name>
380
381 4. Insert the signature list into a device tree in the following format::
382
383     {
384             signature {
385                     capsule-key = [ <binary of signature list> ];
386             }
387             ...
388     }
389
390 You can do step-4 manually with
391
392 .. code-block:: console
393
394     $ dtc -@ -I dts -O dtb -o signature.dtbo signature.dts
395     $ fdtoverlay -i orig.dtb -o new.dtb -v signature.dtbo
396
397 where signature.dts looks like::
398
399     &{/} {
400             signature {
401                     capsule-key = /incbin/("CRT.esl");
402             };
403     };
404
405 Executing the boot manager
406 ~~~~~~~~~~~~~~~~~~~~~~~~~~
407
408 The UEFI specification foresees to define boot entries and boot sequence via
409 UEFI variables. Booting according to these variables is possible via::
410
411     bootefi bootmgr [fdt address]
412
413 As of U-Boot v2020.10 UEFI variables cannot be set at runtime. The U-Boot
414 command 'efidebug' can be used to set the variables.
415
416 Executing the built in hello world application
417 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
418
419 A hello world UEFI application can be built with::
420
421     CONFIG_CMD_BOOTEFI_HELLO_COMPILE=y
422
423 It can be embedded into the U-Boot binary with::
424
425     CONFIG_CMD_BOOTEFI_HELLO=y
426
427 The bootefi command is used to start the embedded hello world application::
428
429     bootefi hello [fdt address]
430
431 Below you find the output of an example session::
432
433     => bootefi hello ${fdtcontroladdr}
434     ## Starting EFI application at 01000000 ...
435     WARNING: using memory device/image path, this may confuse some payloads!
436     Hello, world!
437     Running on UEFI 2.7
438     Have SMBIOS table
439     Have device tree
440     Load options: root=/dev/sdb3 init=/sbin/init rootwait ro
441     ## Application terminated, r = 0
442
443 The environment variable fdtcontroladdr points to U-Boot's internal device tree
444 (if available).
445
446 Executing the built-in self-test
447 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
448
449 An UEFI self-test suite can be embedded in U-Boot by building with::
450
451     CONFIG_CMD_BOOTEFI_SELFTEST=y
452
453 For testing the UEFI implementation the bootefi command can be used to start the
454 self-test::
455
456     bootefi selftest [fdt address]
457
458 The environment variable 'efi_selftest' can be used to select a single test. If
459 it is not provided all tests are executed except those marked as 'on request'.
460 If the environment variable is set to 'list' a list of all tests is shown.
461
462 Below you can find the output of an example session::
463
464     => setenv efi_selftest simple network protocol
465     => bootefi selftest
466     Testing EFI API implementation
467     Selected test: 'simple network protocol'
468     Setting up 'simple network protocol'
469     Setting up 'simple network protocol' succeeded
470     Executing 'simple network protocol'
471     DHCP Discover
472     DHCP reply received from 192.168.76.2 (52:55:c0:a8:4c:02)
473       as broadcast message.
474     Executing 'simple network protocol' succeeded
475     Tearing down 'simple network protocol'
476     Tearing down 'simple network protocol' succeeded
477     Boot services terminated
478     Summary: 0 failures
479     Preparing for reset. Press any key.
480
481 The UEFI life cycle
482 -------------------
483
484 After the U-Boot platform has been initialized the UEFI API provides two kinds
485 of services:
486
487 * boot services
488 * runtime services
489
490 The API can be extended by loading UEFI drivers which come in two variants:
491
492 * boot drivers
493 * runtime drivers
494
495 UEFI drivers are installed with U-Boot's bootefi command. With the same command
496 UEFI applications can be executed.
497
498 Loaded images of UEFI drivers stay in memory after returning to U-Boot while
499 loaded images of applications are removed from memory.
500
501 An UEFI application (e.g. an operating system) that wants to take full control
502 of the system calls ExitBootServices. After a UEFI application calls
503 ExitBootServices
504
505 * boot services are not available anymore
506 * timer events are stopped
507 * the memory used by U-Boot except for runtime services is released
508 * the memory used by boot time drivers is released
509
510 So this is a point of no return. Afterwards the UEFI application can only return
511 to U-Boot by rebooting.
512
513 The UEFI object model
514 ---------------------
515
516 UEFI offers a flexible and expandable object model. The objects in the UEFI API
517 are devices, drivers, and loaded images. These objects are referenced by
518 handles.
519
520 The interfaces implemented by the objects are referred to as protocols. These
521 are identified by GUIDs. They can be installed and uninstalled by calling the
522 appropriate boot services.
523
524 Handles are created by the InstallProtocolInterface or the
525 InstallMultipleProtocolinterfaces service if NULL is passed as handle.
526
527 Handles are deleted when the last protocol has been removed with the
528 UninstallProtocolInterface or the UninstallMultipleProtocolInterfaces service.
529
530 Devices offer the EFI_DEVICE_PATH_PROTOCOL. A device path is the concatenation
531 of device nodes. By their device paths all devices of a system are arranged in a
532 tree.
533
534 Drivers offer the EFI_DRIVER_BINDING_PROTOCOL. This protocol is used to connect
535 a driver to devices (which are referenced as controllers in this context).
536
537 Loaded images offer the EFI_LOADED_IMAGE_PROTOCOL. This protocol provides meta
538 information about the image and a pointer to the unload callback function.
539
540 The UEFI events
541 ---------------
542
543 In the UEFI terminology an event is a data object referencing a notification
544 function which is queued for calling when the event is signaled. The following
545 types of events exist:
546
547 * periodic and single shot timer events
548 * exit boot services events, triggered by calling the ExitBootServices() service
549 * virtual address change events
550 * memory map change events
551 * read to boot events
552 * reset system events
553 * system table events
554 * events that are only triggered programmatically
555
556 Events can be created with the CreateEvent service and deleted with CloseEvent
557 service.
558
559 Events can be assigned to an event group. If any of the events in a group is
560 signaled, all other events in the group are also set to the signaled state.
561
562 The UEFI driver model
563 ---------------------
564
565 A driver is specific for a single protocol installed on a device. To install a
566 driver on a device the ConnectController service is called. In this context
567 controller refers to the device for which the driver is installed.
568
569 The relevant drivers are identified using the EFI_DRIVER_BINDING_PROTOCOL. This
570 protocol has has three functions:
571
572 * supported - determines if the driver is compatible with the device
573 * start - installs the driver by opening the relevant protocol with
574   attribute EFI_OPEN_PROTOCOL_BY_DRIVER
575 * stop - uninstalls the driver
576
577 The driver may create child controllers (child devices). E.g. a driver for block
578 IO devices will create the device handles for the partitions. The child
579 controllers  will open the supported protocol with the attribute
580 EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER.
581
582 A driver can be detached from a device using the DisconnectController service.
583
584 U-Boot devices mapped as UEFI devices
585 -------------------------------------
586
587 Some of the U-Boot devices are mapped as UEFI devices
588
589 * block IO devices
590 * console
591 * graphical output
592 * network adapter
593
594 As of U-Boot 2018.03 the logic for doing this is hard coded.
595
596 The development target is to integrate the setup of these UEFI devices with the
597 U-Boot driver model [5]. So when a U-Boot device is discovered a handle should
598 be created and the device path protocol and the relevant IO protocol should be
599 installed. The UEFI driver then would be attached by calling ConnectController.
600 When a U-Boot device is removed DisconnectController should be called.
601
602 UEFI devices mapped as U-Boot devices
603 -------------------------------------
604
605 UEFI drivers binaries and applications may create new (virtual) devices, install
606 a protocol and call the ConnectController service. Now the matching UEFI driver
607 is determined by iterating over the implementations of the
608 EFI_DRIVER_BINDING_PROTOCOL.
609
610 It is the task of the UEFI driver to create a corresponding U-Boot device and to
611 proxy calls for this U-Boot device to the controller.
612
613 In U-Boot 2018.03 this has only been implemented for block IO devices.
614
615 UEFI uclass
616 ~~~~~~~~~~~
617
618 An UEFI uclass driver (lib/efi_driver/efi_uclass.c) has been created that
619 takes care of initializing the UEFI drivers and providing the
620 EFI_DRIVER_BINDING_PROTOCOL implementation for the UEFI drivers.
621
622 A linker created list is used to keep track of the UEFI drivers. To create an
623 entry in the list the UEFI driver uses the U_BOOT_DRIVER macro specifying
624 UCLASS_EFI_LOADER as the ID of its uclass, e.g::
625
626     /* Identify as UEFI driver */
627     U_BOOT_DRIVER(efi_block) = {
628         .name  = "EFI block driver",
629         .id    = UCLASS_EFI_LOADER,
630         .ops   = &driver_ops,
631     };
632
633 The available operations are defined via the structure struct efi_driver_ops::
634
635     struct efi_driver_ops {
636         const efi_guid_t *protocol;
637         const efi_guid_t *child_protocol;
638         int (*bind)(efi_handle_t handle, void *interface);
639     };
640
641 When the supported() function of the EFI_DRIVER_BINDING_PROTOCOL is called the
642 uclass checks if the protocol GUID matches the protocol GUID of the UEFI driver.
643 In the start() function the bind() function of the UEFI driver is called after
644 checking the GUID.
645 The stop() function of the EFI_DRIVER_BINDING_PROTOCOL disconnects the child
646 controllers created by the UEFI driver and the UEFI driver. (In U-Boot v2013.03
647 this is not yet completely implemented.)
648
649 UEFI block IO driver
650 ~~~~~~~~~~~~~~~~~~~~
651
652 The UEFI block IO driver supports devices exposing the EFI_BLOCK_IO_PROTOCOL.
653
654 When connected it creates a new U-Boot block IO device with interface type
655 IF_TYPE_EFI_LOADER, adds child controllers mapping the partitions, and installs
656 the EFI_SIMPLE_FILE_SYSTEM_PROTOCOL on these. This can be used together with the
657 software iPXE to boot from iSCSI network drives [4].
658
659 This driver is only available if U-Boot is configured with::
660
661     CONFIG_BLK=y
662     CONFIG_PARTITIONS=y
663
664 Miscellaneous
665 -------------
666
667 Load file 2 protocol
668 ~~~~~~~~~~~~~~~~~~~~
669
670 The load file 2 protocol can be used by the Linux kernel to load the initial
671 RAM disk. U-Boot can be configured to provide an implementation with::
672
673     EFI_LOAD_FILE2_INITRD=y
674
675 When the option is enabled the user can add the initrd path with the efidebug
676 command.
677
678 Load options Boot#### have a FilePathList[] member.  The first element of
679 the array (FilePathList[0]) is the EFI binary to execute.  When an initrd
680 is specified the Device Path for the initrd is denoted by a VenMedia node
681 with the EFI_INITRD_MEDIA_GUID. Each entry of the array is terminated by the
682 'end of entire device path' subtype (0xff). If a user wants to define multiple
683 initrds, those must by separated by the 'end of this instance' identifier of
684 the end node (0x01).
685
686 So our final format of the FilePathList[] is::
687
688     Loaded image - end node (0xff) - VenMedia - initrd_1 - [end node (0x01) - initrd_n ...] - end node (0xff)
689
690 Links
691 -----
692
693 * [1] http://uefi.org/specifications - UEFI specifications
694 * [2] https://github.com/ARM-software/ebbr/releases/download/v1.0/ebbr-v1.0.pdf -
695   Embedded Base Boot Requirements (EBBR) Specification - Release v1.0
696 * [3] https://developer.arm.com/docs/den0044/latest/server-base-boot-requirements-system-software-on-arm-platforms-version-11 -
697   Server Base Boot Requirements System Software on ARM Platforms - Version 1.1
698 * [4] :doc:`iscsi`
699 * [5] :doc:`../driver-model/index`