Showing with 838 additions and 139 deletions.
  1. +50 −0 CHANGELOG.md
  2. +2 −1 Makefile
  3. +2 −2 scripts/buildversion.py
  4. +18 −1 src/Kconfig
  5. +104 −38 src/boot.c
  6. +5 −1 src/bootsplash.c
  7. +3 −0 src/clock.c
  8. +49 −0 src/fw/coreboot.c
  9. +45 −0 src/fw/coreboot.h
  10. +69 −26 src/fw/paravirt.c
  11. +5 −1 src/fw/paravirt.h
  12. +99 −17 src/fw/romfile_loader.c
  13. +42 −23 src/fw/romfile_loader.h
  14. +13 −1 src/fw/shadow.c
  15. +1 −1 src/fw/smp.c
  16. +5 −0 src/hw/ahci.c
  17. +0 −1 src/hw/pci.c
  18. +2 −0 src/hw/pci.h
  19. +12 −1 src/hw/ps2port.c
  20. +12 −1 src/hw/sdcard.c
  21. +34 −10 src/hw/serialio.c
  22. +2 −0 src/hw/serialio.h
  23. +3 −0 src/hw/usb-xhci.c
  24. +1 −1 src/hw/usb.h
  25. +1 −1 src/kbd.c
  26. +18 −0 src/misc.c
  27. +16 −5 src/optionroms.c
  28. +6 −2 src/resume.c
  29. +45 −3 src/romfile.c
  30. +10 −0 src/serial.c
  31. +156 −0 src/serialconsole.c
  32. +7 −1 src/util.h
  33. +1 −1 vgasrc/vgabios.h
50 changes: 50 additions & 0 deletions CHANGELOG.md
@@ -0,0 +1,50 @@
Change log for PC Engines fork of SeaBIOS
=========================================

Fourth digit in release number means PC Engines patch.

## [Unreleased]

## [rel-1.10.2.1] - 2017-03-31
### Changed
- rebased to 1.10.2 stable mainline

## [rel-1.10.0.1] - 2017-02-23
### Changed
- rebased to 1.10.0 mainline
- added SgaBios option rom enable/disable sortbootorder config handling

## [rel-1.9.2.4] - 2017-01-23
### Changed
- change debug output of version string to show, when using the sgabios and
also serial output

## [rel-1.9.2.3] - 2017-01-03
### Fixed
- fix the issue that 2 banner messages with version are shown on
default debug level

## [rel-1.9.2.2] - 2016-12-13
### Changed
- simplify version displayed during boot

### Fixed
- remove screen control character by disable screen cleaning when loading
sgabios

## [rel-1.9.2.1] - 2016-10-04
### Added
- allowed for one-time `PXE ` boot with `N` key
- enable/disable option for `USB` boot
- enable/disable option for `PXE` boot

### Fixed
- prevented from printing character multiple times

[Unreleased]: https://github.com/pcengines/seabios/compare/rel-1.10.2.1...apu_support
[rel-1.10.2.1]: https://github.com/pcengines/seabios/compare/rel-1.10.2.1...rel-1.10.0.1
[rel-1.10.0.1]: https://github.com/pcengines/seabios/compare/rel-1.9.2.4...rel-1.10.0.1
[rel-1.9.2.4]: https://github.com/pcengines/seabios/compare/rel-1.9.2.3...rel-1.9.2.4
[rel-1.9.2.3]: https://github.com/pcengines/seabios/compare/rel-1.9.2.2...rel-1.9.2.3
[rel-1.9.2.2]: https://github.com/pcengines/seabios/compare/rel-1.9.2.1...rel-1.9.2.2
[rel-1.9.2.1]: https://github.com/pcengines/seabios/compare/rel-1.9.2...rel-1.9.2.1
3 changes: 2 additions & 1 deletion Makefile
Expand Up @@ -34,7 +34,8 @@ SRCBOTH=misc.c stacks.c output.c string.c block.c cdrom.c disk.c mouse.c kbd.c \
hw/usb.c hw/usb-uhci.c hw/usb-ohci.c hw/usb-ehci.c \
hw/usb-hid.c hw/usb-msc.c hw/usb-uas.c \
hw/blockcmd.c hw/floppy.c hw/ata.c hw/ramdisk.c \
hw/lsi-scsi.c hw/esp-scsi.c hw/megasas.c hw/mpt-scsi.c
hw/lsi-scsi.c hw/esp-scsi.c hw/megasas.c hw/mpt-scsi.c \
serialconsole.c
SRC16=$(SRCBOTH)
SRC32FLAT=$(SRCBOTH) post.c e820map.c malloc.c romfile.c x86.c optionroms.c \
pmm.c font.c boot.c bootsplash.c jpeg.c bmp.c tcgbios.c sha1.c \
Expand Down
4 changes: 2 additions & 2 deletions scripts/buildversion.py
Expand Up @@ -36,7 +36,7 @@ def git_version():
if not os.path.exists('.git'):
logging.debug("No '.git' file/directory found")
return ""
ver = check_output("git describe --tags --long --dirty").strip()
ver = check_output("git describe --tags --dirty").strip()
logging.debug("Got git version: %s" % (repr(ver),))
return ver

Expand Down Expand Up @@ -114,7 +114,7 @@ def main():
cleanbuild, toolstr = tool_versions(options.tools)

ver = git_version()
cleanbuild = cleanbuild and 'dirty' not in ver
cleanbuild = 'dirty' not in ver
if not ver:
ver = file_version()
# We expect the "extra version" to contain information on the
Expand Down
19 changes: 18 additions & 1 deletion src/Kconfig
Expand Up @@ -27,6 +27,10 @@ choice

endchoice

config SEABIOS_SERIAL_CONSOLE
bool "Enable serial console for headless systems"
default y

config QEMU_HARDWARE
bool "Support hardware found on emulators (QEMU/Xen/KVM/Bochs)" if !QEMU
default n
Expand Down Expand Up @@ -521,7 +525,7 @@ menu "Debugging"
Set to zero to disable debugging.

config DEBUG_SERIAL
depends on DEBUG_LEVEL != 0
depends on SEABIOS_SERIAL_CONSOLE || DEBUG_LEVEL != 0
bool "Serial port debugging"
default n
help
Expand All @@ -532,6 +536,19 @@ menu "Debugging"
default 0x3f8
help
Base port for serial - generally 0x3f8, 0x2f8, 0x3e8, or 0x2e8.
config DEBUG_SERIAL_MMIO
depends on DEBUG_LEVEL != 0 && !DEBUG_SERIAL
bool "Serial port debugging via memory mapped IO"
default n
help
Send debugging information to serial port mapped in memory.
config DEBUG_SERIAL_MEM_ADDRESS
depends on DEBUG_SERIAL_MMIO
hex "Serial port memory mapped IO address"
help
On some chipsets the serial port is memory mapped, in those cases
provide the 32 bit address. E.g. 0xFEDC6000 for the AMD Kern
(a.k.a Hudson UART).

config DEBUG_IO
depends on QEMU_HARDWARE && DEBUG_LEVEL != 0
Expand Down
142 changes: 104 additions & 38 deletions src/boot.c
Expand Up @@ -103,6 +103,46 @@ find_prio(const char *glob)
return -1;
}

// search for 'ipxe enable' bit value
int find_pxen(void)
{
int i = 0;
for (i=0; i < BootorderCount; i++)
{
if (glob_prefix("pxen0", Bootorder[i]))
return 0;
if (glob_prefix("pxen1", Bootorder[i]))
return 1;
}
return -1;
}

// search for 'enable/disable sgabios' bit value
// if it doesn't exist - set to disabled
int find_sgaen(void)
{
int i;
for (i=0; i < BootorderCount; i++)
{
if (glob_prefix("sgaen1", Bootorder[i]))
return 1;
}
return 0;
}

// search for 'boot from usb' bit value
// if it doesn't exist - set to enabled
static int find_usben(void)
{
int i;
for (i=0; i < BootorderCount; i++)
{
if (glob_prefix("usben0", Bootorder[i]))
return 0;
}
return 1;
}

#define FW_PCI_DOMAIN "/pci@i0cf8"

static char *
Expand Down Expand Up @@ -381,8 +421,10 @@ boot_add_floppy(struct drive_s *drive_g, const char *desc, int prio)
void
boot_add_hd(struct drive_s *drive_g, const char *desc, int prio)
{
bootentry_add(IPL_TYPE_HARDDISK, defPrio(prio, DefaultHDPrio)
, (u32)drive_g, desc);
int usben = find_usben();
if ((glob_prefix("USB*", desc) == NULL) || usben == 1)
bootentry_add(IPL_TYPE_HARDDISK, defPrio(prio, DefaultHDPrio)
, (u32)drive_g, desc);
}

void
Expand Down Expand Up @@ -454,6 +496,9 @@ interactive_bootmenu(void)
{
// XXX - show available drives?

int n_key = 0;
int pxen = find_pxen();

if (! CONFIG_BOOTMENU || !romfile_loadint("etc/show-boot-menu", 1))
return;

Expand All @@ -462,58 +507,79 @@ interactive_bootmenu(void)

char *bootmsg = romfile_loadfile("etc/boot-menu-message", NULL);
int menukey = romfile_loadint("etc/boot-menu-key", 1);
printf("%s", bootmsg ?: "\nPress ESC for boot menu.\n\n");

if (ScreenAndDebug) printf("SeaBIOS (version %s)\n", VERSION);
printf("%s", bootmsg && pxen == 1 ? bootmsg : "\nPress F10 key now for boot menu\n\n");
free(bootmsg);

u32 menutime = romfile_loadint("etc/boot-menu-wait", DEFAULT_BOOTMENU_WAIT);
enable_bootsplash();
int scan_code = get_keystroke(menutime);
disable_bootsplash();
if (scan_code != menukey)
return;

while (get_keystroke(0) >= 0)
;
// 0x31 for N or n key
if (scan_code == 0x31 && pxen == 1)
n_key = 1;

printf("Select boot device:\n\n");
wait_threads();
if (scan_code != menukey && n_key != 1)
return;

// Show menu items
int maxmenu = 0;
// choice = 1 - boot 1st device from list by default
int maxmenu = 0, choice = 1;
char find_iPXE[5];
struct bootentry_s *pos;
hlist_for_each_entry(pos, &BootList, node) {
char desc[60];
maxmenu++;
printf("%d. %s\n", maxmenu
, strtcpy(desc, pos->description, ARRAY_SIZE(desc)));
}
if (tpm_can_show_menu()) {
printf("\nt. TPM Configuration\n");

// If N key is pressed, do not print boot menu
// and boot directly from iPXE
if (n_key) {
hlist_for_each_entry(pos, &BootList, node) {
maxmenu++;
strtcpy(find_iPXE, pos->description, 5);
if (strcmp(find_iPXE, "iPXE") == 0)
choice = maxmenu;
}
}
// Show menu items if menu-key is pressed
else {
printf("Select boot device:\n\n");
wait_threads();

// Show menu items
hlist_for_each_entry(pos, &BootList, node) {
char desc[60];
maxmenu++;
printf("%d. %s\n", maxmenu
, strtcpy(desc, pos->description, ARRAY_SIZE(desc)));
}
if (tpm_can_show_menu()) {
printf("\nt. TPM Configuration\n");
}

// Get key press. If the menu key is ESC, do not restart boot unless
// 1.5 seconds have passed. Otherwise users (trained by years of
// repeatedly hitting keys to enter the BIOS) will end up hitting ESC
// multiple times and immediately booting the primary boot device.
int esc_accepted_time = irqtimer_calc(menukey == 1 ? 1500 : 0);
for (;;) {
scan_code = get_keystroke(1000);
if (scan_code == 1 && !irqtimer_check(esc_accepted_time))
continue;
if (tpm_can_show_menu() && scan_code == 20 /* t */) {
printf("\n");
tpm_menu();
// Get key press. If the menu key is ESC, do not restart boot unless
// 1.5 seconds have passed. Otherwise users (trained by years of
// repeatedly hitting keys to enter the BIOS) will end up hitting ESC
// multiple times and immediately booting the primary boot device.
int esc_accepted_time = irqtimer_calc(menukey == 1 ? 1500 : 0);
for (;;) {
scan_code = get_keystroke(1000);
if (scan_code == 1 && !irqtimer_check(esc_accepted_time))
continue;
if (tpm_can_show_menu() && scan_code == 20 /* t */) {
printf("\n");
tpm_menu();
}
if (scan_code >= 1 && scan_code <= maxmenu+1)
break;
}
if (scan_code >= 1 && scan_code <= maxmenu+1)
break;
printf("\n");
if (scan_code == 0x01)
// ESC
return;

choice = scan_code - 1;
}
printf("\n");
if (scan_code == 0x01)
// ESC
return;

// Find entry and make top priority.
int choice = scan_code - 1;
hlist_for_each_entry(pos, &BootList, node) {
if (! --choice)
break;
Expand Down
6 changes: 5 additions & 1 deletion src/bootsplash.c
Expand Up @@ -44,7 +44,11 @@ enable_vga_console(void)

/* Enable VGA text mode */
memset(&br, 0, sizeof(br));
br.ax = 0x0003;

// From set_video_mode
// (https://github.com/alson/sgabios/blob/master/sgabios.S):
// unless bit 7 of al = 1 (0x80), setting mode clears screen
br.ax = 0x0083;
call16_int10(&br);

// Write to screen.
Expand Down
3 changes: 3 additions & 0 deletions src/clock.c
Expand Up @@ -294,6 +294,9 @@ clock_update(void)
// Check for internal events.
floppy_tick();
usb_check_event();
#if CONFIG_SEABIOS_SERIAL_CONSOLE
uart_keyboard_handler();
#endif
ps2_check_event();
}

Expand Down