]> xenbits.xensource.com Git - seabios.git/log
seabios.git
12 years agoAdd global struct geode
Christian Gmeiner [Sat, 1 Sep 2012 15:13:02 +0000 (17:13 +0200)]
Add global struct geode

This struct is used to store some PCI BAR values, which are used
during hw init.

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
12 years agoUpdate VBE variables
Christian Gmeiner [Sat, 1 Sep 2012 15:13:01 +0000 (17:13 +0200)]
Update VBE variables

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
12 years agoAdd framebuffer size detection
Christian Gmeiner [Sat, 1 Sep 2012 15:12:56 +0000 (17:12 +0200)]
Add framebuffer size detection

It is possible to read out the framebuffer size via msr. The size
information is needed for VESA later.

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
12 years agoRemove Extened CRTC Register functions
Christian Gmeiner [Sat, 1 Sep 2012 15:12:54 +0000 (17:12 +0200)]
Remove Extened CRTC Register functions

As the access the DC registers via memory, we dont need to
work with the extended CRTC register to setup the DC-VGA-mapping.

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
12 years agoRemove all dc_ functions as they are not needed anymore
Christian Gmeiner [Sat, 1 Sep 2012 15:12:53 +0000 (17:12 +0200)]
Remove all dc_ functions as they are not needed anymore

As we access teh DC registers via memory we do not need all
the DC-VGA-mapping functions anymore.

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
12 years agoAccess DC registers via geode_mem[Read|Write]
Christian Gmeiner [Sat, 1 Sep 2012 15:12:52 +0000 (17:12 +0200)]
Access DC registers via geode_mem[Read|Write]

There is no reason to access the DC registers via VGA
memory mapping if we could the access via memory.

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
12 years agoacpi: LNKS is not needed
Paolo Bonzini [Tue, 7 Aug 2012 13:01:29 +0000 (15:01 +0200)]
acpi: LNKS is not needed

LNKS is a bit strange in that it reuses the same PIIX register as LNKA,
but has a different interrupt.  This means that the _CRS it returns will
not be one of the possible resources from _PRS.  This shows up in the
Linux boot logs as

   ACPI: PCI Interrupt Link [LNKS] (IRQs 9) *0

Instead of that, we can simply use a hardwired interrupt index.

Cc: Gleb Natapov <gnatapov@redhat.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
12 years agoacpi: build PCI hotplug devices from a single template
Paolo Bonzini [Thu, 2 Aug 2012 13:07:26 +0000 (15:07 +0200)]
acpi: build PCI hotplug devices from a single template

More than 1kb of data is taken by the 32 copies of the PCI hotplug SSDT
methods.  We can build them from a single template like we do for CPUs
(wrapped in a Scope(\_SB.PCI0) block).

Three items differ for each slot: the device name, bits 16-23 of _ADR,
the _SUN value.  On top of this we have to rename the eject method for
non-removable slots, like we already do in build_pcihp.

There is a small change in the ASL: instead of including the number of
the slot in the implementation of _EJ0, we just call _SUN.  This is also
similar to what we do for CPU hotplug.

Once we do this, there is no need to keep a separate SSDT for PCI hotplug.
Everything can reside in the same table.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
12 years agoacpi: build PCNT dynamically
Paolo Bonzini [Thu, 2 Aug 2012 13:07:25 +0000 (15:07 +0200)]
acpi: build PCNT dynamically

We already build the CPU notification method in src/acpi.c, and we can
reuse most of the code for PCI hotplug.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
12 years agoacpi_extract: detect DeviceOp
Paolo Bonzini [Thu, 2 Aug 2012 13:07:24 +0000 (15:07 +0200)]
acpi_extract: detect DeviceOp

The DeviceOp AML opcode has more or less the same structure as ProcessorOp,
except that there is no processor ID.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
12 years agoacpi_extract: fix off-by-one
Paolo Bonzini [Thu, 2 Aug 2012 13:07:23 +0000 (15:07 +0200)]
acpi_extract: fix off-by-one

Single-byte package length values do use bits 4-5, and this will
happen with the PCI hotplug devices.  pkglenbytes has not yet been
decremented, so multi-byte values are detected with pkglenbytes > 1.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
12 years agoacpi: rename Processor SSDT constants
Paolo Bonzini [Thu, 2 Aug 2012 13:07:22 +0000 (15:07 +0200)]
acpi: rename Processor SSDT constants

A simple rename, to prepare for the later introduction of similar constants
for PCI slots.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
12 years agoacpi: move s3/s4/s5 to build_ssdt
Paolo Bonzini [Thu, 2 Aug 2012 13:07:21 +0000 (15:07 +0200)]
acpi: move s3/s4/s5 to build_ssdt

Move the _S3/_S4/_S5 packages out of ssdt-pcihp.dsl and into a separate
file.  Correspondingly, move the patching from build_pcihp to build_ssdt.
Place this part at the beginning of the SSDT.  Offset computation is a
bit simpler, and anyway the packages do not need to be inside Scope(_SB).

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
12 years agoMakefile: delete output on error
Michael S. Tsirkin [Thu, 30 Aug 2012 09:59:31 +0000 (12:59 +0300)]
Makefile: delete output on error

I had a disk full condition and a partial hex file
got generated. Following make failed trying to use it.
We can make build a bit more robust by instructing
make to remove output files on error.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
12 years agoapic_id_is_present: fix undefined behavior
Eduardo Habkost [Fri, 31 Aug 2012 18:11:16 +0000 (15:11 -0300)]
apic_id_is_present: fix undefined behavior

This patch addresses some feedback sent by Laszlo[1] on the
non-contiguous APIC ID patches I have sent recently.

 - (1 << 31) is undefined for 32-bit signed ints
 - Use !! on the returned value, so the function return value
   can be an int without a unsigned -> signed conversion

[] http://article.gmane.org/gmane.comp.emulators.qemu/162163

Cc: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
12 years agoUse cpu_to_be32() (and related) instead of htonl (and related).
Kevin O'Connor [Wed, 15 Aug 2012 01:20:10 +0000 (21:20 -0400)]
Use cpu_to_be32() (and related) instead of htonl (and related).

Unify the syntax for byte swab calls.

This also fixes a bug in coreboot due to the lack of a be64_to_cpu()
call.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoMake iasl option check work with older versions of iasl. rel-1.7.1
Kevin O'Connor [Thu, 30 Aug 2012 01:27:37 +0000 (21:27 -0400)]
Make iasl option check work with older versions of iasl.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoscsi: add AMD PCscsi driver
Paolo Bonzini [Mon, 6 Aug 2012 11:15:06 +0000 (13:15 +0200)]
scsi: add AMD PCscsi driver

This is a driver for an AMD PCscsi (am53c974) SCSI card.  It can be
used together with DOS or old operating systems such as Windows NT 3.1,
Windows 3.1 or Windows 98.

Cc: Hervé Poussineau <hpoussin@reactos.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
12 years agoscsi: fix detection of QEMU
Paolo Bonzini [Thu, 2 Aug 2012 16:22:44 +0000 (18:22 +0200)]
scsi: fix detection of QEMU

The vendor string is null-terminated by the time scsi_init_drive looks
at it, so it is incorrect to pad the memcmp argument with spaces.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
12 years agolsi: do not reset on error
Paolo Bonzini [Thu, 2 Aug 2012 16:22:43 +0000 (18:22 +0200)]
lsi: do not reset on error

Resetting on any error (including for example a disconnected device)
will cause a unit attention condition on all devices.  So if we cannot
probe for example target 6, the first read on target 0 will fail.

Reported-by: Frediano Ziglio <freddy77@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
12 years agoacpi: fix build with new iasl compiler
Michael S. Tsirkin [Thu, 2 Aug 2012 18:57:20 +0000 (21:57 +0300)]
acpi: fix build with new iasl compiler

iasl versions starting with 20120320
(git commit 7fd09d993580e22a096a1b21d2a356d89e702153) enable
a preprocessor by default, which currently strips out
comments from the input. Happily the next release,
20120420, includes an option to disable the preprocessor.
Test and use this option when available.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
12 years agoallow CPUs to have non-contiguous Local APIC IDs (v2)
Eduardo Habkost [Wed, 25 Jul 2012 18:45:30 +0000 (15:45 -0300)]
allow CPUs to have non-contiguous Local APIC IDs (v2)

Extract Local APIC IDs directly from the CPUs, and instead of check for
"i < CountCPUs", check if the APIC ID was present on boot, when building
ACPI tables and the MP-Table.

This keeps ACPI Processor ID == APIC ID, but allows the
hardware<->SeaBIOS interface be completely APIC-ID based and not depend
on any other kind of "CPU identifier". This way, SeaBIOS may change the
way ACPI Processor IDs are chosen in the future.

As currently SeaBIOS supports only xAPIC and not x2APIC, the list of
present-on-boot APIC IDs is a 256-bit bitmap. If one day SeaBIOS starts
to support x2APIC, the data structure used to enumerate the APIC IDs
will have to be changed (but this is an internal implementation detail,
not visible to the OS or on any hardware<=>SeaBIOS interface).

For current QEMU versions (that always make the APIC IDs contiguous),
the OS-visible behavior and resulting ACPI tables should be exactly the
same. This patch will simply allow QEMU to start setting non-contiguous
APIC IDs (that is a requirement for some sockets/cores/threads topology
settings).

Changes v1 -> v2:
 - Use size suffixes on all asm instructions on smp.c
 - New patch description

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
12 years agoreport real I/O APIC ID (0) on MADT and MP-table (v3)
Eduardo Habkost [Wed, 25 Jul 2012 18:45:29 +0000 (15:45 -0300)]
report real I/O APIC ID (0) on MADT and MP-table (v3)

When resetting an I/O APIC, its ID is set to 0, and SeaBIOS doesn't
change it, so report it correctly on the ACPI MADT table and MP-table.

Some hardware may require the BIOS to initialize I/O APIC ID to an
unique value, but SeaBIOS doesn't do that. This patch at least makes the
tables reflect reality.

Changes v2 -> v3:
 - Fix MP-table too, not just ACPI MADT table

Changes v1 -> v2:
 - Cosmetic: whitespace change (removed extra newline)
 - New patch description

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
12 years agoEHCI: increase CONNECT detection delay
Kevin O'Connor [Thu, 2 Aug 2012 00:40:03 +0000 (20:40 -0400)]
EHCI: increase CONNECT detection delay

Increase delay to fix detection issues found.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Signed-off-by: Sven Schnelle <svens@stackframe.org>
12 years agoIncrease debug level of Xen detection code.
Kevin O'Connor [Sat, 21 Jul 2012 17:41:16 +0000 (13:41 -0400)]
Increase debug level of Xen detection code.

Now that Xen is enabled by default the detection code will frequently
not find a valid Xen hypervisor signature, so don't spam the debug
logs.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoUnify ATAPI command processing.
Kevin O'Connor [Sat, 21 Jul 2012 16:01:12 +0000 (12:01 -0400)]
Unify ATAPI command processing.

Unify the ATA and AHCI ATAPI command processing into one function in
block.c (process_atapi_op).

This patch disables the existing handlers for ATA ATAPI isready and
reset.  However, it's unlikely that support is needed and it does not
appear that the implemented support is fully correct.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agolsi53c895a boot support
Gerd Hoffmann [Fri, 20 Jul 2012 08:59:25 +0000 (10:59 +0200)]
lsi53c895a boot support

This patch adds support for the lsi53c895a scsi host adapter,
allowing seabios to boot from scsi disks and cdroms connected
to the lsi scsi hba emulated by qemu.

This driver was written by looking at the expectations of qemu's
lsi emulation.  I have no idea idea how close this is to work on
real hardware, and I somehow doubt anyone cares given the age of
physical lsi scsi cards.  It depends on !COREBOOT for that reason.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
12 years agousb attached scsi boot support
Gerd Hoffmann [Fri, 20 Jul 2012 08:59:24 +0000 (10:59 +0200)]
usb attached scsi boot support

This patch adds support for booting from UAS (usb
attached scsi) devices.

For now only usb 2.0 support is there.  On usb 3.0 the
UAS protocol uses streams, so changes will be required
to make usb 3.0 devices fly once we have a xhci host
controller driver.

So far the driver has been tested on qemu-emulated
virtual hardware only.  In theory should just work on
bare metal too.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
12 years agomove usb mass storage defines to usb.h
Gerd Hoffmann [Fri, 20 Jul 2012 08:59:23 +0000 (10:59 +0200)]
move usb mass storage defines to usb.h

With the arrival of usb attached scsi support they
will be needed outside usb-msd.c too.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
12 years agoMinor - clear unused f-segment data at start of f-segment.
Kevin O'Connor [Sat, 21 Jul 2012 15:56:09 +0000 (11:56 -0400)]
Minor - clear unused f-segment data at start of f-segment.

Zero the space - some old applications can use the space for UMB if it
is zeroed.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoFix merge of a4e2b9adbba95c2d783761e84444bbb3c8d6107b.
Kevin O'Connor [Fri, 20 Jul 2012 06:42:08 +0000 (02:42 -0400)]
Fix merge of a4e2b9adbba95c2d783761e84444bbb3c8d6107b.

The manual merge of a4e2b9ad that I did resulted in previous commits
(c7be281b and 20fcf9b) being undone.  Fix that up.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoenable USE_PLATFORM_CLOCK bit in FADT flags
Marcelo Tosatti [Tue, 17 Jul 2012 17:18:00 +0000 (14:18 -0300)]
enable USE_PLATFORM_CLOCK bit in FADT flags

Enable bit 15 (USE_PLATFORM_CLOCK) of FADT flags field so that
older Windows guests do not make use of the TSC for timestamping.

From the ACPI manual:

"A value of one indicates that OSPM should use a platform provided timer
to drive any monotonically non-decreasing counters, such as OSPM
performance counter services. Which particular platform timer will be
used is OSPM specific, however, it is recommended that the timer used is
based on the following algorithm: If the HPET is exposed to OSPM, OSPM
should use the HPET. Otherwise, OSPM will use the ACPI power management
timer. A value of one indicates that the platform is known to have a
correctly implemented ACPI power management timer."

Problems using the TSC include:

1) Migration to a host with different frequency.
2) Unsynchronized TSCs in SMP hosts (KVM does not guarantee
synchronization).
3) Processors which do not increment TSC on low power states.

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
12 years agoSMM: Disable use of SMM when running under Xen
Ian Campbell [Thu, 28 Jun 2012 10:08:33 +0000 (11:08 +0100)]
SMM: Disable use of SMM when running under Xen

Xen does not support SMM mode.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
12 years agoXen: Autodetect debug I/O port at runtime instead of via Kconfig
Ian Campbell [Thu, 28 Jun 2012 10:08:32 +0000 (11:08 +0100)]
Xen: Autodetect debug I/O port at runtime instead of via Kconfig

This allows a common image which supports Xen to still print debug

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
12 years agoenable Xen support by default.
Ian Campbell [Thu, 28 Jun 2012 10:08:31 +0000 (11:08 +0100)]
enable Xen support by default.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
12 years agoXen: add definition of xen_hypercall_page
Ian Campbell [Wed, 27 Jun 2012 11:08:49 +0000 (12:08 +0100)]
Xen: add definition of xen_hypercall_page

commit b7d9abfaeb7d (correctly) added the missing "extern" to the declaration
in xen.h, however it turns out we never actually declared the variable!

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
12 years agoGet system state configuration from QEMU and patch DSDT with it.
Gleb Natapov [Sun, 20 May 2012 09:03:40 +0000 (12:03 +0300)]
Get system state configuration from QEMU and patch DSDT with it.

QEMU may want to disable guest's S3/S4 support and it wants to distinguish
between regular powerdown and S4 powerdown. To support that new fw_cfg
option was added that passes supported system states and what value should
guest use to enter each state. States are passed in 6 byte array. Each
byte represents one system state. If byte at offset X has its MSB set
it means that system state X is supported and to enter it guest should
use the value from lowest 7 bits. Patch also detects old QEMU and uses
values that work in backwards compatible way there.

Signed-off-by: Gleb Natapov <gleb@redhat.com>
12 years agoAdd ACPI_EXTRACT_PKG_START macro parsing
Gleb Natapov [Sun, 20 May 2012 09:03:39 +0000 (12:03 +0300)]
Add ACPI_EXTRACT_PKG_START macro parsing

It allows to extract the beginning of a Package object content.

Signed-off-by: Gleb Natapov <gleb@redhat.com>
12 years agoFix aml_name_string() to recognize block name modifiers.
Gleb Natapov [Sun, 20 May 2012 09:03:38 +0000 (12:03 +0300)]
Fix aml_name_string() to recognize block name modifiers.

Signed-off-by: Gleb Natapov <gleb@redhat.com>
12 years agoMinor - ensure build can handle some gcc/linker section declarations.
Kevin O'Connor [Fri, 22 Jun 2012 00:54:53 +0000 (20:54 -0400)]
Minor - ensure build can handle some gcc/linker section declarations.

Make sure the build is not confused with some linker output common
when using -flto.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoMinor - fixup missing "extern" declaration in xen.h.
Kevin O'Connor [Fri, 22 Jun 2012 00:54:22 +0000 (20:54 -0400)]
Minor - fixup missing "extern" declaration in xen.h.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoSupport USB MSC devices with multiples LUNs
Kevin O'Connor [Wed, 13 Jun 2012 12:47:03 +0000 (08:47 -0400)]
Support USB MSC devices with multiples LUNs

There are USB Mass storage devices which have more than one device.
Examples are CD Changers, or USB sticks which are partitioned in a
CDROM and Harddisk device.

Signed-off-by: Sven Schnelle <svens@stackframe.org>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agopci: runtime i/o window sizing
Gerd Hoffmann [Tue, 12 Jun 2012 07:27:15 +0000 (09:27 +0200)]
pci: runtime i/o window sizing

Update the pci i/o windows at runtime, depending on the amount memory
the machine has.  The 32bit window starts above low memory and ends at
the ioapic map address, the 64bit window is placed above high memory.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
12 years agoEHCI: Add support for 64 bit capability
Sven Schnelle [Tue, 12 Jun 2012 07:20:23 +0000 (09:20 +0200)]
EHCI: Add support for 64 bit capability

Signed-off-by: Sven Schnelle <svens@stackframe.org>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoMinor - remove extra include from apm.c.
Kevin O'Connor [Wed, 13 Jun 2012 06:41:27 +0000 (02:41 -0400)]
Minor - remove extra include from apm.c.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoMinor - extend the size of the 'struct bios_data_area_s' to 256 bytes.
Kevin O'Connor [Sun, 10 Jun 2012 13:18:44 +0000 (09:18 -0400)]
Minor - extend the size of the 'struct bios_data_area_s' to 256 bytes.

Make the struct 256 bytes - just for documentation purposes.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoMinor - remove CLEARBITS_BDA and SETBITS_BDA macros.
Kevin O'Connor [Sun, 10 Jun 2012 13:09:22 +0000 (09:09 -0400)]
Minor - remove CLEARBITS_BDA and SETBITS_BDA macros.

Remove these infrequently used macros and replace with explicit
GET_BDA/SET_BDA calls.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoRemove SMBIOS generation on coreboot hack.
Kevin O'Connor [Sat, 9 Jun 2012 17:46:11 +0000 (13:46 -0400)]
Remove SMBIOS generation on coreboot hack.

Early versions of coreboot did not create an SMBIOS table (which Linux
needs in order to use the ACPI tables), so SeaBIOS had a hack to
generate an SMBIOS table.  However, recent versions of coreboot can
generate an SMBIOS table, so there is no longer a reason to support
this hack.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoMinor - Replace PirOffset with PirAddr.
Kevin O'Connor [Sat, 9 Jun 2012 17:36:45 +0000 (13:36 -0400)]
Minor - Replace PirOffset with PirAddr.

Technically, the PIR table could be placed at 0xf0000, which would
result in a PirOffset=0, which would confuse the code.  So, use an
absolute address (PirAddr) instead.  This also matches what the ACPI
and SMBIOS code does.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoMinor - collect biostable copy code into new func copy_table().
Kevin O'Connor [Sat, 9 Jun 2012 17:08:02 +0000 (13:08 -0400)]
Minor - collect biostable copy code into new func copy_table().

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoAvoid runtime relocation of 16bit "low" mem - calculate at build instead.
Kevin O'Connor [Sat, 9 Jun 2012 01:14:19 +0000 (21:14 -0400)]
Avoid runtime relocation of 16bit "low" mem - calculate at build instead.

Some 16bit accesses to "low" mem variables use 16bit relocations
instead of the normal 32bit relocations.  This causes build problems
if the "low" mem sections move more than 64K during relocation.

The final location of the "low" memory can be determined during the
build, so link the 16bit code with the final post-reloc location of
the "low" mem variables instead.  This eliminates the need to do these
runtime relocations on the 16bit code.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoupdate dsdt ressources at runtime
Gerd Hoffmann [Thu, 7 Jun 2012 08:34:33 +0000 (10:34 +0200)]
update dsdt ressources at runtime

Write the pci window location to memory and add a pointer to the SSDT
(BDAT region).  Turn \\SB.PCI0._CRS into a method which looks up the
information there and updates the ressources accordingly.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
12 years agopciinit: make pci ressources configurable
Gerd Hoffmann [Thu, 7 Jun 2012 08:34:32 +0000 (10:34 +0200)]
pciinit: make pci ressources configurable

This patch adds variables for the pci io window, so they are
runtime-configurable.  They are initialized with the values
from config.h

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
12 years agoupdate bios date
Gerd Hoffmann [Thu, 7 Jun 2012 08:34:31 +0000 (10:34 +0200)]
update bios date

Linux ignores some information from acpi in case the bios is old
as acpi support used to be buggy in the early days.  This affects
ressources for example (unless forced with pci=use_crs).  So lets
go for something more recent.  With this patch applied the
ressources for \\SB.PCI0 will show up in /proc/{iomem,ioports},
tagged as "PCI Bus 0000:00".

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
12 years agoFix winxp boot regression introduced in ecdc655a.
Kevin O'Connor [Sun, 3 Jun 2012 00:30:58 +0000 (20:30 -0400)]
Fix winxp boot regression introduced in ecdc655a.

The winxp boot loader does something curious - it sets an int 0x1c
handler, records the stack location, and then spins in place with irqs
enabled.  The 0x1c handler alters the memory just past the stack
pointer so that when the timer irq returns the code jumps to a new
location and stop spinning.  The winxp code relies on the fact that a
hw irq will always place 6 bytes at a specific location and that it
can alter those bytes.

The ecdc655a patch does a full backup/restore of the register state.
Unfortunately, the restore overwrites the changes made by the winxp
0x1c handler.

This patch reverts much of ecdc655a.  Hardware irqs are still handled
on the extra stack, but only the essential register state is backed up
and restored.

Also, stack_hop_back is changed to only use %sp when changing states -
this enables the entry code to store just %esp instead of both %esp
and %sp.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoCache romfile entries.
Kevin O'Connor [Thu, 31 May 2012 04:20:55 +0000 (00:20 -0400)]
Cache romfile entries.

Create a 'struct romfile_s' and populate a list of all romfiles at
start of init.  Caching the romfiles both simplifies the code and
makes it more efficient.

Also, convert the ramdisk code to use romfile helpers instead of
directly accessing cbfs.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoremove iasl-generated hex files from git repo
Kevin O'Connor [Thu, 31 May 2012 01:31:42 +0000 (21:31 -0400)]
remove iasl-generated hex files from git repo

Almost every linux distro has iasl packaged these days.
Lets make it a build dependency and stop the hassle we
have with updating the *.hex files in the git repo.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoRemove CanPreempt check from pmm code.
Kevin O'Connor [Thu, 31 May 2012 01:02:44 +0000 (21:02 -0400)]
Remove CanPreempt check from pmm code.

The CanPreempt check in pmm is a leftover from when memory could be
allocated from the 9-segment.  It is no longer needed.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoRework disk.c:fillLCHS to avoid using pointer parameters.
Kevin O'Connor [Sun, 27 May 2012 14:45:32 +0000 (10:45 -0400)]
Rework disk.c:fillLCHS to avoid using pointer parameters.

The compiler does a better job when passing parameters by value.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoMake sure to set dependency to segment registers in inline asm.
Kevin O'Connor [Mon, 28 May 2012 22:57:06 +0000 (18:57 -0400)]
Make sure to set dependency to segment registers in inline asm.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoSet noinline on kbd.c interface functions that take stack variable pointers.
Kevin O'Connor [Mon, 28 May 2012 22:31:39 +0000 (18:31 -0400)]
Set noinline on kbd.c interface functions that take stack variable pointers.

Some versions of gcc have been found to inline these funcions and then
cause the calling functions to use very large stack usage.  Since
these functions are called from 16bit mode, their stack space usage is
very sensitive.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoRemove "noinline" declarations from keyboard/mouse driver code.
Kevin O'Connor [Mon, 28 May 2012 18:42:16 +0000 (14:42 -0400)]
Remove "noinline" declarations from keyboard/mouse driver code.

Now that the extra stack is used for keyboard and mouse driver code,
there is no reason to set noinline (which was done to try and conserve
stack space).

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoUse the extra stack for 16bit USB and PS2 keyboard/mouse commands.
Kevin O'Connor [Mon, 28 May 2012 18:34:49 +0000 (14:34 -0400)]
Use the extra stack for 16bit USB and PS2 keyboard/mouse commands.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoRun all hardware irq handlers on the extra stack.
Kevin O'Connor [Mon, 28 May 2012 18:25:15 +0000 (14:25 -0400)]
Run all hardware irq handlers on the extra stack.

Jump into the extra stack for all hardware irq handlers.  This reduces
the overall stack requirements of SeaBIOS.

Replace all users of call16_simpint with call16_int.  Only the
hardware irq handlers used the old call, and they need to use the new
call to ensure the extra stack is properly re-entrant.

Also, pass in a 'struct bregs' to the hardware irq handlers now.  It
was not done previously to save stack space.  Now that the extra stack
is used, that is no longer an issue.

Note that should an old OS invoke a hardware irq in 16bit protected
mode, then this patch could break that OS.  However, the chances of
this causing a regression seem small as several existing hardware irq
handlers already do not work in 16bit protected mode.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoAutomatically hop off the extra stack when far calling 16bit code.
Kevin O'Connor [Mon, 28 May 2012 17:59:07 +0000 (13:59 -0400)]
Automatically hop off the extra stack when far calling 16bit code.

Update the low level __farcall16 code to support a 'struct bregs' in a
segment other than the stack segment.

Automatically hop back from the extra stack on any farcall16() calls.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoMake the extra stack re-entrant and "hop back" to check for irqs.
Kevin O'Connor [Mon, 28 May 2012 16:59:58 +0000 (12:59 -0400)]
Make the extra stack re-entrant and "hop back" to check for irqs.

When on the extra stack and it's necessary to check for irqs, switch
back to the original caller's stack to check for irqs.  Make the extra
stack re-entrant, so that a new user of the extra stack wont collide
with an existing user.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoReplace 32bit->16bit farcall system with regular calls.
Kevin O'Connor [Mon, 28 May 2012 14:56:20 +0000 (10:56 -0400)]
Replace 32bit->16bit farcall system with regular calls.

Instead of always "far calling" to 16bit mode, use a regular call.
When actually needing to "far call", transition to the 16bit C code
that does far calling.  This reduces the overhead to the check_irqs
and wait_irq code.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoMove farcall16 code from util.c to stacks.c and reorg stacks.c.
Kevin O'Connor [Tue, 29 May 2012 02:06:42 +0000 (22:06 -0400)]
Move farcall16 code from util.c to stacks.c and reorg stacks.c.

No code changes - just code movement.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoRename call16 to farcall16.
Kevin O'Connor [Sun, 25 Mar 2012 15:04:10 +0000 (11:04 -0400)]
Rename call16 to farcall16.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoDon't restrict VISIBLEx C functions to only x mode.
Kevin O'Connor [Mon, 28 May 2012 15:37:53 +0000 (11:37 -0400)]
Don't restrict VISIBLEx C functions to only x mode.

Since SeaBIOS has been updated to use "_cfuncx_" prefixes when calling
cross-mode C functions, there is no reason to restrict an exported C
function to only the given mode.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoRename wait_irq to yield_toirq.
Kevin O'Connor [Mon, 28 May 2012 15:44:02 +0000 (11:44 -0400)]
Rename wait_irq to yield_toirq.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoMisc conversions to GET/SET_LOWFLAT().
Kevin O'Connor [Fri, 25 May 2012 03:56:19 +0000 (23:56 -0400)]
Misc conversions to GET/SET_LOWFLAT().

Convert from GET/SET_FLATPTR() to GET/SET_LOWFLAT() - the latter
produces better code.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoConvert virtio code to use GET/SET_LOWFLAT().
Kevin O'Connor [Fri, 25 May 2012 03:56:03 +0000 (23:56 -0400)]
Convert virtio code to use GET/SET_LOWFLAT().

Convert from GET/SET_FLATPTR() to GET/SET_LOWFLAT() - the latter
produces better code.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoConvert AHCI code to use GET/SET_LOWFLAT().
Kevin O'Connor [Fri, 25 May 2012 03:55:00 +0000 (23:55 -0400)]
Convert AHCI code to use GET/SET_LOWFLAT().

Convert from GET/SET_FLATPTR() to GET/SET_LOWFLAT() - the latter
produces better code.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoRemove disk GET/SET_INT13DPT and GET/SET_INT13EXT macros.
Kevin O'Connor [Fri, 25 May 2012 02:52:39 +0000 (22:52 -0400)]
Remove disk GET/SET_INT13DPT and GET/SET_INT13EXT macros.

The code generation is better if explicit 'struct int13ext_s' and
'struct int13dpt_s' pointers are used instead.  The code is a little
easier to understand as well.

This patch also forces disk_1348 to not be inlined.  If it gets
inlined into its caller it can increase the stack usage for all disk
calls.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoUse inline functions instead of macros for GET/SET_SEG segment manipulation.
Kevin O'Connor [Fri, 25 May 2012 02:06:39 +0000 (22:06 -0400)]
Use inline functions instead of macros for GET/SET_SEG segment manipulation.

It appears that gcc does a better job of optimization when the
SET_SEG() segment assignment assembler code is contained in an inline
function.  With the code in a function gcc appears to be able to
optimize out many redundant segment register loads.  Removing some of
these unnecessarily loads makes the code both smaller and faster.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoMinor - verify UMB dummy optionrom header size doesn't overflow.
Kevin O'Connor [Thu, 24 May 2012 03:58:11 +0000 (23:58 -0400)]
Minor - verify UMB dummy optionrom header size doesn't overflow.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agopci: init all devices
Gerd Hoffmann [Tue, 15 May 2012 10:46:22 +0000 (12:46 +0200)]
pci: init all devices

seabios used to initialize root bus devices only, with this patch
devices behind pci bridges are initialized too.  This allows to boot
from virtio devices behind pci bridges.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
12 years agoAllow optionroms and "low mem" to share space.
Kevin O'Connor [Mon, 21 May 2012 01:11:43 +0000 (21:11 -0400)]
Allow optionroms and "low mem" to share space.

Allow both optionroms and "low mem" allocations to use the e-segment.
(Space is allocated on a "first come, first serve" basis).  This
allows more flexibility in resource assignment.

Also, allow the "low mem" area to use a full 64K.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoConvert GET/SET_FLATPTR() accesses to "low mem" to GET/SET_LOWFLAT().
Kevin O'Connor [Sun, 20 May 2012 02:42:51 +0000 (22:42 -0400)]
Convert GET/SET_FLATPTR() accesses to "low mem" to GET/SET_LOWFLAT().

Add new GET/SET_LOWFLAT() macros and convert appropriate users to
them.  The new macros make for slightly better code generation.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoEBDA cleanups.
Kevin O'Connor [Mon, 14 May 2012 02:58:08 +0000 (22:58 -0400)]
EBDA cleanups.

Clean up includes of biosvar.h.

Rename GET/SET_EBDA2 to GET/SET_EBDA - nearly all users use the
extended form now anyway.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoConvert disk code EBDA variables to VARLOW variables.
Kevin O'Connor [Mon, 14 May 2012 02:46:12 +0000 (22:46 -0400)]
Convert disk code EBDA variables to VARLOW variables.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoConvert USB keyboard code EBDA variables to VARLOW variables.
Kevin O'Connor [Sun, 13 May 2012 16:39:16 +0000 (12:39 -0400)]
Convert USB keyboard code EBDA variables to VARLOW variables.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoConvert ps2 code EBDA variables to VARLOW variables.
Kevin O'Connor [Sun, 13 May 2012 16:28:55 +0000 (12:28 -0400)]
Convert ps2 code EBDA variables to VARLOW variables.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoConvert boot code EBDA variables to VARLOW variables.
Kevin O'Connor [Sun, 13 May 2012 16:23:58 +0000 (12:23 -0400)]
Convert boot code EBDA variables to VARLOW variables.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoConvert timer code EBDA variables to VARLOW variables.
Kevin O'Connor [Sun, 13 May 2012 16:18:36 +0000 (12:18 -0400)]
Convert timer code EBDA variables to VARLOW variables.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoAdd mechanism to declare variables as "low mem" and use for extra stack.
Kevin O'Connor [Sun, 13 May 2012 16:10:30 +0000 (12:10 -0400)]
Add mechanism to declare variables as "low mem" and use for extra stack.

Add a mechanism (VARLOW declaration) to make a variable reside in the
low memory (e-segment) area.  This is useful for runtime variables
that need to be accessed from 16bit code and need to be modifiable
during runtime.

Move the 16bit "extra stack" from the EBDA to the low memory area
using this declaration mechanism.  Also increase the size of this
stack from 512 bytes to 2048 bytes.

This also reworks tools/layoutrom.py a bit.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoUse the e-segment instead of the 9-segment for bios "low mem".
Kevin O'Connor [Sun, 13 May 2012 03:49:33 +0000 (23:49 -0400)]
Use the e-segment instead of the 9-segment for bios "low mem".

Use the e-segment for ZoneLow allocations.  There is plenty of
e-segment space (there has been since SeaBIOS supported code
relocation), while using the 9-segment space can impact old real-mode
applications.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoAutomatically reboot after 60 second delay on failed boot.
Kevin O'Connor [Sun, 13 May 2012 02:12:22 +0000 (22:12 -0400)]
Automatically reboot after 60 second delay on failed boot.

If no valid boot devices are found, display the error for 60 seconds
(by default) and then reboot.  This enables a periodic retry in case
one of the boot devices is still coming online.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agopci: handle bridge irq mapping
Gerd Hoffmann [Fri, 4 May 2012 15:33:36 +0000 (17:33 +0200)]
pci: handle bridge irq mapping

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
12 years agoRevert "Fix 64bit PCI issues on Windows"
Kevin O'Connor [Sat, 12 May 2012 18:14:05 +0000 (14:14 -0400)]
Revert "Fix 64bit PCI issues on Windows"

This reverts commit 482a020ec25f4cec655ddcb16b67c6f38b0844c0.

The commit causes WinXP guests to BSOD.

13 years agoAdd IASL definition to the Makefile.
Marc Jones [Sun, 29 Apr 2012 17:20:53 +0000 (11:20 -0600)]
Add IASL definition to the Makefile.

Add IASL definition to Makefile so it can be passed by the user.

Signed-off-by: Marc Jones <marc.jones@se-eng.com>
13 years agopciinit: Simplify list manipulation in pci_region_migrate_64bit_entries.
Kevin O'Connor [Fri, 27 Apr 2012 02:20:56 +0000 (22:20 -0400)]
pciinit: Simplify list manipulation in pci_region_migrate_64bit_entries.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
13 years agopciinit: Minor white space changes.
Kevin O'Connor [Fri, 27 Apr 2012 02:04:34 +0000 (22:04 -0400)]
pciinit: Minor white space changes.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
13 years agoFix 64bit PCI issues on Windows
Alexey Korolev [Thu, 19 Apr 2012 05:52:41 +0000 (17:52 +1200)]
Fix 64bit PCI issues on Windows

 This patch solves issues on Windows guests, when 64bit
 BAR's are present. It is also helpful on Linux guests
 when use_crs kernel boot option is set.

Signed-off-by: Alexey Korolev <alexey.korolev@endace.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
13 years agopciinit: Migrate 64bit entries to 64bit pci regions
Alexey Korolev [Thu, 26 Apr 2012 05:01:59 +0000 (17:01 +1200)]
pciinit: Migrate 64bit entries to 64bit pci regions

Migrate 64bit entries to 64bit pci regions if they do
not fit in 32bit range.

Signed-off-by: Alexey Korolev <alexey.korolev@endace.com>
13 years agopciinit: Calculate pci region stats on demand
Alexey Korolev [Thu, 26 Apr 2012 04:51:05 +0000 (16:51 +1200)]
pciinit: Calculate pci region stats on demand

Do not store pci region stats - instead calulate the
sum and alignment on demand.

Signed-off-by: Alexey Korolev <alexey.korolev@endace.com>
13 years agopciinit: 64bit capability discovery for pci bridges
Alexey Korolev [Thu, 19 Apr 2012 05:48:54 +0000 (17:48 +1200)]
pciinit: 64bit capability discovery for pci bridges

Add discovery if bridge region is 64bit is capable.

Signed-off-by: Alexey Korolev <alexey.korolev@endace.com>
13 years agopciinit: Add pci_region structure.
Alexey Korolev [Thu, 19 Apr 2012 05:47:19 +0000 (17:47 +1200)]
pciinit: Add pci_region structure.

 The pci_region structure is added.
 Move setting of bus base address to pci_region_map_entries.

Signed-off-by: Alexey Korolev <alexey.korolev@endace.com>
13 years agopciinit: Switch to 64bit variable types.
Alexey Korolev [Thu, 19 Apr 2012 05:44:55 +0000 (17:44 +1200)]
pciinit: Switch to 64bit variable types.

 Switch to 64bit variable types.
 Add parsing  64bit bars.

Original patch by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>