Merge patch series "Resolve issues with booting distros on x86"

Simon Glass <sjg@chromium.org> says:

This little series reprises the EFI-video fix, fixes a USB problem and
enables a boot script for coreboot.

It also moves to truetype fonts for coreboot and qemu-x86, since the
menus look much better and there are no strong size constraints.

With these changes it is possible to boot a Linux distro automatically
with U-Boot on x86, including when U-Boot is the second-stage
bootloader.
This commit is contained in:
Tom Rini 2024-04-10 20:01:42 -06:00
commit a691594241
12 changed files with 63 additions and 10 deletions

View file

@ -723,6 +723,14 @@ config ROM_TABLE_SIZE
hex
default 0x10000
config X86_HARDFP
bool "Support hardware floating point"
help
U-Boot generally does not make use of floating point. Where this is
needed, it can be enabled using this option. This adjusts the
start-up code for 64-bit mode and changes the compiler options for
64-bit to enable SSE.
config HAVE_ITSS
bool "Enable ITSS"
help

View file

@ -27,9 +27,13 @@ ifeq ($(IS_32BIT),y)
PLATFORM_CPPFLAGS += -march=i386 -m32
else
PLATFORM_CPPFLAGS += $(if $(CONFIG_SPL_BUILD),,-fpic) -fno-common -march=core2 -m64
ifndef CONFIG_X86_HARDFP
PLATFORM_CPPFLAGS += -mno-mmx -mno-sse
endif
endif # IS_32BIT
PLATFORM_RELFLAGS += -fdata-sections -ffunction-sections -fvisibility=hidden
KBUILD_LDFLAGS += -Bsymbolic -Bsymbolic-functions

View file

@ -10,6 +10,7 @@
#include <init.h>
#include <asm/cpu.h>
#include <asm/global_data.h>
#include <asm/processor-flags.h>
DECLARE_GLOBAL_DATA_PTR;
@ -39,11 +40,22 @@ int x86_mp_init(void)
return 0;
}
/* enable SSE features for hardware floating point */
static void setup_sse_features(void)
{
asm ("mov %%cr4, %%rax\n" \
"or %0, %%rax\n" \
"mov %%rax, %%cr4\n" \
: : "i" (X86_CR4_OSFXSR | X86_CR4_OSXMMEXCPT) : "eax");
}
int x86_cpu_reinit_f(void)
{
/* set the vendor to Intel so that native_calibrate_tsc() works */
gd->arch.x86_vendor = X86_VENDOR_INTEL;
gd->arch.has_mtrr = true;
if (IS_ENABLED(CONFIG_X86_HARDFP))
setup_sse_features();
return 0;
}

View file

@ -46,6 +46,16 @@
compatible = "coreboot-fb";
};
bootstd {
compatible = "u-boot,boot-std";
theme {
font-size = <30>;
menu-inset = <3>;
menuitem-gap-y = <1>;
};
};
sysinfo {
compatible = "coreboot,sysinfo";
};

View file

@ -18,7 +18,8 @@ config BOARD_SPECIFIC_OPTIONS # dummy
select X86_RESET_VECTOR
select QEMU
select QFW_PIO if CMD_QFW
select BOARD_ROMSIZE_KB_1024
select BOARD_ROMSIZE_KB_1024 if TARGET_QEMU_X86
select BOARD_ROMSIZE_KB_2048 if TARGET_QEMU_X86_64
imply VIRTIO_PCI
imply VIRTIO_NET
imply VIRTIO_BLK

View file

@ -16,6 +16,7 @@ CONFIG_BOOTSTD_FULL=y
CONFIG_SHOW_BOOT_PROGRESS=y
CONFIG_USE_BOOTARGS=y
CONFIG_BOOTARGS="root=/dev/sdb3 init=/sbin/init rootwait ro"
CONFIG_BOOTCOMMAND="bootflow scan -l; if bootflow menu; then cls; bootflow boot; fi"
CONFIG_SYS_PBSIZE=532
CONFIG_PRE_CONSOLE_BUFFER=y
CONFIG_SYS_CONSOLE_INFO_QUIET=y
@ -59,6 +60,7 @@ CONFIG_SYS_NS16550_MEM32=y
CONFIG_SOUND=y
CONFIG_SOUND_I8254=y
CONFIG_VIDEO_COPY=y
CONFIG_CONSOLE_TRUETYPE=y
CONFIG_CONSOLE_SCROLL_LINES=5
CONFIG_SPL_ACPI=y
CONFIG_CMD_DHRYSTONE=y

View file

@ -14,6 +14,7 @@ CONFIG_BOOTSTD_FULL=y
CONFIG_SHOW_BOOT_PROGRESS=y
CONFIG_USE_BOOTARGS=y
CONFIG_BOOTARGS="root=/dev/sdb3 init=/sbin/init rootwait ro"
CONFIG_BOOTCOMMAND="bootflow scan -l; if bootflow menu; then cls; bootflow boot; fi"
CONFIG_PRE_CONSOLE_BUFFER=y
CONFIG_SYS_CONSOLE_INFO_QUIET=y
CONFIG_LOG=y
@ -53,6 +54,7 @@ CONFIG_SYS_NS16550_MEM32=y
CONFIG_SOUND=y
CONFIG_SOUND_I8254=y
CONFIG_VIDEO_COPY=y
CONFIG_CONSOLE_TRUETYPE=y
CONFIG_CONSOLE_SCROLL_LINES=5
CONFIG_CMD_DHRYSTONE=y
# CONFIG_GZIP is not set

View file

@ -6,7 +6,7 @@ CONFIG_ENV_SIZE=0x40000
CONFIG_MAX_CPUS=2
CONFIG_SPL_DM_SPI=y
CONFIG_DEFAULT_DEVICE_TREE="qemu-x86_i440fx"
CONFIG_SPL_TEXT_BASE=0xfffd8000
CONFIG_SPL_TEXT_BASE=0xfffd4000
CONFIG_SPL_SYS_MALLOC_F_LEN=0x2000
CONFIG_DEBUG_UART_BASE=0x3f8
CONFIG_DEBUG_UART_CLOCK=1843200
@ -17,7 +17,7 @@ CONFIG_DEBUG_UART=y
CONFIG_SMP=y
CONFIG_GENERATE_PIRQ_TABLE=y
CONFIG_GENERATE_MP_TABLE=y
CONFIG_X86_OFFSET_U_BOOT=0xfff00000
CONFIG_X86_OFFSET_U_BOOT=0xffe00000
CONFIG_SYS_MONITOR_BASE=0x01110000
CONFIG_FIT=y
CONFIG_SPL_LOAD_FIT=y
@ -80,6 +80,7 @@ CONFIG_SPL_DM_RTC=y
CONFIG_SYS_NS16550_PORT_MAPPED=y
CONFIG_SPI=y
CONFIG_USB_KEYBOARD=y
CONFIG_CONSOLE_TRUETYPE=y
CONFIG_FRAMEBUFFER_SET_VESA_MODE=y
CONFIG_FRAMEBUFFER_VESA_MODE_USER=y
CONFIG_FRAMEBUFFER_VESA_MODE=0x144

View file

@ -57,6 +57,7 @@ CONFIG_NVME_PCI=y
CONFIG_SYS_NS16550_PORT_MAPPED=y
CONFIG_SPI=y
CONFIG_USB_KEYBOARD=y
CONFIG_CONSOLE_TRUETYPE=y
CONFIG_FRAMEBUFFER_SET_VESA_MODE=y
CONFIG_FRAMEBUFFER_VESA_MODE_USER=y
CONFIG_FRAMEBUFFER_VESA_MODE=0x144

View file

@ -180,6 +180,7 @@ config CONSOLE_ROTATION
config CONSOLE_TRUETYPE
bool "Support a console that uses TrueType fonts"
select X86_HARDFP if X86
help
TrueTrype fonts can provide outline-drawing capability rather than
needing to provide a bitmap for each font and size that is needed.

View file

@ -8,6 +8,7 @@
#include <dm.h>
#include <log.h>
#include <malloc.h>
#include <spl.h>
#include <video.h>
#include <video_console.h>
@ -802,6 +803,9 @@ static int truetype_entry_save(struct udevice *dev, struct abuf *buf)
struct console_tt_store store;
const uint size = sizeof(store);
if (spl_phase() <= PHASE_SPL)
return -ENOSYS;
/*
* store the whole priv structure as it is simpler that picking out
* what we need
@ -823,6 +827,9 @@ static int truetype_entry_restore(struct udevice *dev, struct abuf *buf)
struct console_tt_priv *priv = dev_get_priv(dev);
struct console_tt_store store;
if (spl_phase() <= PHASE_SPL)
return -ENOSYS;
memcpy(&store, abuf_data(buf), sizeof(store));
vc_priv->xcur_frac = store.cur.xpos_frac;
@ -847,6 +854,9 @@ static int truetype_set_cursor_visible(struct udevice *dev, bool visible,
uint out, val;
int ret;
if (spl_phase() <= PHASE_SPL)
return -ENOSYS;
if (!visible)
return 0;

View file

@ -126,6 +126,7 @@ void vidconsole_set_cursor_pos(struct udevice *dev, int x, int y)
priv->xcur_frac = VID_TO_POS(x);
priv->xstart_frac = priv->xcur_frac;
priv->ycur = y;
vidconsole_entry_start(dev);
}
/**
@ -135,8 +136,10 @@ void vidconsole_set_cursor_pos(struct udevice *dev, int x, int y)
* @row: new row
* @col: new column
*/
static void set_cursor_position(struct vidconsole_priv *priv, int row, int col)
static void set_cursor_position(struct udevice *dev, int row, int col)
{
struct vidconsole_priv *priv = dev_get_uclass_priv(dev);
/*
* Ensure we stay in the bounds of the screen.
*/
@ -145,9 +148,7 @@ static void set_cursor_position(struct vidconsole_priv *priv, int row, int col)
if (col >= priv->cols)
col = priv->cols - 1;
priv->ycur = row * priv->y_charsize;
priv->xcur_frac = priv->xstart_frac +
VID_TO_POS(col * priv->x_charsize);
vidconsole_position_cursor(dev, col, row);
}
/**
@ -194,7 +195,7 @@ static void vidconsole_escape_char(struct udevice *dev, char ch)
int row = priv->row_saved;
int col = priv->col_saved;
set_cursor_position(priv, row, col);
set_cursor_position(dev, row, col);
priv->escape = 0;
return;
}
@ -256,7 +257,7 @@ static void vidconsole_escape_char(struct udevice *dev, char ch)
if (row < 0)
row = 0;
/* Right and bottom overflows are handled in the callee. */
set_cursor_position(priv, row, col);
set_cursor_position(dev, row, col);
break;
}
case 'H':
@ -280,7 +281,7 @@ static void vidconsole_escape_char(struct udevice *dev, char ch)
if (col)
--col;
set_cursor_position(priv, row, col);
set_cursor_position(dev, row, col);
break;
}