[U-Boot] [PATCH v3 00/62] x86: Add initial support for 64-bit U-Boot

Simon Glass sjg at chromium.org
Mon Jan 16 15:03:25 CET 2017


At present U-Boot runs entirely in 32-bit mode on x86, except for the
initial switch from 16-bit mode. On 64-bit machines it is possible to run
in 64-bit mode. This series starts the process of adding this support.

The main benefit of 64-bit mode for a boot loader is direct access to all
available memory. There are also more registers, but this makes very little
difference.

This feature is implemented by putting all of the 32-bit code in an SPL
build. SPL then runs through all the init that has to be done in 32-bit
mode, changes to 64-bit mode and then jumps to U-Boot proper.

Typically the total code size increases slightly. For example, on link in
32-bit mode, U-Boot has around 480KB of code (admittedly with a large
number of features enabled). In 64-bit mode, U-Boot falls to around 460KB,
but SPL adds another 60KB, for a net increase of 40KB. Partly this is due
to code duplication and partly it is due to the worse code density of
64-bit code on x86.

Many major features are not implemented yet, for example:
- SDRAM sizing
- Booting linux
- FSP support
- EFI support
- SCSI device init
- Running video ROMs

Still, this is a big step forward towards full 64-bit support. To enable it,
select CONFIG_X86_RUN_64BIT.

This series is available at u-boot-x86/64-working

Changes in v3:
- update iomux.c and usb_kbd.c also
- Drop WIP tag as this patch is actually needed
- Use tab instead of space in Kconfig help line
- Fix s/32-bit init/16-bit init/ and expand the comment
- Drop unused headers
- Drop unused board_debug_uart_init function
- Use call instead of callq
- Move 'const' change into its own patch
- Add new patch to use static const for the board_f/r init sequences
- Add a TODO to board_init_r() regarding the use of the new_gd parameter
- Mention the commit ID containing information about the need for reloc checks
- Drop the pre-panic printf() of the relocation addresses
- Update copyright year
- Drop duplicate line in header commment
- Add a comment about stack position to x86_spl_init()
- Add a parameter to the use of the SPL_LOAD_IMAGE_METHOD() macro
- Fix printf() warning in spl_board_load_image()
- Drop blank line at end of arch/x86/cpu/x86_64/interrupts.c
- Drop #include of debug_uart.h
- Add a TODO to look at using a fixed register for gd on x86_64
- Expand the TODO about the necessary printch() call
- Add a required debug_uart.h #include in this patch
- Fix 'skipt' typo in the subject
- Put dummy misc_init_r() and print_cpuinfo() functions into cpu.c
- Drop duplicate comment line in header
- Add a TODO indicating that booting 32- and 64-bit kernels should be supported
- Expand pre-reloc malloc() size in this patch to prevent boot failure
- Remove duplicate CONFIG_VIDEO_IVYBRIDGE_IGD in defconfig file
- Drop the unnecessary defconfig changes for chromebook_link
- Drop patch 'x86: Add basic support for U-Boot as a 64-bit EFI application'
- Drop patch 'Mention the MRC region in the README'
- Drop patch 'x86: link: Add build options for SPL'
- Drop unnecessary defconfig options for chromebook_link64
- Avoid including helloworld.efi in the 64-bit U-Boot

Changes in v2:
- Show the error value in spl_spi_load_image()
- Move table-related changes from a later patch
- Rebase to mainline
- Drop the write_smbios_table_wrapper() function
- Drop change to gma.c
- Output error code values in debug() statements
- Fix cast in bd82x6x_video_probe() also
- Fix cast in get_guid_hob_data() also
- Move table-related changes to an earlier patch
- Add the 'val' parameter to longjmp()
- Drop patch 'video: Use ulong for video frame buffer address'
- Add a new 64-bit link config instead of changing the existing one

Simon Glass (62):
  console: Don't enable CONFIG-CONSOLE_MUX, etc. in SPL
  spl: spi: Add a debug message if loading fails
  spl: Makefile: Define SPL_ earlier
  spl: Allow CPU drivers to be used in SPL
  spl: Allow PCI drivers to be used in SPL
  spl: Allow RTC drivers to be used in SPL
  spl: Allow timer drivers to be used in SPL
  spl: Allow PCH drivers to be used in SPL
  spl: Don't create a BSS padding when it is separate
  x86: Use unsigned long for address in table generation
  x86: Update mpspec to build on 64-bit machines
  x86: ivybridge: Declare global data where it is used
  x86: ivybridge: Add more debugging for failures
  x86: ivybridge: Fix types for 64-bit compilation
  x86: dts: Mark serial as needed before relocation
  x86: fsp: Fix cast for 64-bit compilation
  x86: lib: Fix types and casts for 64-bit compilation
  x86: Add Kconfig options to build 64-bit U-Boot
  x86: Kconfig: Add location options for 16/32-bit init
  x86: Use X86_16BIT_INIT instead of X86_RESET_VECTOR
  x86: Use X86_32BIT_INIT instead of X86_RESET_VECTOR
  x86: ivybridge: Allow 32-bit init to move to SPL
  x86: Add 64-bit start-up code
  x86: board_f: Update init sequence for 64-bit startup
  board_f/r: Use static const for the init sequences
  x86: board_r: Set the global data pointer after relocation
  x86: Do relocation before clearing BSS
  x86: Refactor relocation to prepare for 64-bit
  x86: Add support for 64-bit relocation
  x86: Tidy up use of size_t in relocation
  x86: Add an SPL implementation
  x86: Move the i386 code into its own directory
  x86: Add cpu code for x86_64
  x86: Support global_data on x86_64
  x86: Fix up CONFIG_X86_64 check
  x86: Add a link script for 64-bit x86
  x86: Add a link script for SPL
  x86: Add SPL build rules for start-up code
  x86: Fix up byteorder.h for x86_64
  x86: Drop flag_is_changable() on x86_64
  x86: Fix up type sizes for 64-bit
  x86: ivybridge: Skip SATA init in SPL
  x86: ivybridge: Provide a dummy SDRAM init for 64-bit
  x86: Don't try to run the VGA BIOS in 64-bit mode
  x86: Don't build call64 and setjmp on 64-bit
  x86: Don't build cpu files which are not supported on 64-bit
  x86: Don't build 32-bit efi files on x86_64
  x86: Don't try to boot Linux from SPL
  x86: Drop interrupt support in 64-bit mode
  x86: Support jumping from SPL to U-Boot
  x86: Move pirq_routing_table to global_data
  x86: Move turbo_state to global_data
  x86: Change irq_already_routed to a local variable
  x86: Move call64 to the i386 directory
  x86: Move setjmp to the i386 directory
  x86: Add a dummy setjmp implementation for x86_64
  x86: link: Add a text base for 64-bit U-Boot
  x86: link: Add SPL declarations to the binman image
  x86: link: Set up device tree for SPL
  x86: link: Add build options for SPL
  x86: Update compile/link flags to support 64-bit U-Boot
  x86: link: Add a config for 64-bit U-Boot

 Makefile                                        |   7 +-
 arch/x86/Kconfig                                |  86 ++++
 arch/x86/Makefile                               |   9 +-
 arch/x86/config.mk                              |  30 +-
 arch/x86/cpu/Makefile                           |  24 +-
 arch/x86/cpu/config.mk                          |   8 +-
 arch/x86/cpu/cpu.c                              | 504 --------------------
 arch/x86/cpu/i386/Makefile                      |   9 +
 arch/x86/cpu/{ => i386}/call64.S                |   3 +
 arch/x86/cpu/i386/cpu.c                         | 599 ++++++++++++++++++++++++
 arch/x86/cpu/{interrupts.c => i386/interrupt.c} |   6 +-
 arch/x86/cpu/{ => i386}/setjmp.S                |   0
 arch/x86/cpu/intel_common/Makefile              |  10 +-
 arch/x86/cpu/irq.c                              |  14 +-
 arch/x86/cpu/ivybridge/Makefile                 |   9 +-
 arch/x86/cpu/ivybridge/bd82x6x.c                |   2 +
 arch/x86/cpu/ivybridge/cpu.c                    |   4 +-
 arch/x86/cpu/ivybridge/lpc.c                    |   2 +
 arch/x86/cpu/ivybridge/model_206ax.c            |   2 +
 arch/x86/cpu/ivybridge/northbridge.c            |   2 +
 arch/x86/cpu/ivybridge/sata.c                   |   4 +-
 arch/x86/cpu/ivybridge/sdram.c                  |  37 +-
 arch/x86/cpu/ivybridge/sdram_nop.c              |  18 +
 arch/x86/cpu/start64.S                          |  28 ++
 arch/x86/cpu/turbo.c                            |   8 +-
 arch/x86/cpu/u-boot-64.lds                      |  76 +++
 arch/x86/cpu/u-boot-spl.lds                     |  74 +++
 arch/x86/cpu/u-boot.lds                         |   2 +-
 arch/x86/cpu/x86_64/Makefile                    |   6 +
 arch/x86/cpu/x86_64/cpu.c                       |  71 +++
 arch/x86/cpu/x86_64/interrupts.c                |  29 ++
 arch/x86/cpu/x86_64/setjmp.c                    |  20 +
 arch/x86/dts/chromebook_link.dts                |  15 +-
 arch/x86/dts/serial.dtsi                        |   1 +
 arch/x86/dts/u-boot.dtsi                        |  19 +
 arch/x86/include/asm/acpi_table.h               |   2 +-
 arch/x86/include/asm/byteorder.h                |  17 +-
 arch/x86/include/asm/cpu.h                      |  12 +
 arch/x86/include/asm/fsp/fsp_hob.h              |   4 +-
 arch/x86/include/asm/global_data.h              |   9 +-
 arch/x86/include/asm/mp.h                       |   3 +
 arch/x86/include/asm/mpspec.h                   |  10 +-
 arch/x86/include/asm/posix_types.h              |   5 +
 arch/x86/include/asm/sfi.h                      |   2 +-
 arch/x86/include/asm/spl.h                      |   8 +
 arch/x86/include/asm/tables.h                   |   2 +-
 arch/x86/include/asm/types.h                    |   5 +
 arch/x86/lib/Makefile                           |  11 +
 arch/x86/lib/acpi_table.c                       |   4 +-
 arch/x86/lib/bios.c                             |   4 +-
 arch/x86/lib/bootm.c                            |   7 +
 arch/x86/lib/init_helpers.c                     |   2 +-
 arch/x86/lib/interrupts.c                       |   5 +
 arch/x86/lib/mpspec.c                           |  14 +-
 arch/x86/lib/pinctrl_ich6.c                     |   2 +-
 arch/x86/lib/pirq_routing.c                     |  14 +-
 arch/x86/lib/relocate.c                         | 100 +++-
 arch/x86/lib/sfi.c                              |   6 +-
 arch/x86/lib/spl.c                              | 153 ++++++
 arch/x86/lib/tables.c                           |  11 +-
 arch/x86/lib/zimage.c                           |   2 +-
 board/google/Kconfig                            |   7 +
 board/google/chromebook_link/Kconfig            |   5 +-
 board/google/chromebook_link/MAINTAINERS        |   7 +
 common/board_f.c                                |  16 +-
 common/board_r.c                                |  12 +-
 common/console.c                                |  30 +-
 common/iomux.c                                  |   4 +-
 common/spl/Kconfig                              |  47 ++
 common/spl/spl_spi.c                            |   5 +-
 common/usb_kbd.c                                |   6 +-
 configs/chromebook_link64_defconfig             |  89 ++++
 configs/chromebook_link_defconfig               |   4 +-
 drivers/Makefile                                |   5 +
 drivers/misc/qfw.c                              |   4 +-
 drivers/pci/pci_rom.c                           |   2 +-
 drivers/video/ivybridge_igd.c                   |   6 +-
 include/configs/chromebook_link.h               |   9 +
 include/smbios.h                                |   4 +-
 lib/smbios.c                                    |  22 +-
 scripts/Makefile.spl                            |  18 +-
 81 files changed, 1773 insertions(+), 681 deletions(-)
 create mode 100644 arch/x86/cpu/i386/Makefile
 rename arch/x86/cpu/{ => i386}/call64.S (98%)
 create mode 100644 arch/x86/cpu/i386/cpu.c
 rename arch/x86/cpu/{interrupts.c => i386/interrupt.c} (99%)
 rename arch/x86/cpu/{ => i386}/setjmp.S (100%)
 create mode 100644 arch/x86/cpu/ivybridge/sdram_nop.c
 create mode 100644 arch/x86/cpu/start64.S
 create mode 100644 arch/x86/cpu/u-boot-64.lds
 create mode 100644 arch/x86/cpu/u-boot-spl.lds
 create mode 100644 arch/x86/cpu/x86_64/Makefile
 create mode 100644 arch/x86/cpu/x86_64/cpu.c
 create mode 100644 arch/x86/cpu/x86_64/interrupts.c
 create mode 100644 arch/x86/cpu/x86_64/setjmp.c
 create mode 100644 arch/x86/include/asm/spl.h
 create mode 100644 arch/x86/lib/spl.c
 create mode 100644 configs/chromebook_link64_defconfig

-- 
2.11.0.483.g087da7b7c-goog



More information about the U-Boot mailing list