Add generic qemu detection

This patch adds support for detecting whenever SeaBIOS runs on qemu
or not.  This is done by looking at the northbridge (pci device 00:00.0)
and check the subsystem id.  Most pci devices emulated by qemu -- the
two northbridges i440fx and q35 included -- have a subsystem id of
"1af4:1100".

In case the subsystem ID matches set PF_QEMU, log a message (including
the northbridge found while being at it) and also check for kvm.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Drop coreboot qemu detection

Not needed any more, the new qemu_detect() function
does the job instead.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Add qemu detection to csm

Add a qemu_preinit() call to csm initialization,
so PF_QEMU gets set when running on qemu.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
uas: add (temporary) superspeed stopgap

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
usb: add usb_update_pipe()

Preparation for better xhci support: allows to notify host controllers
instead of going through a free+alloc cycle.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
usb: add xhci support

$subject says all.  Support for usb3 streams is not implemented yet,
otherwise it is fully functional.  Tested all usb devices supported
by qemu (keyboard, storage, usb hubs), except for usb attached scsi
in usb3 mode (which needs streams).

Tested on qemu only, tagged with QEMU_HARDWARE because of that.
Testing with physical hardware to be done.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
fix buildversion.sh

Recent git versions place the submodule git repos into the
.git/modules directory of the toplevel repo.  In that case
.git of the seabios tree isn't a directory, but a regular
file, saying where the gitdir is.

Extent the git check to also allow .git being a regular file,
so buildversion.sh works correctly when called within the qemu
submodule.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
build: simplify cross builds

This patch simplifies seabios cross-builds on !x86 platforms.
It adds a CROSS_PREFIX variable which is used to set CC, LD &
friends to the cross build binaries.  It also moves the common
command definitions up in the Makefile to make sure CC is set
correctly when probing compiler flags using $(call cc-option ...)

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Move PIT setup from clock.c to hw/timer.c.

Move the hardware setup to the hw/timer.c code.  This eliminates the
need for a separate hw/pit.h file with definitions.

Also, move the IRQ counting code (which is dependent on the BDA) from
hw/timer.c to clock.c.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Rename hw/cmos.h to hw/rtc.h and copy RTC code from clock.c to hw/rtc.c.

Group the Real Time Clock code into hw/rtc.[ch].

Also, use rtc_read/write/mask function naming (instead of
inb/outb_cmos) to be more consistent with other register accessors.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Move dma code to new file hw/dma.c.

Move the DMA controller code in resume.c and hw/floppy.c to a new file
hw/dma.c.  This centralizes the DMA controller code into one place.

Also, don't unmask the floppy DRQ during floppy setup - there is no
reason to unmask the DRQ prior to a command being programmed into the
DMA controller.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Remove ioport.h; disperse its contents to other header files.

Move the inb(), insb(), etc. code from ioport.h to x86.h.  Move the
PORT_* definitions to their appropriate hardware files.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Minor - update file comments in src/malloc.c.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>