Showing with 4,005 additions and 1,077 deletions.
  1. +56 −0 CHANGELOG.md
  2. +3 −2 Makefile
  3. +3 −3 docs/Memory_Model.md
  4. +29 −0 docs/Releases.md
  5. +24 −0 src/Kconfig
  6. +22 −18 src/block.c
  7. +3 −2 src/block.h
  8. +108 −46 src/boot.c
  9. +3 −3 src/cdrom.c
  10. +1 −0 src/clock.c
  11. +275 −0 src/cp437.c
  12. +1 −0 src/cp437.h
  13. +109 −109 src/disk.c
  14. +9 −9 src/fw/biostables.c
  15. +62 −6 src/fw/coreboot.c
  16. +45 −0 src/fw/coreboot.h
  17. +52 −0 src/fw/dev-pci.h
  18. +87 −26 src/fw/paravirt.c
  19. +6 −1 src/fw/paravirt.h
  20. +103 −5 src/fw/pciinit.c
  21. +99 −17 src/fw/romfile_loader.c
  22. +42 −23 src/fw/romfile_loader.h
  23. +13 −1 src/fw/shadow.c
  24. +10 −1 src/fw/smm.c
  25. +1 −1 src/fw/smp.c
  26. +7 −3 src/hw/ahci.c
  27. +13 −13 src/hw/ata.c
  28. +103 −4 src/hw/blockcmd.c
  29. +4 −0 src/hw/blockcmd.h
  30. +26 −11 src/hw/esp-scsi.c
  31. +10 −10 src/hw/floppy.c
  32. +27 −12 src/hw/lsi-scsi.c
  33. +1 −1 src/hw/megasas.c
  34. +31 −19 src/hw/mpt-scsi.c
  35. +199 −0 src/hw/nvme-int.h
  36. +708 −0 src/hw/nvme.c
  37. +17 −0 src/hw/nvme.h
  38. +24 −1 src/hw/pci.c
  39. +3 −0 src/hw/pci.h
  40. +4 −0 src/hw/pci_ids.h
  41. +0 −24 src/hw/pcidevice.c
  42. +0 −1 src/hw/pcidevice.h
  43. +12 −1 src/hw/ps2port.c
  44. +2 −2 src/hw/pvscsi.c
  45. +1 −1 src/hw/ramdisk.c
  46. +12 −2 src/hw/sdcard.c
  47. +34 −10 src/hw/serialio.c
  48. +31 −24 src/hw/timer.c
  49. +2 −2 src/hw/usb-msc.c
  50. +30 −17 src/hw/usb-uas.c
  51. +113 −108 src/hw/usb-xhci.c
  52. +1 −1 src/hw/usb.c
  53. +2 −1 src/hw/usb.h
  54. +9 −8 src/hw/virtio-blk.c
  55. +3 −3 src/hw/virtio-pci.c
  56. +0 −1 src/hw/virtio-ring.c
  57. +1 −0 src/hw/virtio-ring.h
  58. +29 −15 src/hw/virtio-scsi.c
  59. +17 −1 src/kbd.c
  60. +0 −8 src/misc.c
  61. +16 −13 src/optionroms.c
  62. +2 −0 src/post.c
  63. +6 −2 src/resume.c
  64. +90 −3 src/romfile.c
  65. +2 −0 src/romfile.h
  66. +49 −1 src/romlayout.S
  67. +665 −0 src/sercon.c
  68. +13 −5 src/stacks.c
  69. +0 −7 src/std/acpi.h
  70. +97 −102 src/std/tcg.h
  71. +281 −358 src/tcgbios.c
  72. +9 −1 src/util.h
  73. +4 −3 src/x86.h
  74. +114 −3 vgasrc/cbvga.c
  75. +5 −0 vgasrc/stdvga.c
  76. +1 −1 vgasrc/vbe.c
  77. +1 −1 vgasrc/vgabios.h
  78. +6 −0 vgasrc/vgahw.h
  79. +2 −0 vgasrc/vgautil.h
56 changes: 56 additions & 0 deletions CHANGELOG.md
@@ -0,0 +1,56 @@
Change log for PC Engines fork of SeaBIOS
=========================================

Fourth digit in release number means PC Engines patch.

## [Unreleased]

## [rel-1.11.0.1] - 2017-11-30
### Changed
- rebased to 1.11.0 stable mainline
- removed SgaBIOS option rom enable/disable sortbootorder config handling

## [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.11.0.1...apu_support
[rel-1.11.0.1]: https://github.com/pcengines/seabios/compare/rel-1.11.0.1...rel-1.10.2.1
[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
5 changes: 3 additions & 2 deletions Makefile
Expand Up @@ -29,7 +29,8 @@ LD32BIT_FLAG:=-melf_i386

# Source files
SRCBOTH=misc.c stacks.c output.c string.c block.c cdrom.c disk.c mouse.c kbd.c \
system.c serial.c clock.c resume.c pnpbios.c vgahooks.c pcibios.c apm.c \
system.c serial.c sercon.c clock.c resume.c pnpbios.c vgahooks.c pcibios.c \
apm.c cp437.c \
hw/pci.c hw/timer.c hw/rtc.c hw/dma.c hw/pic.c hw/ps2port.c hw/serialio.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 \
Expand All @@ -43,7 +44,7 @@ SRC32FLAT=$(SRCBOTH) post.c e820map.c malloc.c romfile.c x86.c optionroms.c \
fw/paravirt.c fw/shadow.c fw/pciinit.c fw/smm.c fw/smp.c fw/mtrr.c fw/xen.c \
fw/acpi.c fw/mptable.c fw/pirtable.c fw/smbios.c fw/romfile_loader.c \
hw/virtio-ring.c hw/virtio-pci.c hw/virtio-blk.c hw/virtio-scsi.c \
hw/tpm_drivers.c
hw/tpm_drivers.c hw/nvme.c
SRC32SEG=string.c output.c pcibios.c apm.c stacks.c hw/pci.c hw/serialio.c
DIRS=src src/hw src/fw vgasrc

Expand Down
6 changes: 3 additions & 3 deletions docs/Memory_Model.md
Expand Up @@ -192,7 +192,7 @@ There are three low-level memory access macros:
* GET_FARVAR / SET_FARVAR : Assigns the extra segment (%es) to the
given segment id and then performs the given memory access via %es.

* GET_FLATVAR / SET_FLATVAR : These macros take a 32bit pointer,
* GET_FLATPTR / SET_FLATPTR : These macros take a 32bit pointer,
construct a segment/offset pair valid in real mode, and then perform
the given access. These macros must not be used in 16bit protected
mode or 32bit segmented mode.
Expand All @@ -209,11 +209,11 @@ macros are also available.

* GET_LOW / SET_LOW : Access internal variables marked with
VARLOW. (There are also related macros GET_LOWFLAT / SET_LOWFLAT for
accessing storage allocated with malloc_low).
accessing storage allocated with malloc_low.)

* GET_GLOBAL : Access internal variables marked with the VAR16 or
VARFSEG flags. (There is also the related macro GET_GLOBALFLAT for
accessing storage allocated with malloc_fseg).
accessing storage allocated with malloc_fseg.)

Memory available during initialization
======================================
Expand Down
29 changes: 29 additions & 0 deletions docs/Releases.md
@@ -1,6 +1,19 @@
History of SeaBIOS releases. Please see [download](Download) for
information on obtaining these releases.

SeaBIOS 1.11.0
==============

Available on 20171110. Major changes in this release:

* Initial support for NVME drives
* Support for vga emulation over a serial port in SeaBIOS (sercon)
* Support for serial debugging using MMIO based serial ports
* Support for scsi devices with multiple LUNs
* Support for boot-to-boot persistent coreboot cbmem logs
* Improved coreboot vga (cbvga) mode setting compatibility
* Several bug fixes and code cleanups

SeaBIOS 1.10.0
==============

Expand All @@ -12,6 +25,22 @@ Available on 20161026. Major changes in this release:
* Support for virtio devices mapped above 4GB
* Several bug fixes and code cleanups

SeaBIOS 1.10.1
--------------

Available on 20161122. Stable release containing only bug fixes.


SeaBIOS 1.10.2
--------------

Available on 20170228. Stable release containing only bug fixes.

SeaBIOS 1.10.3
--------------

Available on 20171019. Stable release containing only bug fixes.

SeaBIOS 1.9.0
=============

Expand Down
24 changes: 24 additions & 0 deletions src/Kconfig
Expand Up @@ -227,6 +227,12 @@ menu "Hardware support"
help
Support floppy images stored in coreboot flash or from
QEMU fw_cfg.
config NVME
depends on DRIVES
bool "NVMe controllers"
default y
help
Support for NVMe disk code.

config PS2PORT
depends on KEYBOARD || MOUSE
Expand Down Expand Up @@ -300,6 +306,11 @@ menu "Hardware support"
default y
help
Support serial ports. This also enables int 14 serial port calls.
config SERCON
bool "Serial console"
default y
help
Support redirecting vga output to the serial console.
config LPT
bool "Parallel port"
default y
Expand Down Expand Up @@ -532,6 +543,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
40 changes: 22 additions & 18 deletions src/block.c
Expand Up @@ -20,6 +20,7 @@
#include "hw/usb-uas.h" // uas_process_op
#include "hw/virtio-blk.h" // process_virtio_blk_op
#include "hw/virtio-scsi.h" // virtio_scsi_process_op
#include "hw/nvme.h" // nvme_process_op
#include "malloc.h" // malloc_low
#include "output.h" // dprintf
#include "stacks.h" // call32
Expand Down Expand Up @@ -297,7 +298,7 @@ map_floppy_drive(struct drive_s *drive)

// Fill in EDD info
static int
fill_generic_edd(struct segoff_s edd, struct drive_s *drive_gf
fill_generic_edd(struct segoff_s edd, struct drive_s *drive_fl
, u32 dpte_so, u8 bus_iface, u32 iface_path, u32 device_path)
{
u16 seg = edd.seg;
Expand All @@ -311,12 +312,12 @@ fill_generic_edd(struct segoff_s edd, struct drive_s *drive_gf

// EDD 1.x

u8 type = GET_GLOBALFLAT(drive_gf->type);
u16 npc = GET_GLOBALFLAT(drive_gf->pchs.cylinder);
u16 nph = GET_GLOBALFLAT(drive_gf->pchs.head);
u16 nps = GET_GLOBALFLAT(drive_gf->pchs.sector);
u64 lba = GET_GLOBALFLAT(drive_gf->sectors);
u16 blksize = GET_GLOBALFLAT(drive_gf->blksize);
u8 type = GET_FLATPTR(drive_fl->type);
u16 npc = GET_FLATPTR(drive_fl->pchs.cylinder);
u16 nph = GET_FLATPTR(drive_fl->pchs.head);
u16 nps = GET_FLATPTR(drive_fl->pchs.sector);
u64 lba = GET_FLATPTR(drive_fl->sectors);
u16 blksize = GET_FLATPTR(drive_fl->blksize);

dprintf(DEBUG_HDL_13, "disk_1348 size=%d t=%d chs=%d,%d,%d lba=%d bs=%d\n"
, size, type, npc, nph, nps, (u32)lba, blksize);
Expand Down Expand Up @@ -466,19 +467,19 @@ fill_ata_edd(struct segoff_s edd, struct drive_s *drive_gf)

// Fill Extended Disk Drive (EDD) "Get drive parameters" info for a drive
int noinline
fill_edd(struct segoff_s edd, struct drive_s *drive_gf)
fill_edd(struct segoff_s edd, struct drive_s *drive_fl)
{
switch (GET_GLOBALFLAT(drive_gf->type)) {
switch (GET_FLATPTR(drive_fl->type)) {
case DTYPE_ATA:
case DTYPE_ATA_ATAPI:
return fill_ata_edd(edd, drive_gf);
return fill_ata_edd(edd, drive_fl);
case DTYPE_VIRTIO_BLK:
case DTYPE_VIRTIO_SCSI:
return fill_generic_edd(
edd, drive_gf, 0xffffffff, EDD_PCI | EDD_SCSI
, edd_pci_path(GET_GLOBALFLAT(drive_gf->cntl_id), 0), 0);
edd, drive_fl, 0xffffffff, EDD_PCI | EDD_SCSI
, edd_pci_path(GET_FLATPTR(drive_fl->cntl_id), 0), 0);
default:
return fill_generic_edd(edd, drive_gf, 0, 0, 0, 0);
return fill_generic_edd(edd, drive_fl, 0, 0, 0, 0);
}
}

Expand All @@ -502,6 +503,7 @@ block_setup(void)
megasas_setup();
pvscsi_setup();
mpt_scsi_setup();
nvme_setup();
}

// Fallback handler for command requests not implemented by drivers
Expand All @@ -525,7 +527,7 @@ default_process_op(struct disk_op_s *op)
static int
process_op_both(struct disk_op_s *op)
{
switch (GET_GLOBALFLAT(op->drive_gf->type)) {
switch (GET_FLATPTR(op->drive_fl->type)) {
case DTYPE_ATA_ATAPI:
return ata_atapi_process_op(op);
case DTYPE_USB:
Expand Down Expand Up @@ -554,7 +556,7 @@ int VISIBLE32FLAT
process_op_32(struct disk_op_s *op)
{
ASSERT32FLAT();
switch (op->drive_gf->type) {
switch (op->drive_fl->type) {
case DTYPE_VIRTIO_BLK:
return virtio_blk_process_op(op);
case DTYPE_AHCI:
Expand All @@ -571,6 +573,8 @@ process_op_32(struct disk_op_s *op)
return virtio_scsi_process_op(op);
case DTYPE_PVSCSI:
return pvscsi_process_op(op);
case DTYPE_NVME:
return nvme_process_op(op);
default:
return process_op_both(op);
}
Expand All @@ -581,7 +585,7 @@ static int
process_op_16(struct disk_op_s *op)
{
ASSERT16();
switch (GET_GLOBALFLAT(op->drive_gf->type)) {
switch (GET_FLATPTR(op->drive_fl->type)) {
case DTYPE_FLOPPY:
return floppy_process_op(op);
case DTYPE_ATA:
Expand All @@ -600,11 +604,11 @@ int
process_op(struct disk_op_s *op)
{
dprintf(DEBUG_HDL_13, "disk_op d=%p lba=%d buf=%p count=%d cmd=%d\n"
, op->drive_gf, (u32)op->lba, op->buf_fl
, op->drive_fl, (u32)op->lba, op->buf_fl
, op->count, op->command);

int ret, origcount = op->count;
if (origcount * GET_GLOBALFLAT(op->drive_gf->blksize) > 64*1024) {
if (origcount * GET_FLATPTR(op->drive_fl->blksize) > 64*1024) {
op->count = 0;
return DISK_RET_EBOUNDARY;
}
Expand Down
5 changes: 3 additions & 2 deletions src/block.h
Expand Up @@ -10,7 +10,7 @@

struct disk_op_s {
void *buf_fl;
struct drive_s *drive_gf;
struct drive_s *drive_fl;
u8 command;
u16 count;
union {
Expand Down Expand Up @@ -82,6 +82,7 @@ struct drive_s {
#define DTYPE_PVSCSI 0x83
#define DTYPE_MPT_SCSI 0x84
#define DTYPE_SDCARD 0x90
#define DTYPE_NVME 0x91

#define MAXDESCSIZE 80

Expand Down Expand Up @@ -111,7 +112,7 @@ void map_floppy_drive(struct drive_s *drive);
void map_hd_drive(struct drive_s *drive);
void map_cd_drive(struct drive_s *drive);
struct int13dpt_s;
int fill_edd(struct segoff_s edd, struct drive_s *drive_gf);
int fill_edd(struct segoff_s edd, struct drive_s *drive_fl);
void block_setup(void);
int default_process_op(struct disk_op_s *op);
int process_op(struct disk_op_s *op);
Expand Down