A BCV will (almost assuredly) be a hard drive, so it makes sense to
prioritize them the same as builtin hard drives when only the legacy
priority system is used.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Some versions of gcc appear to define these sections even though they
aren't used in the code.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
(cherry picked from commit 805ede2bd3)
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Add PYTHON definition to Makefile so users can override it. This
allows users to specify an exact python executable name to use during
the build.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
(backported from 97f1ffcfac)
The fw paths for USB devices that SeaBIOS computes are off-by-one,
because QEMU builds those paths with a numbering that starts from one
(see usb_fill_port and usb_hub_initfn in QEMU). Fix that so that
the numbering agrees.
If there are no memory allocations for a given type then the "max" bar
size is zero. However, ALIGN_DOWN does not handle an alignment of
zero properly. Catch and handle the zero case.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Some versions of gcc have difficulties with externally visible
variables that are used before they are declared. Now that pmm.c
contains only 32bit code and has a reference to CanPreempt, make sure
the declaration of CanPreempt (in stacks.c) is compiled first.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This prevents lockups when trying to allocate PCI resources on an
ISA-only system like QEMU can emulate.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
QEmu only copies the top 128K of the BIOS image to low memory
(0xe0000-0xfffff). Images over 128K are only fully mapped in high
memory (0xfff00000). However, the SeaBIOS shadow functions
(make_bios_writable_intel) will copy up to 256K to low memory.
SeaBIOS generally works with 256K roms because they are automatically
copied to low memory during the BIOS init. However, this only works
if the shadow function code is itself part of the bios image that is
placed in low memory by QEmu.
Defining handle_post() as VISIBLE32FLAT will make the linker scripts
more likely to place the initial shadow code in the last 128K of the
image.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Move ACPI_HPET_ADDRESS to BUILD_HPET_ADDRESS in config.h so that it
is listed with similar hardcoded addresses.
Also, organize the BUILD_*_ADDRESS definitions in config.h.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
QEMU does not provide a HPET block if it was configured with -no-hpet,
other machines SeaBIOS runs on may lack a HPET as well. Perform basic
checks the ID register for a reasonable vendor ID and a clock period
within the valid range, do not build the HPET table if that fails.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
The coreboot init code now looks for an existing smbios table and will
use it. A locally generated smbios table will only be created if no
coreboot table is found.
The switch to the two-pass pci initialization dropped the isa bridge
initialization by accident. That broke interrupts on FreeBSD 4.4 and
maybe also other older guests which don't use ACPI for IRQ routing
setup. Add the bits back in.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Tested-by: Bjørn Mork <bjorn@mork.no>
Lack of real hardware testing was the main reason to turn it off by
default. The AHCI has been fixed to work on both qemu and real
hardware, so lets flip the switch now.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Also allocate the ahci port struct itself from tmp memory for probing,
then copy to fseg memory in case we detected some device. This way we
don't waste fseg memory for unused ports.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Stick description and boot priority into the port struct, so it
holds everything needed to register the device, so we can do
the registration after ahci_port_init returned.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Instead if creating a single thread which probes all ports one after
another kick one thread per port, so ports are probed in parallel.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
If the SMBIOS is small (less than 600 bytes) allow it to be allocated
in the f-segment. This works around a bug in JunOS - it crashes on
SMBIOS tables located in high memory.
Windows Server 2008 checked build complains about lack of consistency
between MTRR MSRs in SMP guests.
Problem is the smp_mtrr array is not large enough to hold all MSRs (31
entries with current qemu/kvm implementations).
Increase it to 32.
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Wind up bootprio support in the ahci driver so boot device ordering
works for ahci disks too. No extra work needed on qemu side.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Rework init workflow to match suggestions in the ahci specs better,
especially remove the shortcut which tries to detect drives without
enabling FIS receiving. This makes memory allocation a bit complicated
as we are using malloc_tmp() allocated memory now to probe the devices
so we can free it when no drive is present. In case we detect a drive
we have to free and realloc the memory with malloc_low() so it is
available after POST when the boot loader wants read stuff via int13.
Also use TSC to calculate timeout instead of delays and loop counts.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
This change allows unaligned buffers to be used for reads or writes
to non-atapi devices. Currently only MS-DOS boot is known to need
unaligned buffer support.
Signed-off-by: Scott Duplichan <scott@notabs.org>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Poll interrupt status register to figure when the device has updated the
status and possibly finished the request, continue polling until BSY is
clear as we might see multiple status updates per request.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
FIS setup does't follow the SATA specs, fix it.
Credits go to Jonathan Kollasch and Scott Duplichan for finding those.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
This was somehow dropped during the iterations of the original Xen patches.
It's actually harmless at the moment since there are no users of hypercalls but
patches are being written to support Xen PV block devices which need this.
It's not clear exactly how early this needs to be but I think it needs to be at
least before init_hw() (since that would detect disk devices).
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Now that the PMM code is only run in 32bit mode, remove the
GET/SET_PMMVAR macros and other 16bit wrappers.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This patch actually enables the two-pass pci initialization and
deactivates the old pci initialization bits.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
This patch adds a second device scan to the pci initialization, which
counts the memory bars of the various sizes and types. Then it
calculates the sizes and the packing of the prefetchable and
non-prefetchable pci memory windows and prints the results.
The patch doesn't actually map the devices to make debugging easier.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Detect a resume/reboot by inspecting HaveRunPost instead of inspecting
the cmos reset code. Inspecting a global variable is both simpler and
safer.
Move the reboot logic from post.c to resume.c - this makes the code in
post.c simpler as it is now only called once on machine startup. This
also makes it easier to ensure all POST initialization code resides in
the relocatable "init" sections.
Also, rename _start() to handle_post() so that it is more in keeping
with the entry_xxx() and handle_xxx() function naming.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
When CONFIG_THREAD_OPTIONROMS is enabled, accessing the PCI config
space from a thread could potentially race with an option rom. Make
sure the ohci/uhci_init() functions (which access PCI config space)
are never run while an optionrom could also be running.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>