]> xenbits.xensource.com Git - seabios.git/log
seabios.git
12 years agoConvert VAR16VISIBLE, VAR16EXPORT, and VAR32VISIBLE to VARFSEG.
Kevin O'Connor [Tue, 19 Feb 2013 04:36:03 +0000 (23:36 -0500)]
Convert VAR16VISIBLE, VAR16EXPORT, and VAR32VISIBLE to VARFSEG.

Convert all users of the alternative variable exports to VARFSEG.
There isn't a significant distinction between the existing types of
exports, so it's simpler to just use one type going forward.

The new VARFSEG declaration is only emitting when in 32bit mode, so
update and move some variables as needed.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoIntroduce VARFSEG for variables that will reside in the f-segment.
Kevin O'Connor [Tue, 19 Feb 2013 04:09:01 +0000 (23:09 -0500)]
Introduce VARFSEG for variables that will reside in the f-segment.

Introduce a variable declaration that will force variables (that are
compiled in 32bit mode) to be emitted into the f-segment.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoMinor assembler enhancements to __csm_return.
Kevin O'Connor [Tue, 19 Feb 2013 02:57:26 +0000 (21:57 -0500)]
Minor assembler enhancements to __csm_return.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoRemove unnecessary "export" declarations from assembler functions.
Kevin O'Connor [Tue, 19 Feb 2013 02:50:57 +0000 (21:50 -0500)]
Remove unnecessary "export" declarations from assembler functions.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoseabios q35: Enable all PIRQn IRQs at startup
Alex Williamson [Fri, 15 Feb 2013 21:11:35 +0000 (14:11 -0700)]
seabios q35: Enable all PIRQn IRQs at startup

We seem to use the IRQEN bit of the PIRQn registers interchangeably
to select APIC mode or to disable an IRQ.  I can't decide if we're
intending to disable the IRQ or select APIC mode here, but in either
case it prevents PIC mode assigned devices from working.  When seabios
writes IRQEN to these registers, qemu interprets that as APIC mode,
so while the boot ROM driver is waiting for an interrupt on ISA
compatible IRQ 10 or 11, KVM is injecting interrupts to APIC pins
16 - 23.  Devices on the root bus use PIRQE:H while the root ports
use PIRQA:D.  Enable them all so we don't limit where we support boot
ROMs.  The guest will later disable unused IRQs with the ACPI _DIS
method.

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
12 years agoDisable handle_post() on CSM builds.
Kevin O'Connor [Mon, 18 Feb 2013 16:49:53 +0000 (11:49 -0500)]
Disable handle_post() on CSM builds.

This reduces the size of the CSM binary by a few bytes.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoDisable CONFIG_THREAD_OPTIONROMS for CSM build
David Woodhouse [Thu, 14 Feb 2013 08:55:52 +0000 (08:55 +0000)]
Disable CONFIG_THREAD_OPTIONROMS for CSM build

Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
12 years agoVerify CC is valid during build tests.
Kevin O'Connor [Mon, 18 Feb 2013 15:28:55 +0000 (10:28 -0500)]
Verify CC is valid during build tests.

Update test-build.sh to report if it can't run the c compiler at all.
Without this test, a totally non-working build environment will yield
an "invalid LD" message which can be confusing.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoClarify build generated "zone low" values.
Kevin O'Connor [Sun, 17 Feb 2013 18:58:28 +0000 (13:58 -0500)]
Clarify build generated "zone low" values.

Rename datalow_base (and similar) to zonelow_base, and datalow_start
(and similar) to varlow_start.  This helps distinguish between the
bounds for the runtime dynamic memory pool and the compile time global
variables.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoReport on f-segment UMB ram also.
Kevin O'Connor [Sun, 17 Feb 2013 17:46:53 +0000 (12:46 -0500)]
Report on f-segment UMB ram also.

Some old DOS programs can also use f-segment space as Upper Memory
Blocks (UMB), so also report on what space is available in debug
messages.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoRename rom_get_top() to rom_get_max().
Kevin O'Connor [Sun, 17 Feb 2013 17:44:23 +0000 (12:44 -0500)]
Rename rom_get_top() to rom_get_max().

Rename rom_get_top and try to make the difference between it and
rom_get_last more clear.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agobuild: Don't require $(OUT) to be a sub-directory of the main directory.
Kevin O'Connor [Sun, 17 Feb 2013 15:56:10 +0000 (10:56 -0500)]
build: Don't require $(OUT) to be a sub-directory of the main directory.

Remove references to "../" and "out/" from the build so that "make
OUT=/a/b/c/" will work.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoFix Makefile - don't reference "out/" directly, instead use "$(OUT)".
Kevin O'Connor [Sun, 17 Feb 2013 15:18:15 +0000 (10:18 -0500)]
Fix Makefile - don't reference "out/" directly, instead use "$(OUT)".

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoEnable VGA output when setting Cirrus-specific mode
Laszlo Ersek [Thu, 14 Feb 2013 04:43:32 +0000 (05:43 +0100)]
Enable VGA output when setting Cirrus-specific mode

This patch does the same for Cirrus as David's following patch for bochs,
originally posted under
<http://www.seabios.org/pipermail/seabios/2013-February/005434.html>:

  Enable VGA output when settings bochs-specific mode

  When used from OVMF+CSM, we got no video output. It appears that we were
  never enabling the display output except when configuring a text mode.
  Which never happens, in the OVMF+CSM case.

In my testing on RHEL-6.3 with OVMF -D CSM_ENABLE / CONFIG_CSM bios.bin /
CONFIG_QEMU vgabios.bin, using Cirrus, VESA mode 0x115 is selected (Direct
Color, 800x600x24).

According to <http://www.osdever.net/FreeVGA/vga/attrreg.htm>,

  cirrus_switch_mode()
    stdvga_attr_mask()

currently keeps/sets the "Attribute Controller Graphics Enable" bit set in
the "Attribute Mode Control Register". When invoked from OVMF+CSM, that is
not enough however, so let's do the same as for Bochs:

  stdvga_attrindex_write(0x20);

which corresponds to setting the "Palette Address Source" bit in the
"Attribute Address Register":

  "This bit is set to 0 to load color values to the registers in the
  internal palette. It is set to 1 for normal operation of the attribute
  controller. [...]"

clext_set_mode()
  stdvga_set_mode() -- for regular modes
    stdvga_attrindex_write() -- existing call
  cirrus_switch_mode() -- for Cirrus modes
    stdvga_attrindex_write() -- call added by this patch

Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
12 years agoEnable VGA output when settings bochs-specific mode
David Woodhouse [Fri, 8 Feb 2013 15:50:54 +0000 (15:50 +0000)]
Enable VGA output when settings bochs-specific mode

When used from OVMF+CSM, we got no video output. It appears that we were
never enabling the display output except when configuring a text mode.
Which never happens, in the OVMF+CSM case.

Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
12 years agogeodevga: fix wrong define name
Christian Gmeiner [Thu, 14 Feb 2013 09:34:37 +0000 (10:34 +0100)]
geodevga: fix wrong define name

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
12 years agogeodevga: add debug to msr functions
Christian Gmeiner [Thu, 14 Feb 2013 09:34:36 +0000 (10:34 +0100)]
geodevga: add debug to msr functions

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
12 years agogeodevga: move output setup to own function
Christian Gmeiner [Thu, 14 Feb 2013 09:34:35 +0000 (10:34 +0100)]
geodevga: move output setup to own function

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
12 years agogeodevga: move framebuffer setup
Christian Gmeiner [Thu, 14 Feb 2013 09:34:34 +0000 (10:34 +0100)]
geodevga: move framebuffer setup

Framebuffer setup has nothing to do with dc_setup(..) so
move it to  geodevga_init(..).

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
12 years agogeodevga: fix errors in geode_fp_* functions
Christian Gmeiner [Thu, 14 Feb 2013 09:34:32 +0000 (10:34 +0100)]
geodevga: fix errors in geode_fp_* functions

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
12 years agoImplement !CONFIG_BOOT for CSM
David Woodhouse [Thu, 14 Feb 2013 09:17:17 +0000 (09:17 +0000)]
Implement !CONFIG_BOOT for CSM

Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
12 years agoImplement !CONFIG_OPTIONROMS support for CSM
David Woodhouse [Thu, 14 Feb 2013 09:07:35 +0000 (09:07 +0000)]
Implement !CONFIG_OPTIONROMS support for CSM

Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
12 years agoMake CONFIG_OPTIONROMS_DEPLOYED depend on CONFIG_QEMU
David Woodhouse [Thu, 14 Feb 2013 08:56:20 +0000 (08:56 +0000)]
Make CONFIG_OPTIONROMS_DEPLOYED depend on CONFIG_QEMU

Potentially we could even kill it off completely, since it only works
with old versions of Qemu. But it can stay for now as long as it doesn't
offend me in the CSM build...

Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
12 years agoWarn on unaligned PCI ROM structure in option roms.
Kevin O'Connor [Sat, 16 Feb 2013 03:46:09 +0000 (22:46 -0500)]
Warn on unaligned PCI ROM structure in option roms.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoUSB-EHCI: Fix null pointer assignment
Avik Sil [Thu, 14 Feb 2013 05:24:57 +0000 (10:54 +0530)]
USB-EHCI: Fix null pointer assignment

cntl->regs should not be accessed before initializing it.

Signed-off-by: Avik Sil <aviksil@linux.vnet.ibm.com>
12 years agovgabios: Bochs/QEMU vgabios support should depend on CONFIG_QEMU.
Kevin O'Connor [Thu, 14 Feb 2013 00:36:02 +0000 (19:36 -0500)]
vgabios: Bochs/QEMU vgabios support should depend on CONFIG_QEMU.

The Cirrus, Standard VGA, and Bochs VGA should depend on CONFIG_QEMU
and not CONFIG_COREBOOT.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoGroup QEMU platform setup together and move to paravirt.c.
Kevin O'Connor [Thu, 14 Feb 2013 00:35:12 +0000 (19:35 -0500)]
Group QEMU platform setup together and move to paravirt.c.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoIntegrate qemu_cfg_preinit() into qemu_romfile_init().
Kevin O'Connor [Sun, 10 Feb 2013 01:09:22 +0000 (20:09 -0500)]
Integrate qemu_cfg_preinit() into qemu_romfile_init().

Now that only qemu_romfile_init() uses the fw_cfg interface, it only
needs to be detected in that function.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoProcess fw_cfg e820 entries during the fw_cfg setup stage.
Kevin O'Connor [Sun, 10 Feb 2013 01:00:06 +0000 (20:00 -0500)]
Process fw_cfg e820 entries during the fw_cfg setup stage.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoConvert fw_cfg NUMA entries into a romfile entry.
Kevin O'Connor [Sun, 10 Feb 2013 00:45:45 +0000 (19:45 -0500)]
Convert fw_cfg NUMA entries into a romfile entry.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoConvert basic integer fw_cfg entries into romfile entries.
Kevin O'Connor [Sun, 10 Feb 2013 00:25:51 +0000 (19:25 -0500)]
Convert basic integer fw_cfg entries into romfile entries.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoConvert fw_cfg SMBIOS entries into romfile entries.
Kevin O'Connor [Sun, 10 Feb 2013 00:09:20 +0000 (19:09 -0500)]
Convert fw_cfg SMBIOS entries into romfile entries.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoConvert fw_cfg ACPI entries into romfile entries.
Kevin O'Connor [Sat, 9 Feb 2013 20:24:08 +0000 (15:24 -0500)]
Convert fw_cfg ACPI entries into romfile entries.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoSupport skipping content when reading from QEMU fw_cfg romfile entries.
Kevin O'Connor [Sat, 9 Feb 2013 19:55:30 +0000 (14:55 -0500)]
Support skipping content when reading from QEMU fw_cfg romfile entries.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoUnify return path for CSM to go via csm_return()
David Woodhouse [Sun, 10 Feb 2013 00:51:56 +0000 (00:51 +0000)]
Unify return path for CSM to go via csm_return()

This allows us to keep the entry_csm code simple, and ensures that we
consistently do things like saving the PIC mask (and later setting
UmbStart) on the way back to UEFI.

Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
12 years agoUse find_pmtimer() after copying coreboot ACPI tables
David Woodhouse [Tue, 5 Feb 2013 16:14:20 +0000 (16:14 +0000)]
Use find_pmtimer() after copying coreboot ACPI tables

Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
12 years agoUse find_pmtimer() after copying Xen ACPI tables
David Woodhouse [Tue, 5 Feb 2013 16:14:06 +0000 (16:14 +0000)]
Use find_pmtimer() after copying Xen ACPI tables

Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
12 years agoMove find_pmtimer() to ACPI table setup where it logically belongs
David Woodhouse [Sun, 10 Feb 2013 01:15:01 +0000 (01:15 +0000)]
Move find_pmtimer() to ACPI table setup where it logically belongs

We don't have the ordering dependency with timer_setup() any more.

Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
12 years agoDon't calibrate TSC if PMTIMER is already set up
David Woodhouse [Sun, 10 Feb 2013 01:13:56 +0000 (01:13 +0000)]
Don't calibrate TSC if PMTIMER is already set up

Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
12 years agoFix rom_reserve()/rom_confirm() for CSM oprom dispatch
David Woodhouse [Sat, 9 Feb 2013 23:45:02 +0000 (23:45 +0000)]
Fix rom_reserve()/rom_confirm() for CSM oprom dispatch

Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
12 years agoUpdate tools/acpi_extract.py to handle iasl 20130117 release.
Kevin O'Connor [Mon, 11 Feb 2013 02:06:14 +0000 (21:06 -0500)]
Update tools/acpi_extract.py to handle iasl 20130117 release.

The latest iasl release produces "lst" output with "number:  " instead
of "number....".  Update the tool to support both formats.

Reported-by: Bo Yang <boyang@suse.com>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoThe mathcp setup touches the PIC and thus move to the "setup" phase.
Kevin O'Connor [Sun, 10 Feb 2013 05:35:01 +0000 (00:35 -0500)]
The mathcp setup touches the PIC and thus move to the "setup" phase.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoStart device_hardware_setup in mainint even with CONFIG_THREAD_OPTIONROMS.
Kevin O'Connor [Sun, 10 Feb 2013 05:25:53 +0000 (00:25 -0500)]
Start device_hardware_setup in mainint even with CONFIG_THREAD_OPTIONROMS.

There's no real gain to starting the device_hardware_setup in the
middle of the platform setup.  Always start it just prior to the VGA
rom.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoOnly perform SMP setup on QEMU.
Kevin O'Connor [Sun, 10 Feb 2013 04:58:55 +0000 (23:58 -0500)]
Only perform SMP setup on QEMU.

The SMP setup initializes MTRRs on extra CPUs and populates the
CountCPUs variable.  On coreboot the CPUs should already be
initialized and the CountCPUs variable isn't used anywhere.

There have also been reports of the SIPI does not work on some real
machines.  So, it's best not to invoke one if it isn't needed.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoMinor - move definitions to paravirt.c from paravirt.h.
Kevin O'Connor [Sat, 9 Feb 2013 18:21:08 +0000 (13:21 -0500)]
Minor - move definitions to paravirt.c from paravirt.h.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoConvert kvm_para_available() to runningOnKVM().
Kevin O'Connor [Sat, 9 Feb 2013 18:07:23 +0000 (13:07 -0500)]
Convert kvm_para_available() to runningOnKVM().

Make the KVM detection code use the same format as the QEMU/Xen
detection code.

Also, log when KVM is detected.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoConsistently use CONFIG_COREBOOT, CONFIG_QEMU, and runningOnXen().
Kevin O'Connor [Fri, 8 Feb 2013 04:32:48 +0000 (23:32 -0500)]
Consistently use CONFIG_COREBOOT, CONFIG_QEMU, and runningOnXen().

CONFIG_QEMU means compile to start from QEMU (and possibly
Xen/KVM/Bochs) and definitely running under QEMU (or Xen/KVM/Bochs).

CONFIG_COREBOOT means compile for coreboot and definitely running
under coreboot.  Places that used CONFIG_COREBOOT to mean "running on
real hardware" have been changed to use !CONFIG_QEMU.

CONFIG_QEMU_HARDWARE enables support for some virtual hardware devices
even if QEMU didn't start SeaBIOS.

usingXen() is replaced by runningOnXen().

runningOnQEMU() is added to hardware devices that are only safe to
access when we are sure we are running under QEMU (or Xen/KVM/Bochs).
Neither the coreboot nor the csm code currently enable runningOnQEMU,
but future patches may.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoAdd runningOnQEMU() and runningOnXen() for runtime platform detection.
Kevin O'Connor [Fri, 8 Feb 2013 03:42:25 +0000 (22:42 -0500)]
Add runningOnQEMU() and runningOnXen() for runtime platform detection.

Introduce standard for performing and inspecting the run-time
detection of para-virtualized environments.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoNo need to check both CONFIG_THREADS and CONFIG_THREAD_OPTIONROMS.
Kevin O'Connor [Fri, 8 Feb 2013 05:45:44 +0000 (00:45 -0500)]
No need to check both CONFIG_THREADS and CONFIG_THREAD_OPTIONROMS.

CONFIG_THREAD_OPTIONROMS depends on CONFIG_THREADS, so the code can
assume that the two are always on when CONFIG_THREAD_OPTIONROMS is on.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoDetermine century during init and store in VARLOW mem during runtime.
Kevin O'Connor [Fri, 8 Feb 2013 04:41:53 +0000 (23:41 -0500)]
Determine century during init and store in VARLOW mem during runtime.

Avoid reading/writing to cmos at runtime to get the QEMU century
information.  Instead, read it at startup and cache the info.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoEnable PMTIMER for CSM build
David Woodhouse [Thu, 7 Feb 2013 10:23:46 +0000 (10:23 +0000)]
Enable PMTIMER for CSM build

Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
12 years agoAdd find_pmtimer() function
David Woodhouse [Sun, 3 Feb 2013 22:41:41 +0000 (23:41 +0100)]
Add find_pmtimer() function

With CSM (and maybe coreboot) we'll want to find the pmtimer from the ACPI
tables, instead of knowing where it is and *putting* it into the ACPI
tables.

Extract the first part of the existing find_resume_vector() function into
a find_fadt() function, and use it from both find_resume_vector() and our
new find_pmtimer().

Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
12 years agoAdd README.CSM
David Woodhouse [Fri, 8 Feb 2013 15:52:01 +0000 (15:52 +0000)]
Add README.CSM

Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
12 years agoUndo incorrect assumptions about Xen in commit 6ca0460f.
Kevin O'Connor [Sat, 9 Feb 2013 02:00:46 +0000 (21:00 -0500)]
Undo incorrect assumptions about Xen in commit 6ca0460f.

Xen invokes SeaBIOS via entry_post, not entry_elf.  As a result commit
6ca0460f broke Xen.  This change effectively undoes that commit.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoPOST: Move cpu caching and dma setup to platform_hardware_setup().
Kevin O'Connor [Mon, 21 Jan 2013 17:14:29 +0000 (12:14 -0500)]
POST: Move cpu caching and dma setup to platform_hardware_setup().

The CPU cache is enabled and DMA is disabled on all real-world POST
entry situations, so no need to do this in the low-level "pre-init"
phase.  Instead, move it to the platform hardware setup stage.

Also, move the setting of the reboot flags (which control reset-vector
entry point handling) to ivt_init().

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoPOST: Reorganize post entry and "preinit" functions.
Kevin O'Connor [Mon, 21 Jan 2013 16:38:49 +0000 (11:38 -0500)]
POST: Reorganize post entry and "preinit" functions.

Unlocking ram in handle_post() is tricky and only needed under qemu.
Separate out that logic from the coreboot/xen paths by invoking
handle_elf_post separately.  This simplifies both the qemu and
non-qemu code paths.

Also, organize all the "pre-init" functions into one section of the
file.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoPOST: Move QEMU specific ramsize and BIOS table setup to paravirt.c.
Kevin O'Connor [Mon, 21 Jan 2013 07:32:48 +0000 (02:32 -0500)]
POST: Move QEMU specific ramsize and BIOS table setup to paravirt.c.

Don't clutter post.c with the gory details of QEMU memory sizing and
BIOS table creation.  Instead, move that code to paravirt.c.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoAdd CSM support
David Woodhouse [Sat, 26 Jan 2013 01:46:25 +0000 (19:46 -0600)]
Add CSM support

Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoEnsure exported symbols are visible in the final link
Kevin O'Connor [Wed, 6 Feb 2013 03:36:13 +0000 (22:36 -0500)]
Ensure exported symbols are visible in the final link

I'm about to introduce some post-processing in checkrom.py which will want
access to public symbols. So let's make sure they're defined in the final
link even if they're *not* cross-referenced from a different code section.
build: Define 16bit exported symbols in final rom.o object.

Based on patch by: David Woodhouse <David.Woodhouse@intel.com>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoAdd pic_save_mask() and pic_restore_mask() functions
David Woodhouse [Tue, 5 Feb 2013 16:37:27 +0000 (16:37 +0000)]
Add pic_save_mask() and pic_restore_mask() functions

CSM will (unfortunately) need to use these.

Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
12 years agoComplete and checksum EFI_COMPATIBILITY16_TABLE at build time
David Woodhouse [Thu, 17 Jan 2013 21:23:46 +0000 (21:23 +0000)]
Complete and checksum EFI_COMPATIBILITY16_TABLE at build time

GCC, for reasons unknown, will refuse to compile code such as
   extern int bar;
   uint16_t foo = &bar;

The assembler would happily emit a R_386_16 relocation for this if asked
nicely, and all would be well. But instead, GCC complains about the
initialiser not being constant.

So we tend to fill in 16-bit offsets at run-time, which is only
moderately inefficient. But for the CSM table used by EFI, it doesn't
work. We need the offset to be present in the *image*, before a line of
our own code has been run. Likewise the checksum.

This special-cases the table and entry point in checkrom.py rather than
attempting to do something generic. I did have a functional generic
implementation which could be invoked from csm.c along the lines of
 CHECKSUM(csm_compat_table, TableChecksum)
... and which would emit the required offsetof(typeof(\1), \2) into
a special data section which was elided from the final build but parsed
by 'objdump -s' and the location of the table to be checksummed was
inferred from the name of the *variable* that got put into that special
section... seriously, it's better just to special-case it.

It was baroque enough just for the checksums, and filling in the entry
point which required access to *two* symbols was probably going to involve
emitting a *string* into that special build-data section. It had to die.

So yes, we have hard-coded symbol names, and even magic numbers in the
python script for table offsets etc., but that's because this is an ABI.
It doesn't change, and neither do any of the other tables that we might
now consider filling at build time just to avoid having to spend time
on doing so at runtime.

Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
12 years agoImport LegacyBios.h from OVMF
David Woodhouse [Thu, 17 Jan 2013 21:55:21 +0000 (21:55 +0000)]
Import LegacyBios.h from OVMF

This is under a BSD licence so it's fine to import directly.

Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
12 years agoExport copy_smbios() from biostables.c
David Woodhouse [Sat, 26 Jan 2013 01:33:58 +0000 (19:33 -0600)]
Export copy_smbios() from biostables.c

Yes, copy_table() would invoke it, but CSM will *only* use it for SMBIOS
tables and however much we trick the compiler by gratuitously checking
the table signature right before calling copy_table(), it still doesn't
seem to notice that fact. And emits code for all the other three cases
we don't care about.

Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
12 years agoExport callrom() for CSM to use
David Woodhouse [Sat, 26 Jan 2013 01:31:47 +0000 (19:31 -0600)]
Export callrom() for CSM to use

Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
12 years agopost: Export functions which will be used individually by CSM
David Woodhouse [Sat, 26 Jan 2013 01:26:48 +0000 (19:26 -0600)]
post: Export functions which will be used individually by CSM

Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
12 years agoSupport calling a function other than maininit() from reloc_preinit().
Kevin O'Connor [Wed, 6 Feb 2013 01:57:10 +0000 (20:57 -0500)]
Support calling a function other than maininit() from reloc_preinit().

Pass a function pointer to reloc_preinit() instead of always running
maininit() after relocating the init code.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoFix rebase error in commit 8a0a972f that broke LOWMEM variables.
Kevin O'Connor [Thu, 7 Feb 2013 05:06:18 +0000 (00:06 -0500)]
Fix rebase error in commit 8a0a972f that broke LOWMEM variables.

Due to a rebase error, commit 8a0a972f caused LOWMEM variables to not
be initialized correctly.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoClean up #if in pirtable.c. CONFIG_PIRTABLE can't be set if CONFIG_COREBOOT is
David Woodhouse [Tue, 5 Feb 2013 16:01:31 +0000 (16:01 +0000)]
Clean up #if in pirtable.c. CONFIG_PIRTABLE can't be set if CONFIG_COREBOOT is

CONFIG_PIRTABLE, along with various other BIOS tables, is only selectable
if CONFIG_QEMU is selected. QEMU/COREBOOT/CSM is a choice, so you can't
enable CONFIG_PIRTABLE if you've selected COREBOOT or CSM. So kill the
excessive #if check for COREBOOT.

Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
12 years agoAdd macros for pushing and popping struct bregs
David Woodhouse [Sat, 19 Jan 2013 17:34:28 +0000 (17:34 +0000)]
Add macros for pushing and popping struct bregs

I want to do this too, and can't bring myself to introduce yet another copy.

Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Acked-by: Marc Jones <marc.jones@se-eng.com>
12 years agoPOST: Reorganize post init functions for better grouping and reusability.
Kevin O'Connor [Mon, 21 Jan 2013 06:53:31 +0000 (01:53 -0500)]
POST: Reorganize post init functions for better grouping and reusability.

Place the "interface initialization" functions together, "platform
hardware initialization" functions together, and "prepare to boot"
functions together.  This may also be useful for using SeaBIOS as a
CSM.

This slightly changes the order of some function invocations, but
should otherwise not change code behavior at all.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoNormalize POST initialization function name suffixes.
Kevin O'Connor [Mon, 21 Jan 2013 06:14:12 +0000 (01:14 -0500)]
Normalize POST initialization function name suffixes.

The POST phase has to invoke many initialization functions, and these
functions can have complex inter-dependencies.  Try to categorize the
functions into 4 classes:

preinit - functions called very early in POST where function ordering
    is very important and the code has limited access to other
    interfaces.

init - functions that initialize internal interfaces and standard
    external interfaces.  This code is generally not dependent on
    particular hardware and typically does not communicate directly
    with any hardware devices.

setup - functions which access hardware or are dependent on particular
    hardware or platform devices.

prepboot - functions that finalize internal interfaces and that
    prepare for the boot phase.

This patch attempts to normalize the suffixes - functions that used
_init(), _setup(), _finalize(), or similar that did not follow the
above pattern were renamed.  Other than function name changes, there
should be no code impact to this patch.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoMinor: Update README - variable changes are now reset on soft-reboots.
Kevin O'Connor [Sun, 20 Jan 2013 15:46:51 +0000 (10:46 -0500)]
Minor: Update README - variable changes are now reset on soft-reboots.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agopmm: Use 'struct segoff_s' in pmm header.
Kevin O'Connor [Sun, 20 Jan 2013 15:43:54 +0000 (10:43 -0500)]
pmm: Use 'struct segoff_s' in pmm header.

Minor cleanup - use 'struct segoff_s' instead of a manual
segment/offset pair.

Also, while at it, define the header signature at compile time instead
of at run-time.  (Defining at run-time is a hold over from when
variable changes were persistent across soft-reboots.)

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agovgabios: implement AX=1120H..1124H functions rel-1.7.2
Paolo Bonzini [Thu, 10 Jan 2013 12:41:36 +0000 (13:41 +0100)]
vgabios: implement AX=1120H..1124H functions

These function only have to set INT 1Fh and INT 43h, and set
the BDA height + number of rows.

I could not find out whether AX=1120h should also set the character
height to 8.  I think not, because INT 43h might still point to
14- or 16-pixel high characters and in this case INT 1Fh will not
be used at all.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
12 years agoboot: Support "halt" in the boot order to prevent default boot attempts.
Kevin O'Connor [Sat, 12 Jan 2013 21:36:11 +0000 (16:36 -0500)]
boot: Support "halt" in the boot order to prevent default boot attempts.

Current seabios will attempt to boot from both configured devices and
a list of default devices.  Sometimes it is desirable to only attempt
to boot from the configured devices and not from any of the default
devices.  This patch adds support for a "HALT" item in the "bootorder"
file - its presence will prevent SeaBIOS from attempting any default
boot actions.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Signed-off-by: Amos Kong <akong@redhat.com>
12 years agomegasas: Invert PCI device selection
Hannes Reinecke [Wed, 19 Dec 2012 14:12:47 +0000 (15:12 +0100)]
megasas: Invert PCI device selection

Stupid typo from my side ...

Signed-off-by: Hannes Reinecke <hare@suse.de>
12 years agoMinor: Separate UUID display from F12 boot prompt.
Kevin O'Connor [Sat, 22 Dec 2012 03:52:50 +0000 (22:52 -0500)]
Minor: Separate UUID display from F12 boot prompt.

Place the extra newline as part of the F12 prompt instead of the
SeaBIOS version banner so that a UUID report (when present) is still
visually separated from the boot menu prompt.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agodisplay_uuid(): fix incomplete check after the loop
Laszlo Ersek [Tue, 18 Dec 2012 04:11:39 +0000 (05:11 +0100)]
display_uuid(): fix incomplete check after the loop

In the v2->v3 change of what would become commit 37676f83
<http://www.seabios.org/pipermail/seabios/2012-December/005166.html>, the
defense against an initial "addr > end" condition ("wraparound") was
erroneously loosened.

Signed-off-by: Laszlo Ersek <lersek@redhat.com>
12 years agoacpi: Use prt_slot() macro to describe irq pins of first PCI device.
Kevin O'Connor [Sat, 15 Dec 2012 14:29:43 +0000 (09:29 -0500)]
acpi: Use prt_slot() macro to describe irq pins of first PCI device.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoacpi: reintroduce LNKS
Paolo Bonzini [Thu, 13 Dec 2012 07:42:02 +0000 (08:42 +0100)]
acpi: reintroduce LNKS

Commit 4540409 (acpi: LNKS is not needed, 2012-08-07) removed LNKS because
it basically worked by chance: _CRS returns something else then one of the
possible resources from _PRS, _DIS would not really disable the interrupt,
and there was no _SRS method.  It just happened to work because all OSes
have some kind of special-casing for SCI.

Unfortunately, the code after the patch is also against the spec, and it
breaks FreeBSD because it treats IRQ 9 polarity as active low without
the Interrupt() entry.  Actually, numeric _PRT entries are handled the
same in Linux and FreeBSD (as active-low).  However, under Linux it just
happens to trigger another special casing of SCI which sets SCI up from
its override entry in the MADT, ignoring the DSDT completely.

This patch adds back the LNKS, but without using the PIIX register for
LNKA in its methods.

Tested-by: Luigi Rizzo <rizzo@iet.unipi.it>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
12 years agomaininit(): print machine UUID under seabios version message
Laszlo Ersek [Fri, 14 Dec 2012 11:59:39 +0000 (12:59 +0100)]
maininit(): print machine UUID under seabios version message

There are users who would like to see the UUID at startup, and it probably
won't bother others.

Related RHBZ: 876250.

Signed-off-by: Laszlo Ersek <lersek@redhat.com>
12 years agoAdd compile checking phase to build.
Kevin O'Connor [Wed, 12 Dec 2012 03:40:16 +0000 (22:40 -0500)]
Add compile checking phase to build.

The build textually includes all the code together in one unit for the
compiler in order to use gcc's -fwhole-program option.  Textually
including all the code can mask subtle code errors (eg, forgetting to
include the correct headers) and can lead to confusing error reports
from the compiler.  So, compile each file individually in addition to
the normal textually inclusive build.  This improves the error
checking while still obtaining the benefits of -fwhole-program.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoDon't use gcc's -combine option.
Kevin O'Connor [Wed, 12 Dec 2012 02:59:45 +0000 (21:59 -0500)]
Don't use gcc's -combine option.

The combine option has been deprecated from gcc for the last few
revisions.  The option doesn't add any real benefits, so there's no
real point in checking for it on the few systems that will still have
it.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoDon't recursively evaluate CFLAGS variables.
Kevin O'Connor [Wed, 12 Dec 2012 02:43:05 +0000 (21:43 -0500)]
Don't recursively evaluate CFLAGS variables.

The $(cc-option) macro was being executed multiple times for each
compiler invocation.  That's a waste of time.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agovga: Minor comment spelling fix.
Kevin O'Connor [Fri, 7 Dec 2012 17:23:27 +0000 (12:23 -0500)]
vga: Minor comment spelling fix.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agofloppy: Minor - reduce handle_0e code size when CONFIG_FLOPPY is disabled.
Kevin O'Connor [Fri, 7 Dec 2012 16:25:58 +0000 (11:25 -0500)]
floppy: Minor - reduce handle_0e code size when CONFIG_FLOPPY is disabled.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoacpi: drop irq 8 from hpet ressources
Gerd Hoffmann [Thu, 6 Dec 2012 15:46:08 +0000 (16:46 +0100)]
acpi: drop irq 8 from hpet ressources

Fixes WinXP BSOD.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
12 years agoacpi: Minor - merge the two dsdt ISA areas into one ISA area.
Kevin O'Connor [Tue, 4 Dec 2012 00:04:55 +0000 (19:04 -0500)]
acpi: Minor - merge the two dsdt ISA areas into one ISA area.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoacpi: fix COM2._UID
Gerd Hoffmann [Tue, 4 Dec 2012 15:26:40 +0000 (16:26 +0100)]
acpi: fix COM2._UID

Commit 8d7449771068824b8bdb51fe622c10660b373d4f broke this.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
12 years agoacpi: reorder PX13 + ISA
Gerd Hoffmann [Tue, 4 Dec 2012 15:26:39 +0000 (16:26 +0100)]
acpi: reorder PX13 + ISA

Without this windows 7 BSODs, probably because
we are referencing PX13 from ISA.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
12 years agoacpi: PCI routing DSDT simplifications.
Kevin O'Connor [Sun, 2 Dec 2012 07:33:33 +0000 (02:33 -0500)]
acpi: PCI routing DSDT simplifications.

Use define_link() macro in PIIX4 hardware definitions.  Now that all
remaining irq links are the same it's possible to just use a macro to
define the link.

Port several size optimizations to the q35 irq routing definitions:
define the PRQx fields in the _SB scope to reduce size of register
references, define CRS and STA methods in _SB scope to reduce code
duplication, simplify acpi code.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoACPI: Delineate q35 ACSP DSL code into sections.
Kevin O'Connor [Sun, 2 Dec 2012 06:40:07 +0000 (01:40 -0500)]
ACPI: Delineate q35 ACSP DSL code into sections.

Add comments around major sections of the DSL file.  Also, add scope
declarations where needed so that each section only contains one
scope.

This is the q35 equivalent of e9fe15b86c6e98a91b30511d005ecdcc8a3e578d.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoACPI: Move q35 PCI irq definitions together.
Kevin O'Connor [Sun, 2 Dec 2012 06:30:27 +0000 (01:30 -0500)]
ACPI: Move q35 PCI irq definitions together.

Place all the q35 irq definitions close to each other.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoACPI: Move PCI0 hotplug and irq definitions to there respective areas.
Kevin O'Connor [Sun, 2 Dec 2012 06:22:23 +0000 (01:22 -0500)]
ACPI: Move PCI0 hotplug and irq definitions to there respective areas.

Group the hotplug code and definitions together along with the irq
code and definitions.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoACPI: Remove unnecessary Return(One) calls from q35 DSDT.
Kevin O'Connor [Sun, 2 Dec 2012 06:15:03 +0000 (01:15 -0500)]
ACPI: Remove unnecessary Return(One) calls from q35 DSDT.

Recent iasl compilers warn about spurious return calls.  Remove extra
return calls from the GPE event methods.  This is the q35 dsdt
equivalent of patch 475ce3f5f6a986877d637ac39f6ee23484ecc992.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoacpi: Reindent DSDT code.
Kevin O'Connor [Sun, 2 Dec 2012 06:09:17 +0000 (01:09 -0500)]
acpi: Reindent DSDT code.

This patch is purely cosmetic - no code changes should be observed.

Use a consistent indentation style with the ACPI DSDT code:
1 - Use spaces (no tabs) and 4 space indentation
2 - Place opening braces on same line as statement declaration
3 - Don't put a space between statement and opening parenthesis,
    except for control statements (If, Else, While, Return) where a
    space is always present

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoacpi: move isa devices to separate file [q35]
Gerd Hoffmann [Wed, 28 Nov 2012 09:17:48 +0000 (10:17 +0100)]
acpi: move isa devices to separate file [q35]

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoacpi: add mcfg table for mmconfig
Gerd Hoffmann [Wed, 28 Nov 2012 09:17:35 +0000 (10:17 +0100)]
acpi: add mcfg table for mmconfig

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoq35: fix default vga address
Gerd Hoffmann [Wed, 28 Nov 2012 09:17:49 +0000 (10:17 +0100)]
q35: fix default vga address

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
12 years agoacpi: move isa devices to separate file
Gerd Hoffmann [Wed, 28 Nov 2012 09:17:47 +0000 (10:17 +0100)]
acpi: move isa devices to separate file

Stuff them parameterized into #defines, so we can (a) reuse them for
q35 and (b) don't duplicate the serial line.

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