blob: f67216d6ce020a39cfa80360e7ecf932f827d1a5 [file] [log] [blame]
Bin Meng89ad2bb2019-07-18 00:34:26 -07001.. SPDX-License-Identifier: GPL-2.0+
2.. Copyright (C) 2014, Simon Glass <sjg@chromium.org>
3.. Copyright (C) 2014, Bin Meng <bmeng.cn@gmail.com>
Bin Meng9e816df2014-12-17 15:50:48 +08004
Bin Meng89ad2bb2019-07-18 00:34:26 -07005x86
6===
Bin Meng9e816df2014-12-17 15:50:48 +08007
8This document describes the information about U-Boot running on x86 targets,
9including supported boards, build instructions, todo list, etc.
10
11Status
12------
Bin Meng89ad2bb2019-07-18 00:34:26 -070013U-Boot supports running as a `coreboot`_ payload on x86. So far only Link
Simon Glass273d08f2023-09-21 07:37:45 -060014(Chromebook Pixel), Brya (Alder Lake Chromebook) and `QEMU`_ x86 targets have
15been tested, but it should work with minimal adjustments on other x86 boards
16since coreboot deals with most of the low-level details.
Bin Meng9e816df2014-12-17 15:50:48 +080017
Andy Shevchenkod31315d2017-07-06 14:41:53 +030018U-Boot is a main bootloader on Intel Edison board.
19
Stoppa, Igorc0e91a62015-08-13 16:43:35 +030020U-Boot also supports booting directly from x86 reset vector, without coreboot.
21In this case, known as bare mode, from the fact that it runs on the
Simon Glass2b416fd2016-03-11 22:07:33 -070022'bare metal', U-Boot acts like a BIOS replacement. The following platforms
23are supported:
24
Bin Meng0dbbf102016-05-07 07:46:36 -070025 - Bayley Bay CRB
Bin Meng4ba75702017-08-15 22:42:02 -070026 - Cherry Hill CRB
Bin Meng0dbbf102016-05-07 07:46:36 -070027 - Congatec QEVAL 2.0 & conga-QA3/E3845
Simon Glass84a49ca2023-09-07 09:58:21 -060028 - Coral (Apollo Lake - Chromebook 2017)
Simon Glass2b416fd2016-03-11 22:07:33 -070029 - Cougar Canyon 2 CRB
30 - Crown Bay CRB
31 - Galileo
Simon Glass84a49ca2023-09-07 09:58:21 -060032 - Link (Ivy Bridge - Chromebook Pixel)
Simon Glass2b416fd2016-03-11 22:07:33 -070033 - Minnowboard MAX
Simon Glass84a49ca2023-09-07 09:58:21 -060034 - Samus (Broadwell - Chromebook Pixel 2015)
Simon Glass273d08f2023-09-21 07:37:45 -060035 - Coral (Apollo Lake Chromebooks circa 2017)
Bin Meng0d873632018-10-13 20:52:03 -070036 - QEMU x86 (32-bit & 64-bit)
Bin Meng9e816df2014-12-17 15:50:48 +080037
Simon Glass4a56f102015-01-27 22:13:47 -070038As for loading an OS, U-Boot supports directly booting a 32-bit or 64-bit
39Linux kernel as part of a FIT image. It also supports a compressed zImage.
Bin Meng6ab240d2015-10-07 20:19:20 -070040U-Boot supports loading an x86 VxWorks kernel. Please check README.vxworks
Simon Glass273d08f2023-09-21 07:37:45 -060041for more details. Finally, U-Boot can boot Linux distributions with a UEFI
42interface.
Bin Meng9e816df2014-12-17 15:50:48 +080043
Stoppa, Igorc0e91a62015-08-13 16:43:35 +030044Build Instructions for U-Boot as BIOS replacement (bare mode)
45-------------------------------------------------------------
Simon Glass4a56f102015-01-27 22:13:47 -070046Building a ROM version of U-Boot (hereafter referred to as u-boot.rom) is a
Bin Meng9e816df2014-12-17 15:50:48 +080047little bit tricky, as generally it requires several binary blobs which are not
Bin Meng7378a6f2021-07-27 23:15:39 +080048shipped in the U-Boot source tree. Due to this reason, the u-boot.rom build may
49print some warnings if required binary blobs (e.g.: FSP) are not present.
Bin Meng9e816df2014-12-17 15:50:48 +080050
Bin Meng9e816df2014-12-17 15:50:48 +080051CPU Microcode
52-------------
Bin Meng89ad2bb2019-07-18 00:34:26 -070053Modern CPUs usually require a special bit stream called `microcode`_ to be
Bin Meng9e816df2014-12-17 15:50:48 +080054loaded on the processor after power up in order to function properly. U-Boot
55has already integrated these as hex dumps in the source tree.
56
Bin Meng5a866522015-06-23 12:18:53 +080057SMP Support
58-----------
59On a multicore system, U-Boot is executed on the bootstrap processor (BSP).
60Additional application processors (AP) can be brought up by U-Boot. In order to
61have an SMP kernel to discover all of the available processors, U-Boot needs to
62prepare configuration tables which contain the multi-CPUs information before
63loading the OS kernel. Currently U-Boot supports generating two types of tables
Bin Meng89ad2bb2019-07-18 00:34:26 -070064for SMP, called Simple Firmware Interface (`SFI`_) and Multi-Processor (`MP`_)
65tables. The writing of these two tables are controlled by two Kconfig
Bin Meng45e3e812015-07-06 16:31:35 +080066options GENERATE_SFI_TABLE and GENERATE_MP_TABLE.
Bin Meng5a866522015-06-23 12:18:53 +080067
Bin Meng9e816df2014-12-17 15:50:48 +080068Driver Model
69------------
Simon Glass2b416fd2016-03-11 22:07:33 -070070x86 has been converted to use driver model for serial, GPIO, SPI, SPI flash,
71keyboard, real-time clock, USB. Video is in progress.
Bin Meng9e816df2014-12-17 15:50:48 +080072
73Device Tree
74-----------
75x86 uses device tree to configure the board thus requires CONFIG_OF_CONTROL to
Bin Meng6c6ec432015-01-06 22:14:24 +080076be turned on. Not every device on the board is configured via device tree, but
Bin Meng9e816df2014-12-17 15:50:48 +080077more and more devices will be added as time goes by. Check out the directory
78arch/x86/dts/ for these device tree source files.
79
Simon Glassfc0ba2d2015-01-01 16:18:15 -070080Useful Commands
81---------------
Simon Glassfc0ba2d2015-01-01 16:18:15 -070082In keeping with the U-Boot philosophy of providing functions to check and
83adjust internal settings, there are several x86-specific commands that may be
84useful:
85
Bin Meng89ad2bb2019-07-18 00:34:26 -070086fsp
87 Display information about Intel Firmware Support Package (FSP).
88 This is only available on platforms which use FSP, mostly Atom.
89iod
90 Display I/O memory
91iow
92 Write I/O memory
93mtrr
94 List and set the Memory Type Range Registers (MTRR). These are used to
95 tell the CPU whether memory is cacheable and if so the cache write
96 mode to use. U-Boot sets up some reasonable values but you can
97 adjust then with this command.
Simon Glassfc0ba2d2015-01-01 16:18:15 -070098
Simon Glassc05168f2015-07-27 15:47:31 -060099Booting Ubuntu
100--------------
Simon Glass5382c9b2023-09-19 21:00:20 -0600101Typically U-Boot boots distributions automatically so long an `CONFIG_BOOTSTD`,
102`CONFIG_BOOTSTD_DEFAULTS` and `CONFIG_EFI_LOADER` are enabled. See
103:doc:`manual_boot` for how to do this manually.
Sam Protsenkobd7bffe2017-08-14 20:22:17 +0300104
Bin Meng2e266822016-02-28 23:54:52 -0800105Test with SeaBIOS
106-----------------
Bin Meng89ad2bb2019-07-18 00:34:26 -0700107`SeaBIOS`_ is an open source implementation of a 16-bit x86 BIOS. It can run
Bin Meng2e266822016-02-28 23:54:52 -0800108in an emulator or natively on x86 hardware with the use of U-Boot. With its
109help, we can boot some OSes that require 16-bit BIOS services like Windows/DOS.
110
111As U-Boot, we have to manually create a table where SeaBIOS gets various system
112information (eg: E820) from. The table unfortunately has to follow the coreboot
113table format as SeaBIOS currently supports booting as a coreboot payload.
114
115To support loading SeaBIOS, U-Boot should be built with CONFIG_SEABIOS on.
Bin Meng89ad2bb2019-07-18 00:34:26 -0700116Booting SeaBIOS is done via U-Boot's bootelf command, like below::
Bin Meng2e266822016-02-28 23:54:52 -0800117
118 => tftp bios.bin.elf;bootelf
119 Using e1000#0 device
120 TFTP from server 10.10.0.100; our IP address is 10.10.0.108
121 ...
Bin Meng58e58cd2021-08-03 20:50:04 +0800122 Bytes transferred = 128748 (1f6ec hex)
123 ## Starting application at 0x000fd269 ...
124 SeaBIOS (version rel-1.14.0-0-g155821a)
Bin Meng2e266822016-02-28 23:54:52 -0800125 ...
126
Bin Meng58e58cd2021-08-03 20:50:04 +0800127bios.bin.elf is the SeaBIOS image built from SeaBIOS source tree. At the time
128being, SeaBIOS release 1.14.0 has been tested. To build the SeaBIOS image::
Bin Meng2e266822016-02-28 23:54:52 -0800129
Bin Meng58e58cd2021-08-03 20:50:04 +0800130 $ echo -e 'CONFIG_COREBOOT=y\nCONFIG_COREBOOT_FLASH=n\nCONFIG_DEBUG_SERIAL=y\nCONFIG_DEBUG_COREBOOT=n' > .config
131 $ make olddefconfig
Bin Meng2e266822016-02-28 23:54:52 -0800132 $ make
133 ...
Bin Meng58e58cd2021-08-03 20:50:04 +0800134 Total size: 128512 Fixed: 69216 Free: 2560 (used 98.0% of 128KiB rom)
Bin Meng2e266822016-02-28 23:54:52 -0800135 Creating out/bios.bin.elf
136
137Currently this is tested on QEMU x86 target with U-Boot chain-loading SeaBIOS
138to install/boot a Windows XP OS (below for example command to install Windows).
139
Bin Meng89ad2bb2019-07-18 00:34:26 -0700140.. code-block:: none
141
Bin Meng2e266822016-02-28 23:54:52 -0800142 # Create a 10G disk.img as the virtual hard disk
143 $ qemu-img create -f qcow2 disk.img 10G
144
145 # Install a Windows XP OS from an ISO image 'winxp.iso'
146 $ qemu-system-i386 -serial stdio -bios u-boot.rom -hda disk.img -cdrom winxp.iso -smp 2 -m 512
147
148 # Boot a Windows XP OS installed on the virutal hard disk
149 $ qemu-system-i386 -serial stdio -bios u-boot.rom -hda disk.img -smp 2 -m 512
150
151This is also tested on Intel Crown Bay board with a PCIe graphics card, booting
152SeaBIOS then chain-loading a GRUB on a USB drive, then Linux kernel finally.
153
Bin Mengd5eed0d2016-05-11 07:45:06 -0700154If you are using Intel Integrated Graphics Device (IGD) as the primary display
155device on your board, SeaBIOS needs to be patched manually to get its VGA ROM
156loaded and run by SeaBIOS. SeaBIOS locates VGA ROM via the PCI expansion ROM
157register, but IGD device does not have its VGA ROM mapped by this register.
158Its VGA ROM is packaged as part of u-boot.rom at a configurable flash address
159which is unknown to SeaBIOS. An example patch is needed for SeaBIOS below:
160
Bin Meng89ad2bb2019-07-18 00:34:26 -0700161.. code-block:: none
162
163 diff --git a/src/optionroms.c b/src/optionroms.c
164 index 65f7fe0..c7b6f5e 100644
165 --- a/src/optionroms.c
166 +++ b/src/optionroms.c
167 @@ -324,6 +324,8 @@ init_pcirom(struct pci_device *pci, int isvga, u64 *sources)
168 rom = deploy_romfile(file);
169 else if (RunPCIroms > 1 || (RunPCIroms == 1 && isvga))
170 rom = map_pcirom(pci);
171 + if (pci->bdf == pci_to_bdf(0, 2, 0))
172 + rom = (struct rom_header *)0xfff90000;
173 if (! rom)
174 // No ROM present.
175 return;
Bin Mengd5eed0d2016-05-11 07:45:06 -0700176
177Note: the patch above expects IGD device is at PCI b.d.f 0.2.0 and its VGA ROM
178is at 0xfff90000 which corresponds to CONFIG_VGA_BIOS_ADDR on Minnowboard MAX.
179Change these two accordingly if this is not the case on your board.
Simon Glassc05168f2015-07-27 15:47:31 -0600180
Simon Glass5c840ef2015-01-27 22:13:46 -0700181Development Flow
182----------------
Simon Glass5c840ef2015-01-27 22:13:46 -0700183These notes are for those who want to port U-Boot to a new x86 platform.
184
185Since x86 CPUs boot from SPI flash, a SPI flash emulator is a good investment.
Bin Meng89ad2bb2019-07-18 00:34:26 -0700186The Dediprog em100 can be used on Linux.
Simon Glass5c840ef2015-01-27 22:13:46 -0700187
Bin Meng89ad2bb2019-07-18 00:34:26 -0700188The em100 tool is available here: http://review.coreboot.org/p/em100.git
Simon Glass5c840ef2015-01-27 22:13:46 -0700189
Bin Meng89ad2bb2019-07-18 00:34:26 -0700190On Minnowboard Max the following command line can be used::
Simon Glass5c840ef2015-01-27 22:13:46 -0700191
192 sudo em100 -s -p LOW -d u-boot.rom -c W25Q64DW -r
193
194A suitable clip for connecting over the SPI flash chip is here:
Bin Meng89ad2bb2019-07-18 00:34:26 -0700195http://www.dediprog.com/pd/programmer-accessories/EM-TC-8.
Simon Glass5c840ef2015-01-27 22:13:46 -0700196
197This allows you to override the SPI flash contents for development purposes.
198Typically you can write to the em100 in around 1200ms, considerably faster
199than programming the real flash device each time. The only important
200limitation of the em100 is that it only supports SPI bus speeds up to 20MHz.
201This means that images must be set to boot with that speed. This is an
202Intel-specific feature - e.g. tools/ifttool has an option to set the SPI
203speed in the SPI descriptor region.
204
205If your chip/board uses an Intel Firmware Support Package (FSP) it is fairly
206easy to fit it in. You can follow the Minnowboard Max implementation, for
207example. Hopefully you will just need to create new files similar to those
208in arch/x86/cpu/baytrail which provide Bay Trail support.
209
210If you are not using an FSP you have more freedom and more responsibility.
211The ivybridge support works this way, although it still uses a ROM for
212graphics and still has binary blobs containing Intel code. You should aim to
213support all important peripherals on your platform including video and storage.
214Use the device tree for configuration where possible.
215
216For the microcode you can create a suitable device tree file using the
Bin Meng89ad2bb2019-07-18 00:34:26 -0700217microcode tool::
Simon Glass5c840ef2015-01-27 22:13:46 -0700218
Bin Meng89ad2bb2019-07-18 00:34:26 -0700219 ./tools/microcode-tool -d microcode.dat -m <model> create
Simon Glass5c840ef2015-01-27 22:13:46 -0700220
Bin Meng89ad2bb2019-07-18 00:34:26 -0700221or if you only have header files and not the full Intel microcode.dat database::
Simon Glass5c840ef2015-01-27 22:13:46 -0700222
Bin Meng89ad2bb2019-07-18 00:34:26 -0700223 ./tools/microcode-tool -H BAY_TRAIL_FSP_KIT/Microcode/M0130673322.h \
224 -H BAY_TRAIL_FSP_KIT/Microcode/M0130679901.h -m all create
Simon Glass5c840ef2015-01-27 22:13:46 -0700225
226These are written to arch/x86/dts/microcode/ by default.
227
228Note that it is possible to just add the micrcode for your CPU if you know its
Bin Meng89ad2bb2019-07-18 00:34:26 -0700229model. U-Boot prints this information when it starts::
Simon Glass5c840ef2015-01-27 22:13:46 -0700230
231 CPU: x86_64, vendor Intel, device 30673h
232
233so here we can use the M0130673322 file.
234
235If you platform can display POST codes on two little 7-segment displays on
236the board, then you can use post_code() calls from C or assembler to monitor
237boot progress. This can be good for debugging.
238
239If not, you can try to get serial working as early as possible. The early
Stefan Roesea377b7c2016-01-19 14:24:12 +0100240debug serial port may be useful here. See setup_internal_uart() for an example.
Simon Glass5c840ef2015-01-27 22:13:46 -0700241
Bin Mengcdee6d92015-08-02 20:33:35 -0700242During the U-Boot porting, one of the important steps is to write correct PIRQ
243routing information in the board device tree. Without it, device drivers in the
244Linux kernel won't function correctly due to interrupt is not working. Please
Bin Meng89ad2bb2019-07-18 00:34:26 -0700245refer to U-Boot `doc <doc/device-tree-bindings/misc/intel,irq-router.txt>`_ for
246the device tree bindings of Intel interrupt router. Here we have more details
247on the intel,pirq-routing property below.
248
249.. code-block:: none
Bin Mengcdee6d92015-08-02 20:33:35 -0700250
251 intel,pirq-routing = <
252 PCI_BDF(0, 2, 0) INTA PIRQA
253 ...
254 >;
255
256As you see each entry has 3 cells. For the first one, we need describe all pci
257devices mounted on the board. For SoC devices, normally there is a chapter on
258the chipset datasheet which lists all the available PCI devices. For example on
259Bay Trail, this is chapter 4.3 (PCI configuration space). For the second one, we
260can get the interrupt pin either from datasheet or hardware via U-Boot shell.
261The reliable source is the hardware as sometimes chipset datasheet is not 100%
262up-to-date. Type 'pci header' plus the device's pci bus/device/function number
Bin Meng89ad2bb2019-07-18 00:34:26 -0700263from U-Boot shell below::
Bin Mengcdee6d92015-08-02 20:33:35 -0700264
265 => pci header 0.1e.1
266 vendor ID = 0x8086
267 device ID = 0x0f08
268 ...
269 interrupt line = 0x09
270 interrupt pin = 0x04
271 ...
272
273It shows this PCI device is using INTD pin as it reports 4 in the interrupt pin
274register. Repeat this until you get interrupt pins for all the devices. The last
275cell is the PIRQ line which a particular interrupt pin is mapped to. On Intel
276chipset, the power-up default mapping is INTA/B/C/D maps to PIRQA/B/C/D. This
277can be changed by registers in LPC bridge. So far Intel FSP does not touch those
278registers so we can write down the PIRQ according to the default mapping rule.
279
280Once we get the PIRQ routing information in the device tree, the interrupt
281allocation and assignment will be done by U-Boot automatically. Now you can
282enable CONFIG_GENERATE_PIRQ_TABLE for testing Linux kernel using i8259 PIC and
283CONFIG_GENERATE_MP_TABLE for testing Linux kernel using local APIC and I/O APIC.
284
Simon Glasse3170a12015-08-13 10:36:17 -0600285This script might be useful. If you feed it the output of 'pci long' from
286U-Boot then it will generate a device tree fragment with the interrupt
Bin Meng89ad2bb2019-07-18 00:34:26 -0700287configuration for each device (note it needs gawk 4.0.0)::
Simon Glasse3170a12015-08-13 10:36:17 -0600288
289 $ cat console_output |awk '/PCI/ {device=$4} /interrupt line/ {line=$4} \
290 /interrupt pin/ {pin = $4; if (pin != "0x00" && pin != "0xff") \
291 {patsplit(device, bdf, "[0-9a-f]+"); \
292 printf "PCI_BDF(%d, %d, %d) INT%c PIRQ%c\n", strtonum("0x" bdf[1]), \
293 strtonum("0x" bdf[2]), bdf[3], strtonum(pin) + 64, 64 + strtonum(pin)}}'
294
Bin Meng89ad2bb2019-07-18 00:34:26 -0700295Example output::
296
Simon Glasse3170a12015-08-13 10:36:17 -0600297 PCI_BDF(0, 2, 0) INTA PIRQA
298 PCI_BDF(0, 3, 0) INTA PIRQA
Bin Meng89ad2bb2019-07-18 00:34:26 -0700299 ...
Simon Glasse3170a12015-08-13 10:36:17 -0600300
Bin Meng213f6f02015-09-09 23:20:29 -0700301Porting Hints
302-------------
303
Bin Meng89ad2bb2019-07-18 00:34:26 -0700304Quark-specific considerations
305^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Bin Meng213f6f02015-09-09 23:20:29 -0700306
307To port U-Boot to other boards based on the Intel Quark SoC, a few things need
308to be taken care of. The first important part is the Memory Reference Code (MRC)
309parameters. Quark MRC supports memory-down configuration only. All these MRC
310parameters are supplied via the board device tree. To get started, first copy
311the MRC section of arch/x86/dts/galileo.dts to your board's device tree, then
312change these values by consulting board manuals or your hardware vendor.
313Available MRC parameter values are listed in include/dt-bindings/mrc/quark.h.
314The other tricky part is with PCIe. Quark SoC integrates two PCIe root ports,
315but by default they are held in reset after power on. In U-Boot, PCIe
316initialization is properly handled as per Quark's firmware writer guide.
317In your board support codes, you need provide two routines to aid PCIe
318initialization, which are board_assert_perst() and board_deassert_perst().
319The two routines need implement a board-specific mechanism to assert/deassert
320PCIe PERST# pin. Care must be taken that in those routines that any APIs that
321may trigger PCI enumeration process are strictly forbidden, as any access to
322PCIe root port's configuration registers will cause system hang while it is
323held in reset. For more details, check how they are implemented by the Intel
324Galileo board support codes in board/intel/galileo/galileo.c.
325
Bin Meng89ad2bb2019-07-18 00:34:26 -0700326coreboot
327^^^^^^^^
Simon Glass15318f22016-03-06 19:28:17 -0700328
329See scripts/coreboot.sed which can assist with porting coreboot code into
330U-Boot drivers. It will not resolve all build errors, but will perform common
331transformations. Remember to add attribution to coreboot for new files added
332to U-Boot. This should go at the top of each file and list the coreboot
333filename where the code originated.
334
Bin Meng89ad2bb2019-07-18 00:34:26 -0700335Debugging ACPI issues with Windows
336^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Bin Mengf2071ba2016-05-11 07:45:12 -0700337
338Windows might cache system information and only detect ACPI changes if you
339modify the ACPI table versions. So tweak them liberally when debugging ACPI
340issues with Windows.
341
Bin Meng4258f802016-05-07 07:46:37 -0700342ACPI Support Status
343-------------------
Bin Meng89ad2bb2019-07-18 00:34:26 -0700344Advanced Configuration and Power Interface (`ACPI`_) aims to establish
Bin Meng4258f802016-05-07 07:46:37 -0700345industry-standard interfaces enabling OS-directed configuration, power
346management, and thermal management of mobile, desktop, and server platforms.
347
348Linux can boot without ACPI with "acpi=off" command line parameter, but
349with ACPI the kernel gains the capabilities to handle power management.
350For Windows, ACPI is a must-have firmware feature since Windows Vista.
351CONFIG_GENERATE_ACPI_TABLE is the config option to turn on ACPI support in
352U-Boot. This requires Intel ACPI compiler to be installed on your host to
353compile ACPI DSDT table written in ASL format to AML format. You can get
354the compiler via "apt-get install iasl" if you are on Ubuntu or download
Bin Meng89ad2bb2019-07-18 00:34:26 -0700355the source from https://www.acpica.org/downloads to compile one by yourself.
Bin Meng4258f802016-05-07 07:46:37 -0700356
Bin Meng487b8e82017-04-21 07:24:49 -0700357Current ACPI support in U-Boot is basically complete. More optional features
358can be added in the future. The status as of today is:
Bin Meng4258f802016-05-07 07:46:37 -0700359
360 * Support generating RSDT, XSDT, FACS, FADT, MADT, MCFG tables.
361 * Support one static DSDT table only, compiled by Intel ACPI compiler.
Bin Meng487b8e82017-04-21 07:24:49 -0700362 * Support S0/S3/S4/S5, reboot and shutdown from OS.
Bin Meng4258f802016-05-07 07:46:37 -0700363 * Support booting a pre-installed Ubuntu distribution via 'zboot' command.
Bin Meng65b2e9e2016-05-11 07:45:08 -0700364 * Support installing and booting Ubuntu 14.04 (or above) from U-Boot with
365 the help of SeaBIOS using legacy interface (non-UEFI mode).
366 * Support installing and booting Windows 8.1/10 from U-Boot with the help
367 of SeaBIOS using legacy interface (non-UEFI mode).
Bin Meng4258f802016-05-07 07:46:37 -0700368 * Support ACPI interrupts with SCI only.
369
Bin Meng4258f802016-05-07 07:46:37 -0700370Features that are optional:
Bin Meng89ad2bb2019-07-18 00:34:26 -0700371
Bin Meng4258f802016-05-07 07:46:37 -0700372 * Dynamic AML bytecodes insertion at run-time. We may need this to support
373 SSDT table generation and DSDT fix up.
374 * SMI support. Since U-Boot is a modern bootloader, we don't want to bring
375 those legacy stuff into U-Boot. ACPI spec allows a system that does not
376 support SMI (a legacy-free system).
377
Bin Mengedf82402016-05-25 19:19:12 -0700378ACPI was initially enabled on BayTrail based boards. Testing was done by booting
Bin Meng65b2e9e2016-05-11 07:45:08 -0700379a pre-installed Ubuntu 14.04 from a SATA drive. Installing Ubuntu 14.04 and
380Windows 8.1/10 to a SATA drive and booting from there is also tested. Most
381devices seem to work correctly and the board can respond a reboot/shutdown
382command from the OS.
Simon Glass15318f22016-03-06 19:28:17 -0700383
Bin Mengedf82402016-05-25 19:19:12 -0700384For other platform boards, ACPI support status can be checked by examining their
385board defconfig files to see if CONFIG_GENERATE_ACPI_TABLE is set to y.
386
Bin Meng487b8e82017-04-21 07:24:49 -0700387The S3 sleeping state is a low wake latency sleeping state defined by ACPI
388spec where all system context is lost except system memory. To test S3 resume
389with a Linux kernel, simply run "echo mem > /sys/power/state" and kernel will
390put the board to S3 state where the power is off. So when the power button is
391pressed again, U-Boot runs as it does in cold boot and detects the sleeping
392state via ACPI register to see if it is S3, if yes it means we are waking up.
393U-Boot is responsible for restoring the machine state as it is before sleep.
394When everything is done, U-Boot finds out the wakeup vector provided by OSes
395and jump there. To determine whether ACPI S3 resume is supported, check to
396see if CONFIG_HAVE_ACPI_RESUME is set for that specific board.
397
398Note for testing S3 resume with Windows, correct graphics driver must be
399installed for your platform, otherwise you won't find "Sleep" option in
400the "Power" submenu from the Windows start menu.
401
Simon Glass669881b2016-07-17 01:23:45 -0600402EFI Support
403-----------
404U-Boot supports booting as a 32-bit or 64-bit EFI payload, e.g. with UEFI.
Bin Meng706db822018-06-12 08:36:13 -0700405This is enabled with CONFIG_EFI_STUB to boot from both 32-bit and 64-bit
406UEFI BIOS. U-Boot can also run as an EFI application, with CONFIG_EFI_APP.
Bin Meng9cf307a2018-06-27 20:38:05 -0700407The CONFIG_EFI_LOADER option, where U-Boot provides an EFI environment to
Bin Meng706db822018-06-12 08:36:13 -0700408the kernel (i.e. replaces UEFI completely but provides the same EFI run-time
Bin Meng9cf307a2018-06-27 20:38:05 -0700409services) is supported too. For example, we can even use 'bootefi' command
410to load a 'u-boot-payload.efi', see below test logs on QEMU.
411
Bin Meng89ad2bb2019-07-18 00:34:26 -0700412.. code-block:: none
413
Bin Meng9cf307a2018-06-27 20:38:05 -0700414 => load ide 0 3000000 u-boot-payload.efi
415 489787 bytes read in 138 ms (3.4 MiB/s)
416 => bootefi 3000000
417 Scanning disk ide.blk#0...
418 Found 2 disks
419 WARNING: booting without device tree
420 ## Starting EFI application at 03000000 ...
421 U-Boot EFI Payload
422
423
424 U-Boot 2018.07-rc2 (Jun 23 2018 - 17:12:58 +0800)
425
426 CPU: x86_64, vendor AMD, device 663h
427 DRAM: 2 GiB
428 MMC:
429 Video: 1024x768x32
430 Model: EFI x86 Payload
431 Net: e1000: 52:54:00:12:34:56
432
433 Warning: e1000#0 using MAC address from ROM
434 eth0: e1000#0
435 No controllers found
436 Hit any key to stop autoboot: 0
Simon Glass669881b2016-07-17 01:23:45 -0600437
Simon Glass2bf76a72023-09-19 21:00:18 -0600438See :doc:`../../develop/uefi/u-boot_on_efi` and :doc:`../../develop/uefi/uefi`
439for details of EFI support in U-Boot.
Simon Glass669881b2016-07-17 01:23:45 -0600440
Simon Glass802d88e2020-04-26 09:13:01 -0600441Chain-loading
442-------------
Simon Glass273d08f2023-09-21 07:37:45 -0600443U-Boot can be chain-loaded from another bootloader, such as
444:doc:`../../board/coreboot/index` coreboot or
445:doc:`../../board/intel/slimbootloader`. Typically this is done by building for
446targets 'coreboot' or 'slimbootloader'.
Simon Glass802d88e2020-04-26 09:13:01 -0600447
448For example, at present we have a 'coreboot' target but this runs very
449different code from the bare-metal targets, such as coral. There is very little
450in common between them.
451
452It is useful to be able to boot the same U-Boot on a device, with or without a
453first-stage bootloader. For example, with chromebook_coral, it is helpful for
454testing to be able to boot the same U-Boot (complete with FSP) on bare metal
455and from coreboot. It allows checking of things like CPU speed, comparing
456registers, ACPI tables and the like.
457
458To do this you can use ll_boot_init() in appropriate places to skip init that
459has already been done by the previous stage. This works by setting a
460GD_FLG_NO_LL_INIT flag when U-Boot detects that it is running from another
461bootloader.
462
463With this feature, you can build a bare-metal target and boot it from
464coreboot, for example.
465
466Note that this is a development feature only. It is not intended for use in
467production environments. Also it is not currently part of the automated tests
468so may break in the future.
469
Simon Glass31d187d2020-11-05 06:32:10 -0700470SMBIOS tables
471-------------
472
473To generate SMBIOS tables in U-Boot, for use by the OS, enable the
474CONFIG_GENERATE_SMBIOS_TABLE option. The easiest way to provide the values to
475use is via the device tree. For details see
Simon Glass2bf76a72023-09-19 21:00:18 -0600476:download:`smbios.txt <../../device-tree-bindings/sysinfo/smbios.txt>`.
Simon Glass31d187d2020-11-05 06:32:10 -0700477
Bin Meng9e816df2014-12-17 15:50:48 +0800478TODO List
479---------
Bin Meng9e816df2014-12-17 15:50:48 +0800480- Audio
481- Chrome OS verified boot
Bin Meng9e816df2014-12-17 15:50:48 +0800482
Bin Meng89ad2bb2019-07-18 00:34:26 -0700483.. _coreboot: http://www.coreboot.org
484.. _QEMU: http://www.qemu.org
485.. _microcode: http://en.wikipedia.org/wiki/Microcode
486.. _SFI: http://simplefirmware.org
487.. _MP: http://www.intel.com/design/archives/processors/pro/docs/242016.htm
Bin Meng89ad2bb2019-07-18 00:34:26 -0700488.. _SeaBIOS: http://www.seabios.org/SeaBIOS
489.. _ACPI: http://www.acpi.info