diff options
Diffstat (limited to 'config/module/seabios/default')
7 files changed, 593 insertions, 0 deletions
diff --git a/config/module/seabios/default/config/libgfxinit b/config/module/seabios/default/config/libgfxinit new file mode 100644 index 00000000..f1f4b0a6 --- /dev/null +++ b/config/module/seabios/default/config/libgfxinit @@ -0,0 +1,98 @@ +# +# Automatically generated file; DO NOT EDIT. +# SeaBIOS Configuration +# + +# +# General Features +# +CONFIG_COREBOOT=y +# CONFIG_QEMU is not set +# CONFIG_CSM is not set +# CONFIG_QEMU_HARDWARE is not set +CONFIG_THREADS=y +CONFIG_RELOCATE_INIT=y +CONFIG_BOOTMENU=y +CONFIG_BOOTSPLASH=y +CONFIG_BOOTORDER=y +CONFIG_HOST_BIOS_GEOMETRY=y +CONFIG_COREBOOT_FLASH=y +CONFIG_LZMA=y +CONFIG_CBFS_LOCATION=0 +CONFIG_MULTIBOOT=y +CONFIG_ENTRY_EXTRASTACK=y +CONFIG_MALLOC_UPPERMEMORY=y +CONFIG_ROM_SIZE=0 + +# +# Hardware support +# +CONFIG_ATA=y +# CONFIG_ATA_DMA is not set +# CONFIG_ATA_PIO32 is not set +CONFIG_AHCI=y +CONFIG_SDCARD=y +CONFIG_MEGASAS=y +CONFIG_FLOPPY=y +CONFIG_FLASH_FLOPPY=y +CONFIG_NVME=y +CONFIG_PS2PORT=y +CONFIG_USB=y +CONFIG_USB_UHCI=y +CONFIG_USB_OHCI=y +CONFIG_USB_EHCI=y +CONFIG_USB_XHCI=y +CONFIG_USB_MSC=y +CONFIG_USB_UAS=y +CONFIG_USB_HUB=y +CONFIG_USB_KEYBOARD=y +CONFIG_USB_MOUSE=y +CONFIG_SERIAL=y +CONFIG_SERCON=y +CONFIG_LPT=y +CONFIG_RTC_TIMER=y +CONFIG_HARDWARE_IRQ=y +CONFIG_PMTIMER=y +CONFIG_TSC_TIMER=y + +# +# BIOS interfaces +# +CONFIG_DRIVES=y +CONFIG_CDROM_BOOT=y +CONFIG_CDROM_EMU=y +CONFIG_PCIBIOS=y +CONFIG_APMBIOS=y +CONFIG_PNPBIOS=y +CONFIG_OPTIONROMS=y +CONFIG_PMM=y +CONFIG_BOOT=y +CONFIG_KEYBOARD=y +CONFIG_KBD_CALL_INT15_4F=y +CONFIG_MOUSE=y +CONFIG_S3_RESUME=y +CONFIG_VGAHOOKS=y +# CONFIG_DISABLE_A20 is not set +CONFIG_TCGBIOS=y + +# +# VGA ROM +# +# CONFIG_NO_VGABIOS is not set +# CONFIG_VGA_GEODEGX2 is not set +# CONFIG_VGA_GEODELX is not set +CONFIG_VGA_COREBOOT=y +CONFIG_BUILD_VGABIOS=y +CONFIG_VGA_EMULATE_TEXT=y +CONFIG_VGA_FIXUP_ASM=y +CONFIG_VGA_ALLOCATE_EXTRA_STACK=y +CONFIG_VGA_EXTRA_STACK_SIZE=512 +CONFIG_VGA_VBE=y + +# +# Debugging +# +CONFIG_DEBUG_LEVEL=1 +# CONFIG_DEBUG_SERIAL is not set +# CONFIG_DEBUG_SERIAL_MMIO is not set +CONFIG_DEBUG_COREBOOT=y diff --git a/config/module/seabios/default/config/normal b/config/module/seabios/default/config/normal new file mode 100644 index 00000000..187a7501 --- /dev/null +++ b/config/module/seabios/default/config/normal @@ -0,0 +1,94 @@ +# +# Automatically generated file; DO NOT EDIT. +# SeaBIOS Configuration +# + +# +# General Features +# +CONFIG_COREBOOT=y +# CONFIG_QEMU is not set +# CONFIG_CSM is not set +# CONFIG_QEMU_HARDWARE is not set +CONFIG_THREADS=y +CONFIG_RELOCATE_INIT=y +CONFIG_BOOTMENU=y +CONFIG_BOOTSPLASH=y +CONFIG_BOOTORDER=y +CONFIG_HOST_BIOS_GEOMETRY=y +CONFIG_COREBOOT_FLASH=y +CONFIG_LZMA=y +CONFIG_CBFS_LOCATION=0 +CONFIG_MULTIBOOT=y +CONFIG_ENTRY_EXTRASTACK=y +CONFIG_MALLOC_UPPERMEMORY=y +CONFIG_ROM_SIZE=0 + +# +# Hardware support +# +CONFIG_ATA=y +# CONFIG_ATA_DMA is not set +# CONFIG_ATA_PIO32 is not set +CONFIG_AHCI=y +CONFIG_SDCARD=y +CONFIG_MEGASAS=y +CONFIG_FLOPPY=y +CONFIG_FLASH_FLOPPY=y +CONFIG_NVME=y +CONFIG_PS2PORT=y +CONFIG_USB=y +CONFIG_USB_UHCI=y +CONFIG_USB_OHCI=y +CONFIG_USB_EHCI=y +CONFIG_USB_XHCI=y +CONFIG_USB_MSC=y +CONFIG_USB_UAS=y +CONFIG_USB_HUB=y +CONFIG_USB_KEYBOARD=y +CONFIG_USB_MOUSE=y +CONFIG_SERIAL=y +CONFIG_SERCON=y +CONFIG_LPT=y +CONFIG_RTC_TIMER=y +CONFIG_HARDWARE_IRQ=y +CONFIG_PMTIMER=y +CONFIG_TSC_TIMER=y + +# +# BIOS interfaces +# +CONFIG_DRIVES=y +CONFIG_CDROM_BOOT=y +CONFIG_CDROM_EMU=y +CONFIG_PCIBIOS=y +CONFIG_APMBIOS=y +CONFIG_PNPBIOS=y +CONFIG_OPTIONROMS=y +CONFIG_PMM=y +CONFIG_BOOT=y +CONFIG_KEYBOARD=y +CONFIG_KBD_CALL_INT15_4F=y +CONFIG_MOUSE=y +CONFIG_S3_RESUME=y +CONFIG_VGAHOOKS=y +# CONFIG_DISABLE_A20 is not set +CONFIG_TCGBIOS=y + +# +# VGA ROM +# +CONFIG_NO_VGABIOS=y +# CONFIG_VGA_GEODEGX2 is not set +# CONFIG_VGA_GEODELX is not set +# CONFIG_VGA_COREBOOT is not set +# CONFIG_BUILD_VGABIOS is not set +CONFIG_VGA_EXTRA_STACK_SIZE=512 + +# +# Debugging +# +CONFIG_DEBUG_LEVEL=1 +# CONFIG_DEBUG_SERIAL is not set +# CONFIG_DEBUG_SERIAL_MMIO is not set +CONFIG_DEBUG_COREBOOT=y diff --git a/config/module/seabios/default/config/vgarom b/config/module/seabios/default/config/vgarom new file mode 100644 index 00000000..9e63e65c --- /dev/null +++ b/config/module/seabios/default/config/vgarom @@ -0,0 +1,93 @@ +# +# Automatically generated file; DO NOT EDIT. +# SeaBIOS Configuration +# + +# +# General Features +# +CONFIG_COREBOOT=y +# CONFIG_QEMU is not set +# CONFIG_CSM is not set +# CONFIG_QEMU_HARDWARE is not set +CONFIG_THREADS=y +CONFIG_RELOCATE_INIT=y +CONFIG_BOOTMENU=y +CONFIG_BOOTSPLASH=y +CONFIG_BOOTORDER=y +CONFIG_HOST_BIOS_GEOMETRY=y +CONFIG_COREBOOT_FLASH=y +CONFIG_LZMA=y +CONFIG_CBFS_LOCATION=0 +CONFIG_MULTIBOOT=y +CONFIG_ENTRY_EXTRASTACK=y +CONFIG_MALLOC_UPPERMEMORY=y +CONFIG_ROM_SIZE=0 + +# +# Hardware support +# +CONFIG_ATA=y +# CONFIG_ATA_DMA is not set +# CONFIG_ATA_PIO32 is not set +CONFIG_AHCI=y +CONFIG_SDCARD=y +CONFIG_MEGASAS=y +CONFIG_FLOPPY=y +CONFIG_FLASH_FLOPPY=y +CONFIG_NVME=y +CONFIG_PS2PORT=y +CONFIG_USB=y +CONFIG_USB_UHCI=y +CONFIG_USB_OHCI=y +CONFIG_USB_EHCI=y +CONFIG_USB_XHCI=y +CONFIG_USB_MSC=y +CONFIG_USB_UAS=y +CONFIG_USB_HUB=y +CONFIG_USB_KEYBOARD=y +CONFIG_USB_MOUSE=y +CONFIG_SERIAL=y +CONFIG_SERCON=y +CONFIG_LPT=y +CONFIG_RTC_TIMER=y +CONFIG_HARDWARE_IRQ=y +CONFIG_PMTIMER=y +CONFIG_TSC_TIMER=y + +# +# BIOS interfaces +# +CONFIG_DRIVES=y +CONFIG_CDROM_BOOT=y +CONFIG_CDROM_EMU=y +CONFIG_PCIBIOS=y +CONFIG_APMBIOS=y +CONFIG_PNPBIOS=y +# CONFIG_OPTIONROMS is not set +CONFIG_BOOT=y +CONFIG_KEYBOARD=y +CONFIG_KBD_CALL_INT15_4F=y +CONFIG_MOUSE=y +CONFIG_S3_RESUME=y +CONFIG_VGAHOOKS=y +# CONFIG_DISABLE_A20 is not set +CONFIG_TCGBIOS=y + +# +# VGA ROM +# +CONFIG_NO_VGABIOS=y +# CONFIG_VGA_GEODEGX2 is not set +# CONFIG_VGA_GEODELX is not set +# CONFIG_VGA_COREBOOT is not set +# CONFIG_BUILD_VGABIOS is not set +CONFIG_VGA_EXTRA_STACK_SIZE=512 + +# +# Debugging +# +CONFIG_DEBUG_LEVEL=1 +# CONFIG_DEBUG_SERIAL is not set +# CONFIG_DEBUG_SERIAL_MMIO is not set +CONFIG_DEBUG_COREBOOT=y diff --git a/config/module/seabios/default/patches/0001-romfile-implement-a-generic-loader.patch b/config/module/seabios/default/patches/0001-romfile-implement-a-generic-loader.patch new file mode 100644 index 00000000..c7925ecb --- /dev/null +++ b/config/module/seabios/default/patches/0001-romfile-implement-a-generic-loader.patch @@ -0,0 +1,86 @@ +From cb35009da3b9335845a6e8a2f0ba2a031bf52183 Mon Sep 17 00:00:00 2001 +From: Riku Viitanen <riku.viitanen@protonmail.com> +Date: Sat, 10 Feb 2024 21:23:33 +0200 +Subject: [PATCH 1/3] romfile: implement a generic loader + +romfile_loadfile_g: +Based on romfile_loadfile but more flexible. User has to supply pointer +to a malloc function and the number of trailing padding bytes. Thus, any +memory region may be used. + +romfile_loadfile: +It is now a wrapper around romfile_loadfile_g. Functionality is the same. + +Signed-off-by: Riku Viitanen <riku.viitanen@protonmail.com> +--- + src/romfile.c | 25 ++++++++++++++++++++----- + src/romfile.h | 2 ++ + 2 files changed, 22 insertions(+), 5 deletions(-) + +diff --git a/src/romfile.c b/src/romfile.c +index 8072a915..f4d5f82d 100644 +--- a/src/romfile.c ++++ b/src/romfile.c +@@ -47,10 +47,12 @@ romfile_find(const char *name) + return __romfile_findprefix(name, strlen(name) + 1, NULL); + } + +-// Helper function to find, malloc_tmphigh, and copy a romfile. This +-// function adds a trailing zero to the malloc'd copy. ++// Generic function to find romfile, malloc (using provided function ++// pointer), and copy a romfile. add_len specifies how many additional ++// trailing bytes to reserve. The extra bytes will not be initialised. + void * +-romfile_loadfile(const char *name, int *psize) ++romfile_loadfile_g(const char *name, int *psize, ++ void *(*malloc_fn)(u32), int add_len) + { + struct romfile_s *file = romfile_find(name); + if (!file) +@@ -60,7 +62,7 @@ romfile_loadfile(const char *name, int *psize) + if (!filesize) + return NULL; + +- char *data = malloc_tmphigh(filesize+1); ++ char *data = malloc_fn(filesize+add_len); + if (!data) { + warn_noalloc(); + return NULL; +@@ -74,7 +76,20 @@ romfile_loadfile(const char *name, int *psize) + } + if (psize) + *psize = filesize; +- data[filesize] = '\0'; ++ ++ return data; ++} ++ ++// Helper function to find, malloc_tmphigh, and copy a romfile. This ++// function adds a trailing zero to the malloc'd copy. ++void * ++romfile_loadfile(const char *name, int *psize) ++{ ++ char *data = romfile_loadfile_g(name, psize, &malloc_tmphigh, 1); ++ if (!data) ++ return NULL; ++ ++ data[*psize] = '\0'; + return data; + } + +diff --git a/src/romfile.h b/src/romfile.h +index ae2f4ac7..f62b2fee 100644 +--- a/src/romfile.h ++++ b/src/romfile.h +@@ -13,6 +13,8 @@ struct romfile_s { + void romfile_add(struct romfile_s *file); + struct romfile_s *romfile_findprefix(const char *prefix, struct romfile_s *prev); + struct romfile_s *romfile_find(const char *name); ++void *romfile_loadfile_g(const char *name, int *psize, ++ void *(*malloc_fn)(u32), int add_len); + void *romfile_loadfile(const char *name, int *psize); + u64 romfile_loadint(const char *name, u64 defval); + u32 romfile_loadbool(const char *name, u32 defval); +-- +2.47.3 + diff --git a/config/module/seabios/default/patches/0002-vgahooks-optionroms-implement-mxm-3.0-interrupts.patch b/config/module/seabios/default/patches/0002-vgahooks-optionroms-implement-mxm-3.0-interrupts.patch new file mode 100644 index 00000000..c1400f64 --- /dev/null +++ b/config/module/seabios/default/patches/0002-vgahooks-optionroms-implement-mxm-3.0-interrupts.patch @@ -0,0 +1,188 @@ +From 7c1400e3cd2b5e6ece0bf141a0ddca9f4f9df16e Mon Sep 17 00:00:00 2001 +From: Riku Viitanen <riku.viitanen@protonmail.com> +Date: Sat, 10 Feb 2024 21:38:17 +0200 +Subject: [PATCH 2/3] vgahooks, optionroms: implement mxm 3.0 interrupts + +VGAROMs on MXM graphics cards need certain int15h functions present. + +Tested on a HP EliteBook 8560w with coreboot and Quadro 2000M. A warning +is displayed for 30 seconds and performance is nerfed: + + ERROR: Valid MXM Structure not found. + POST halted for 30 seconds, P-state limited to P10... + +This patch implements the minimum required on this system (and implemented +by the OEM BIOS): functions 0 and 1. + +These functions are specific to the MXM 3.0 Software Specification, +earlier versions are not implemented due to lack of hardware. Documentation +for versions 2.1 and 3.0 can be found freely online. + +Functions aren't specific to mainboards or GPUs (though some mainboards +could need more functions implemented). The structure is +mainboard-specific and is read from romfile "mxm-30-sis". + +It can be extracted from vendor BIOS by running those same interrupts. +I wrote a tool to do it on Linux: https://codeberg.org/Riku_V/mxmdump/ + +Signed-off-by: Riku Viitanen <riku.viitanen@protonmail.com> +--- + src/optionroms.c | 9 +++++++ + src/vgahooks.c | 69 ++++++++++++++++++++++++++++++++++++++++++++++++ + src/vgahooks.h | 9 +++++++ + 3 files changed, 87 insertions(+) + create mode 100644 src/vgahooks.h + +diff --git a/src/optionroms.c b/src/optionroms.c +index e906ab97..fcce7900 100644 +--- a/src/optionroms.c ++++ b/src/optionroms.c +@@ -22,6 +22,7 @@ + #include "string.h" // memset + #include "util.h" // get_pnp_offset + #include "tcgbios.h" // tpm_* ++#include "vgahooks.h" // MXM30SIS + + static int EnforceChecksum, S3ResumeVga, RunPCIroms; + +@@ -463,6 +464,14 @@ vgarom_setup(void) + RunPCIroms = romfile_loadint("etc/pci-optionrom-exec", 2); + ScreenAndDebug = romfile_loadint("etc/screen-and-debug", 1); + ++ // Load MXM 3.0 System Information Structure ++ void *mxm_sis = romfile_loadfile_g("mxm-30-sis", NULL, &malloc_low, 0); ++ if (mxm_sis) { ++ MXM30SIS = (u32)mxm_sis; ++ } else { ++ MXM30SIS = 0; ++ } ++ + // Clear option rom memory + memset((void*)BUILD_ROM_START, 0, rom_get_max() - BUILD_ROM_START); + +diff --git a/src/vgahooks.c b/src/vgahooks.c +index 1f149532..a94840b2 100644 +--- a/src/vgahooks.c ++++ b/src/vgahooks.c +@@ -18,8 +18,10 @@ + #define VH_VIA 1 + #define VH_INTEL 2 + #define VH_SMI 3 ++#define VH_MXM 4 + + int VGAHookHandlerType VARFSEG; ++u32 MXM30SIS VARFSEG; + + static void + handle_155fXX(struct bregs *regs) +@@ -59,6 +61,7 @@ via_155f02(struct bregs *regs) + dprintf(1, "Warning: VGA TV/CRT output type is hardcoded\n"); + } + ++ + static void + via_155f18(struct bregs *regs) + { +@@ -296,6 +299,69 @@ winent_mb6047_setup(struct pci_device *pci) + SmiBootDisplay = 0x02; + } + ++/**************************************************************** ++ * MXM VGA hooks ++ ****************************************************************/ ++ ++// Function 0: Return Specification Support Level ++static void ++mxm_V30_F00(struct bregs *regs) ++{ ++ regs->ax = 0x005f; // Success ++ regs->bl = 0x30; // MXM 3.0 ++ regs->cx = 0x0003; // Supported Functions ++ set_success(regs); ++} ++ ++// Function 1: Return a Pointer to the MXM Structure ++static void ++mxm_V30_F01(struct bregs *regs) ++{ ++ switch (regs->cx) { ++ case 0x0030: ++ regs->ax = 0x005f; // Success ++ regs->es = GET_GLOBAL(MXM30SIS)/16; ++ regs->di = GET_GLOBAL(MXM30SIS)%16; ++ set_success(regs); ++ break; ++ default: ++ handle_155fXX(regs); ++ break; ++ } ++} ++ ++static void ++mxm_V30(struct bregs *regs) ++{ ++ switch (regs->bx) { ++ case 0xff00: mxm_V30_F00(regs); break; ++ case 0xff01: mxm_V30_F01(regs); break; ++ default: handle_155fXX(regs); break; ++ } ++} ++ ++static void ++mxm_155f80(struct bregs *regs) ++{ ++ // TODO: implement other versions, like 2.1 ++ mxm_V30(regs); ++} ++ ++static void ++mxm_155f(struct bregs *regs) ++{ ++ switch (regs->al) { ++ case 0x80: mxm_155f80(regs); break; ++ default: handle_155fXX(regs); break; ++ } ++} ++ ++void ++mxm_setup(void) ++{ ++ VGAHookHandlerType = VH_MXM; ++} ++ + /**************************************************************** + * Entry and setup + ****************************************************************/ +@@ -313,6 +379,7 @@ handle_155f(struct bregs *regs) + switch (htype) { + case VH_VIA: via_155f(regs); break; + case VH_INTEL: intel_155f(regs); break; ++ case VH_MXM: mxm_155f(regs); break; + default: handle_155fXX(regs); break; + } + } +@@ -352,4 +419,6 @@ vgahook_setup(struct pci_device *pci) + via_setup(pci); + else if (pci->vendor == PCI_VENDOR_ID_INTEL) + intel_setup(pci); ++ else if (GET_GLOBAL(MXM30SIS)) ++ mxm_setup(); + } +diff --git a/src/vgahooks.h b/src/vgahooks.h +new file mode 100644 +index 00000000..f0c203af +--- /dev/null ++++ b/src/vgahooks.h +@@ -0,0 +1,9 @@ ++#ifndef __VGAHOOKS_H ++#define __VGAHOOKS_H ++ ++#include "types.h" // u32 ++ ++extern u32 MXM30SIS; ++ ++ ++#endif // vgahooks.h +-- +2.47.3 + diff --git a/config/module/seabios/default/patches/0003-Print-the-Libreboot-version-in-the-SeaBIOS-menu.patch b/config/module/seabios/default/patches/0003-Print-the-Libreboot-version-in-the-SeaBIOS-menu.patch new file mode 100644 index 00000000..aee850c5 --- /dev/null +++ b/config/module/seabios/default/patches/0003-Print-the-Libreboot-version-in-the-SeaBIOS-menu.patch @@ -0,0 +1,26 @@ +From cd0b2ad4c0d68c00f7e430d098e540a1af629f97 Mon Sep 17 00:00:00 2001 +From: Leah Rowe <leah@libreboot.org> +Date: Mon, 6 Jan 2025 18:49:58 +0000 +Subject: [PATCH 3/3] Print the Libreboot version in the SeaBIOS menu + +Signed-off-by: Leah Rowe <leah@libreboot.org> +--- + src/bootsplash.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/bootsplash.c b/src/bootsplash.c +index 538b316d..e02bf3d2 100644 +--- a/src/bootsplash.c ++++ b/src/bootsplash.c +@@ -48,7 +48,7 @@ enable_vga_console(void) + call16_int10(&br); + + // Write to screen. +- printf("SeaBIOS (version %s)\n", VERSION); ++ printf("Libreboot 26.01 Magnanimous Max (SeaBIOS menu): https://libreboot.org/\n"); + display_uuid(); + } + +-- +2.47.3 + diff --git a/config/module/seabios/default/target.cfg b/config/module/seabios/default/target.cfg new file mode 100644 index 00000000..1307aa88 --- /dev/null +++ b/config/module/seabios/default/target.cfg @@ -0,0 +1,8 @@ +# SPDX-License-Identifier: GPL-3.0-or-later + +url="https://github.com/coreboot/seabios" +bkup_url="https://review.coreboot.org/seabios" + +rev="0026c353eb4e220af29750fcf000d48faf8d4ab3" + +tree="default" |
