Kevin O'Connor [Wed, 30 Dec 2009 17:14:53 +0000 (12:14 -0500)]
Add support for 32bit PCI BIOS entry.
Create a new code blob (code32seg) with support for 32bit functions
that need to utilize explicit segment accesses.
This code blob uses global variables relative to %gs and with a
dynamic code offset (determined by get_global_offset()).
Add BIOS32 structure and code.
Add code for 32bit PCI BIOS code.
Kevin O'Connor [Sun, 27 Dec 2009 04:23:15 +0000 (23:23 -0500)]
Remove pci_bios_bigmem_addr; set pci_bios_mem_addr=0xe0000000
This patch removes pci_bios_bigmem_addr, and it changes
pci_bios_mem_addr to start at 0xe0000000.
The pci_bios_bigmem_addr was removed from bochs. Also, the current
code looks wrong as nothing stops an address given from
pci_bios_bigmem_addr from overlapping an address given from
pci_bios_mem_addr.
The change also moves pci_bios_mem_addr back to 0xe0000000 - both the
acpi and mtrr code use 0xe0000000.
Kevin O'Connor [Sun, 20 Dec 2009 18:11:17 +0000 (13:11 -0500)]
Fix yield() so it works from boot code.
In boot code, the f-segment is read-only, so make sure yield() doesn't
rely on writes.
Easiest way to do this is to avoid stack switches when not needed.
Kevin O'Connor [Sat, 19 Dec 2009 16:03:40 +0000 (11:03 -0500)]
Fix potential build failure due to text16 section being too large.
A relative PC jump can't exceed 32K, but .text16 can be bigger than 32K.
Separate out .text16 into data sections (.data16) and code (.text16).
Place text and fixed sections together at end of f-segment.
This reduces 16bit text size to ~28K which fixes build errors for now.
Gerd Hoffmann [Fri, 18 Dec 2009 11:16:04 +0000 (12:16 +0100)]
qemu: add rom loading via fw_cfg
Add support for loading roms using the qemu fw_cfg interface,
modeled after the existing cbfs support. Use it to look for
vgabios (vgaroms/*) and option roms (genroms/*).
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Kevin O'Connor [Sun, 13 Dec 2009 18:04:17 +0000 (13:04 -0500)]
Distinguish between debug reports for unimplemented vs invalid calls.
Don't use "fail" in the debug output - as this confuses users.
When reporting on an invalid parameter - use the word "invalid".
When reporting on an unimplemented call - state it is unimplemented.
Add separate debug levels for unimplemented vs invalid calls.
Also, increase the debug level of several entry points.
Kevin O'Connor [Sun, 13 Dec 2009 17:02:55 +0000 (12:02 -0500)]
ATA 48bit LBA should only be activated on read/write commands.
Check explicitly for an extended read/write command instead of 0x04
bit set. The identify command has that bit set, but doesn't need
the 48bit lba registers set.
Kevin O'Connor [Sun, 13 Dec 2009 16:25:25 +0000 (11:25 -0500)]
Enhance experimental option rom "threading" - enable preemption.
When experimental support for parallelizing option roms and hardware
init (default disabled) is selected, add support for checking on
hardware init progress from the RTC irq handler.
Enable ability for RTC to be turned on for additional users.
Allow regular option roms (not just vga option roms) to run in
parallel with hardware init.
Don't use stack in transition32 / transition16 until new mode is
entered.
Also, cleanup leaking of data handlers in usb code.
Also, decrease frequency of iomemcpy checks (every 2K instead of 1K).
Kevin O'Connor [Fri, 11 Dec 2009 01:13:57 +0000 (20:13 -0500)]
Make SMBIOS table pass MS SVVP test
Microsoft SVVP (Server Virtualization Validation Program) expects
arbitrary SMBIOS field to have certain values otherwise it fails.
We all want to make Microsoft happy don't we? So lets put values MS
expects in there.
Values modified by the patch:
Type 0:
Bit 2 of byte 2 must be 1
Type 1:
Manufacturer/product string should not be empty
Type 3:
Manufacturer string should not be empty
Type 4:
Processor manufacturer should no be empty
Max/current CPU speed shouldn't be unknown
Type 16:
Memory should have error correction.
---
v1->v2:
Use CONFIG_APPNAME instead of open coding strings
Use snprintf.
Kevin O'Connor [Thu, 10 Dec 2009 02:15:59 +0000 (21:15 -0500)]
Unify ps2 port data processing.
Unify the code for mouse and keyboard irq handling.
Support case where mouse irq fires but keyboard data present and
vice-versa.
Support data in i8042 queue while ps2 command being processed.
Kevin O'Connor [Sat, 5 Dec 2009 23:51:53 +0000 (18:51 -0500)]
Introduce optimized iomemcpy function for copying from io memory.
Reading from IO memory (pci rom or flash) is very slow, so add
iomemcpy() which will yield during copy. Use a 4 byte copy to
optimize accesses.
Also, decompress cbfs data files from a temp memory buffer so that
ulzma doesn't read from slow IO memory.
Kevin O'Connor [Sat, 5 Dec 2009 18:36:18 +0000 (13:36 -0500)]
Fix ATA iobase2 access on PCI native mode interfaces.
The ctrl register is iorange + 2 not iorange + 6.
Rework port definitions to be based on PCI offsets instead of ISA.
Also, properly define ATA irqs when in PCI compatibility mode.
Kevin O'Connor [Sat, 5 Dec 2009 16:25:09 +0000 (11:25 -0500)]
Support ISA ATA devices for qemu's "-M isapc" mode.
Add probing for ISA ATA devices when no pci devices found.
Also, add defines for common ATA ports.
Also, make sure irq and pci_bdf are defined for both pci ata controllers.
Kevin O'Connor [Sat, 14 Nov 2009 18:34:27 +0000 (13:34 -0500)]
Fixes for mptable generation.
Rework cpu iteration to simplify. Also fixes sparse table generation
when multiple cores found.
Rework entrycount generation to fix irq0override code.
Move fls() to util.h.
Add free calls when allocation fails.
Kevin O'Connor [Wed, 4 Nov 2009 00:50:52 +0000 (19:50 -0500)]
Reorder source code to work around weird -combine issue.
Seeing an odd issue with ZoneTmpHigh not being declared global - for
now, work around by reordering the soruce files.
Also, remove the ".comment" section from the final .elf file.
Kevin O'Connor [Sat, 24 Oct 2009 21:57:29 +0000 (17:57 -0400)]
Add simple cooperative threading scheme to allow parallel hw init.
Enable system for running hardware initialization in parallel.
The yield() call can now round-robin between "threads".
Rework ata controller init to use a thread per controller.
Make sure internal drives are registered in a defined order.
Run keyboard initialization in a thread.
Rework usb init to use a thread per controller.
Kevin O'Connor [Sat, 24 Oct 2009 15:06:08 +0000 (11:06 -0400)]
Replace irq_enable() regions with explicit calls to check for irqs.
Add new function yield() which will permit irqs to trigger.
The yield() call enables irqs to occur in 32bit mode.
Add [num]sleep calls that yield instead of just spinning.
Rename existing int 1586 usleep call to biosusleep.
Convert many calls to mdelay to msleep.
Kevin O'Connor [Fri, 23 Oct 2009 01:48:39 +0000 (21:48 -0400)]
Pass 'drive_s' pointer instead of driveid.
Pass a pointer to the drive_s struct instead of a driveid array offset.
Don't allocate ata drive's until a real drive found.
Introduce getDrive() and allocDrive() functions.
Kevin O'Connor [Wed, 14 Oct 2009 23:28:04 +0000 (19:28 -0400)]
fix low bits in ROM and I/O sizing
This cleans up handling of low bits during BAR sizing,
to match PCI spec requirements, and to use symbolic
constants from pci_regs.h
Issues fixed:
For ROM BARs, bit 0 is writeable (enable bit), which we not
only don't want to set, but it will stick and make us think
it's an I/O port resource.
Further, PCI spec defines the following bits as reserved:
- bit 1 in I/O BAR
- bits 10:1 in ROM BAR
and we should be careful and preserve any values there,
and should ignore anything we read from these registers.
Bits 3:2 in I/O BAR might be writeable, so it
is wrong to mask them when calculating BAR size.
Spec references:
See 6.2.5.1 for I/O and memory, and 6.2.5.2 for ROM,
6.1 for reserved bit handling;
pages 225, 228 and 214 in PCI spec revision 3.0.
Kevin O'Connor [Mon, 12 Oct 2009 16:54:56 +0000 (12:54 -0400)]
Use pmm_malloc() for internal allocations.
Using pmm_malloc permits free() to be used on internal allocations.
Rework low zone expanding so that it doesn't cause gcc v4.3 error.
Allow pmm_malloc to use ZoneTmpLow if ZoneTmpHigh isn't available.
Kevin O'Connor [Mon, 12 Oct 2009 14:34:51 +0000 (10:34 -0400)]
enable io/memory unconditionally
VGA adapters need to claim memory and i/o
transactions even if they do not have any
i/o or memory bars. E.g. PCI spec, page 297,
gives an example of such a device:
Programming interface 0000 0000b
VGA-compatible controller. Memory
addresses 0A 0000h through 0B
FFFFh. I/O addresses 3B0h to 3BBh
and 3C0h to 3DFh and all aliases of
these addresses.
While we could check for these devices and special-case them, it is
easier to fix this by enabling i/o and memory space unconditionally:
devices that do not support it will just ignore this setting.
Kevin O'Connor [Mon, 12 Oct 2009 14:09:15 +0000 (10:09 -0400)]
Add stubs for USB OHCI support.
Enable USB wrapper functions to call either ohci or ehci helpers.
Implement pci_config_maskw in place of pci_set_bus_master.
Introduce 'struct usb_pipe' in place of 'void *' for pipes.
Kevin O'Connor [Fri, 9 Oct 2009 02:09:02 +0000 (22:09 -0400)]
Add SRAT ACPI table support.
Take NUMA topology info from the QEMU firmware configuration interface
(number of nodes, node for each (V)CPU and amount of memory) and build
a SRAT table describing this topology for the guest OS. Handles more than
4 GB of RAM by including a hole for 32bit PCI memory mapping.
Kevin O'Connor [Fri, 9 Oct 2009 02:02:33 +0000 (22:02 -0400)]
Remove irq 9 from the pci interrupt link resources.
qemu can't share isa irqs (which is how the acpi sci interrupt is implemente
with the pci irqs, so remove the sci interrupt from the pci link interrupt
candidate list.
Kevin O'Connor [Fri, 9 Oct 2009 01:59:51 +0000 (21:59 -0400)]
Advertise pci irqs as active high in DSDT
Now that kvm emulates the ioapic polarity correctly, we must describe
the polarity correctly in the acpi tables. Otherwise pci interrupts won't
be delivered correctly.