Showing with 795 additions and 141 deletions.
  1. +25 −1 CHANGELOG.md
  2. +1 −1 Makefile
  3. +11 −5 docs/Mailinglist.md
  4. +1 −1 src/block.c
  5. +9 −10 src/bmp.c
  6. +10 −4 src/boot.c
  7. +3 −3 src/bootsplash.c
  8. +3 −0 src/fw/paravirt.c
  9. +3 −0 src/fw/paravirt.h
  10. +1 −1 src/hw/pvscsi.c
  11. +6 −3 src/hw/sdcard.c
  12. +14 −2 src/hw/serialio.c
  13. +1 −0 src/hw/serialio.h
  14. +1 −0 src/hw/usb-ehci.c
  15. +1 −1 src/hw/usb-xhci.c
  16. +3 −0 src/output.c
  17. +17 −0 src/std/tcg.h
  18. +258 −20 src/tcgbios.c
  19. +1 −1 src/util.h
  20. +11 −0 vgasrc/Kconfig
  21. +43 −0 vgasrc/ati-tables.S
  22. +245 −0 vgasrc/atiext.c
  23. +16 −86 vgasrc/bochsvga.c
  24. +80 −0 vgasrc/svgamodes.c
  25. +12 −0 vgasrc/svgamodes.h
  26. +3 −0 vgasrc/vgaentry.S
  27. +1 −2 vgasrc/vgafb.c
  28. +1 −0 vgasrc/vgafb.h
  29. +8 −0 vgasrc/vgahw.h
  30. +6 −0 vgasrc/vgautil.h
26 changes: 25 additions & 1 deletion CHANGELOG.md
Expand Up @@ -4,6 +4,28 @@ Change log for PC Engines fork of SeaBIOS
Fourth digit in release number means PC Engines patch.

## [Unreleased]
## [rel-1.12.1.2] - 2019-06-04
### Changed
- increased maximum timeout values in SD interface to correctly detect and
communicate with SD cards in SD 3.0 mode

### Added
- hard disk fallback boot functionality:
- SeaBIOS will now loop through all detected hard disks (SATA, mSATA, USB,
SD) according to bootorder and try to boot from it;
- SeaBIOS will try next device only if MBR of the current drive is not
valid, i.e. the current device is not bootable
- secondary payloads (memtest, sortbootorder) will not be loaded
automatically, but only when desired (user has to enter boot menu with
F10 key and choose the payload explicitly)

## [rel-1.12.1.1] - 2019-04-03
### Changed
- rebased on SeaBIOS official repository commit f4c6e4c

### Added
- [rebase introduced new TPM menu option to enable/disable PCR banks](https://github.com/pcengines/apu2-documentation/blob/master/docs/tpm_menu.md)

## [rel-1.12.0.1] - 2019-01-09
### Changed
- rebased on SeaBIOS rel-1.12.0 stable release
Expand Down Expand Up @@ -77,7 +99,9 @@ Fourth digit in release number means PC Engines patch.
### Fixed
- prevented from printing character multiple times

[Unreleased]: https://github.com/pcengines/seabios/compare/rel-1.12.0.1...apu_support
[Unreleased]: https://github.com/pcengines/seabios/compare/rel-1.12.1.2...apu_support
[rel-1.12.1.2]: https://github.com/pcengines/seabios/compare/rel-1.12.1.1...rel-1.12.1.2
[rel-1.12.1.1]: https://github.com/pcengines/seabios/compare/rel-1.12.0.1...rel-1.12.1.1
[rel-1.12.0.1]: https://github.com/pcengines/seabios/compare/rel-1.11.0.7...rel-1.12.0.1
[rel-1.11.0.7]: https://github.com/pcengines/seabios/compare/rel-1.11.0.6...rel-1.11.0.7
[rel-1.11.0.6]: https://github.com/pcengines/seabios/compare/rel-1.11.0.5...rel-1.11.0.6
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Expand Up @@ -212,7 +212,7 @@ SRCVGA=src/output.c src/string.c src/hw/pci.c src/hw/serialio.c \
vgasrc/vgainit.c vgasrc/vgabios.c vgasrc/vgafb.c vgasrc/swcursor.c \
vgasrc/vgafonts.c vgasrc/vbe.c \
vgasrc/stdvga.c vgasrc/stdvgamodes.c vgasrc/stdvgaio.c \
vgasrc/clext.c vgasrc/bochsvga.c vgasrc/geodevga.c \
vgasrc/clext.c vgasrc/svgamodes.c vgasrc/atiext.c vgasrc/bochsvga.c vgasrc/geodevga.c \
src/fw/coreboot.c vgasrc/cbvga.c vgasrc/bochsdisplay.c vgasrc/ramfb.c

ifeq "$(CONFIG_VGA_FIXUP_ASM)" "y"
Expand Down
16 changes: 11 additions & 5 deletions docs/Mailinglist.md
@@ -1,8 +1,14 @@
For questions and general information about SeaBIOS, please subscribe
to the [SeaBIOS mailing
list](http://www.seabios.org/mailman/listinfo/seabios). If you're not
subscribed, your post will be held temporarily for moderator approval
(to combat spam).
to the
[SeaBIOS mailing list](https://mail.coreboot.org/postorius/lists/seabios.seabios.org/). It
is necessary to subscribe to the list in order to send emails (to
combat spam).

A mailing list archive is available at
A mailing list archive is available at:
<https://mail.coreboot.org/hyperkitty/list/seabios@seabios.org/>

Messages prior to January 2019 are archived at:
<http://www.seabios.org/pipermail/seabios/>

An unofficial archive is also available at:
<https://www.mail-archive.com/seabios@seabios.org/>
2 changes: 1 addition & 1 deletion src/block.c
Expand Up @@ -494,7 +494,6 @@ block_setup(void)
floppy_setup();
ata_setup();
ahci_setup();
sdcard_setup();
ramdisk_setup();
virtio_blk_setup();
virtio_scsi_setup();
Expand All @@ -504,6 +503,7 @@ block_setup(void)
pvscsi_setup();
mpt_scsi_setup();
nvme_setup();
sdcard_setup();
}

// Fallback handler for command requests not implemented by drivers
Expand Down
19 changes: 9 additions & 10 deletions src/bmp.c
Expand Up @@ -56,10 +56,9 @@ typedef struct tagRGBQUAD {
* arrange horizontal pixel data, add extra space in the dest buffer
* for every line
*/
static void raw_data_format_adjust_24bpp(u8 *src, u8 *dest, int width,
int height, int bytes_per_line_dest)
static void raw_data_format_adjust(u8 *src, u8 *dest, int width,
int height, int bytes_per_line_src, int bytes_per_line_dest)
{
int bytes_per_line_src = 3 * width;
int i;
for (i = 0 ; i < height ; i++) {
memcpy(dest + i * bytes_per_line_dest,
Expand Down Expand Up @@ -95,22 +94,22 @@ int bmp_decode(struct bmp_decdata *bmp, unsigned char *data, int data_size)
}

/* get bmp properties */
void bmp_get_size(struct bmp_decdata *bmp, int *width, int *height)
void bmp_get_info(struct bmp_decdata *bmp, int *width, int *height, int *bpp)
{
*width = bmp->width;
*height = bmp->height;
*bpp = bmp->bpp;
}

/* flush flat picture data to *pc */
int bmp_show(struct bmp_decdata *bmp, unsigned char *pic, int width
, int height, int depth, int bytes_per_line_dest)
int bmp_show(struct bmp_decdata *bmp, unsigned char *pic, int width,
int height, int depth, int bytes_per_line_dest)
{
if (bmp->datap == pic)
return 0;
/* now only support 24bpp bmp file */
if ((depth == 24) && (bmp->bpp == 24)) {
raw_data_format_adjust_24bpp(bmp->datap, pic, width, height,
bytes_per_line_dest);
if ((depth == bmp->bpp) && (bmp->bpp%8 == 0)) {
raw_data_format_adjust(bmp->datap, pic, width, height,
(bmp->bpp/8)*width, bytes_per_line_dest);
return 0;
}
return 1;
Expand Down
14 changes: 10 additions & 4 deletions src/boot.c
Expand Up @@ -607,8 +607,9 @@ static int HaveHDBoot, HaveFDBoot;
static void
add_bev(int type, u32 vector)
{
if (type == IPL_TYPE_HARDDISK && HaveHDBoot++)
return;
if (type == IPL_TYPE_HARDDISK) {
HaveHDBoot = 1;
}
if (type == IPL_TYPE_FLOPPY && HaveFDBoot++)
return;
if (BEVCount >= ARRAY_SIZE(BEV))
Expand Down Expand Up @@ -784,6 +785,8 @@ boot_fail(void)
reset();
}

int HDDSequence VARLOW = 0;

// Determine next boot method and attempt a boot using it.
static void
do_boot(int seq_nr)
Expand All @@ -803,13 +806,15 @@ do_boot(int seq_nr)
break;
case IPL_TYPE_HARDDISK:
printf("Booting from Hard Disk...\n");
boot_disk(0x80, 1);
boot_disk(0x80 | HDDSequence++, 1);
break;
case IPL_TYPE_CDROM:
boot_cdrom((void*)ie->vector);
break;
case IPL_TYPE_CBFS:
boot_cbfs((void*)ie->vector);
/* boot from CBFS only when hard disk present and as first selection */
if (HaveHDBoot && (seq_nr == 0))
boot_cbfs((void*)ie->vector);
break;
case IPL_TYPE_BEV:
boot_rom(ie->vector);
Expand All @@ -835,6 +840,7 @@ handle_18(void)
debug_enter(NULL, DEBUG_HDL_18);
int seq = BootSequence + 1;
BootSequence = seq;
printf("Trying next device: %d\n", BootSequence + 1);
do_boot(seq);
}

Expand Down
6 changes: 3 additions & 3 deletions src/bootsplash.c
Expand Up @@ -172,10 +172,10 @@ enable_bootsplash(void)
dprintf(1, "bmp_decode failed with return code %d...\n", ret);
goto done;
}
bmp_get_size(bmp, &width, &height);
bpp_require = 24;
bmp_get_info(bmp, &width, &height, &bpp_require);
}
/* jpeg would use 16 or 24 bpp video mode, BMP use 24bpp mode only */

// jpeg would use 16 or 24 bpp video mode, BMP uses 16/24/32 bpp mode.

// Try to find a graphics mode with the corresponding dimensions.
int videomode = find_videomode(vesa_info, mode_info, width, height,
Expand Down
3 changes: 3 additions & 0 deletions src/fw/paravirt.c
Expand Up @@ -75,6 +75,9 @@ static void qemu_detect(void)
if (!CONFIG_QEMU_HARDWARE)
return;

// Setup QEMU debug output port
qemu_debug_preinit();

// check northbridge @ 00:00.0
u16 v = pci_config_readw(0, PCI_VENDOR_ID);
if (v == 0x0000 || v == 0xffff)
Expand Down
3 changes: 3 additions & 0 deletions src/fw/paravirt.h
Expand Up @@ -49,6 +49,9 @@ static inline int runningOnKVM(void) {
// QEMU_CFG_DMA ID bit
#define QEMU_CFG_VERSION_DMA 2

// QEMU debugcon read value
#define QEMU_DEBUGCON_READBACK 0xe9

int qemu_cfg_enabled(void);
int qemu_cfg_dma_enabled(void);
void qemu_preinit(void);
Expand Down
2 changes: 1 addition & 1 deletion src/hw/pvscsi.c
Expand Up @@ -167,7 +167,7 @@ pvscsi_init_rings(void *iobase, struct pvscsi_ring_dsc_s **ring_dsc)
{
struct PVSCSICmdDescSetupRings cmd = {0,};

struct pvscsi_ring_dsc_s *dsc = memalign_high(PAGE_SIZE, sizeof(*dsc));
struct pvscsi_ring_dsc_s *dsc = malloc_high(sizeof(*dsc));
if (!dsc) {
warn_noalloc();
return;
Expand Down
9 changes: 6 additions & 3 deletions src/hw/sdcard.c
Expand Up @@ -135,7 +135,7 @@ struct sdhci_s {
#define SDHCI_POWER_ON_TIME 5
#define SDHCI_CLOCK_ON_TIME 1 // 74 clock cycles
#define SDHCI_POWERUP_TIMEOUT 1000
#define SDHCI_PIO_TIMEOUT 1000 // XXX - this is just made up
#define SDHCI_PIO_TIMEOUT 3000 // XXX - this is just made up

// Internal 'struct drive_s' storage for a detected card
struct sddrive_s {
Expand Down Expand Up @@ -492,10 +492,13 @@ static void
sdcard_controller_setup(struct sdhci_s *regs, int prio)
{
// Initialize controller
u32 present_state = readl(&regs->present_state);
if (!(present_state & SP_CARD_INSERTED))
int state = sdcard_waitw((u16 *)(&regs->present_state) + 1,
SP_CARD_INSERTED >> 16);
if (state == -1) {
// No card present
dprintf(3, "%s: No card present!\n", __func__);
return;
}
dprintf(3, "sdhci@%p ver=%x cap=%x %x\n", regs
, readw(&regs->controller_version)
, readl(&regs->cap_lo), readl(&regs->cap_hi));
Expand Down
16 changes: 14 additions & 2 deletions src/hw/serialio.c
Expand Up @@ -103,11 +103,23 @@ serial_debug_flush(void)

u16 DebugOutputPort VARFSEG = 0x402;

void
qemu_debug_preinit(void)
{
/* Check if the QEMU debug output port is active */
if (CONFIG_DEBUG_IO &&
inb(GET_GLOBAL(DebugOutputPort)) != QEMU_DEBUGCON_READBACK)
DebugOutputPort = 0;
}

// Write a character to the special debugging port.
void
qemu_debug_putc(char c)
{
if (CONFIG_DEBUG_IO && runningOnQEMU())
if (!CONFIG_DEBUG_IO || !runningOnQEMU())
return;
u16 port = GET_GLOBAL(DebugOutputPort);
if (port)
// Send character to debug port.
outb(c, GET_GLOBAL(DebugOutputPort));
outb(c, port);
}
1 change: 1 addition & 0 deletions src/hw/serialio.h
Expand Up @@ -24,6 +24,7 @@ void serial_debug_preinit(void);
void serial_debug_putc(char c);
void serial_debug_flush(void);
extern u16 DebugOutputPort;
void qemu_debug_preinit(void);
void qemu_debug_putc(char c);

#endif // serialio.h
1 change: 1 addition & 0 deletions src/hw/usb-ehci.c
Expand Up @@ -467,6 +467,7 @@ ehci_realloc_pipe(struct usbdevice_s *usbdev, struct usb_pipe *upipe
// Use previously allocated pipe.
struct ehci_pipe *pipe = container_of(usbpipe, struct ehci_pipe, pipe);
ehci_desc2pipe(pipe, usbdev, epdesc);
pipe->qh.token = 0;
return usbpipe;
}

Expand Down
2 changes: 1 addition & 1 deletion src/hw/usb-xhci.c
Expand Up @@ -333,7 +333,7 @@ xhci_hub_detect(struct usbhub_s *hub, u32 port)
{
struct usb_xhci_s *xhci = container_of(hub->cntl, struct usb_xhci_s, usb);
u32 portsc = readl(&xhci->pr[port].portsc);
xhci_print_port_state(3, __func__, port, portsc);
xhci_print_port_state(8, __func__, port, portsc);
return (portsc & XHCI_PORTSC_CCS) ? 1 : 0;
}

Expand Down
3 changes: 3 additions & 0 deletions src/output.c
Expand Up @@ -74,6 +74,9 @@ static struct putcinfo debuginfo = { debug_putc };
static void
screenc(char c)
{
if (!MODESEGMENT && GET_IVT(0x10).segoff == FUNC16(entry_10).segoff)
// No need to thunk to 16bit mode if vgabios is not present
return;
struct bregs br;
memset(&br, 0, sizeof(br));
br.flags = F_IF;
Expand Down
17 changes: 17 additions & 0 deletions src/std/tcg.h
Expand Up @@ -336,6 +336,12 @@ struct tpm_res_sha1complete {
#define TPM2_ALG_SHA512 0x000d
#define TPM2_ALG_SM3_256 0x0012

#define TPM2_ALG_SHA1_FLAG (1 << 0)
#define TPM2_ALG_SHA256_FLAG (1 << 1)
#define TPM2_ALG_SHA384_FLAG (1 << 2)
#define TPM2_ALG_SHA512_FLAG (1 << 3)
#define TPM2_ALG_SM3_256_FLAG (1 << 4)

/* TPM 2 command tags */
#define TPM2_ST_NO_SESSIONS 0x8001
#define TPM2_ST_SESSIONS 0x8002
Expand All @@ -345,8 +351,10 @@ struct tpm_res_sha1complete {
#define TPM2_CC_Clear 0x126
#define TPM2_CC_ClearControl 0x127
#define TPM2_CC_HierarchyChangeAuth 0x129
#define TPM2_CC_PCR_Allocate 0x12b
#define TPM2_CC_SelfTest 0x143
#define TPM2_CC_Startup 0x144
#define TPM2_CC_Shutdown 0x145
#define TPM2_CC_StirRandom 0x146
#define TPM2_CC_GetCapability 0x17a
#define TPM2_CC_GetRandom 0x17b
Expand Down Expand Up @@ -442,6 +450,15 @@ struct tpm2_res_getcapability {
u8 data[0]; /* capability dependent data */
} PACKED;

struct tpm2_req_pcr_allocate {
struct tpm_req_header hdr;
u32 authhandle;
u32 authblocksize;
struct tpm2_authblock authblock;
u32 count;
u8 tpms_pcr_selections[4];
} PACKED;

struct tpms_pcr_selection {
u16 hashAlg;
u8 sizeOfSelect;
Expand Down