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.
Qemu implements PCI interrupts as active high, but OSes assume
that they are active low as per PCI spec. Qemu works without override
only because ioapic there doesn't implement polarity bit.
Kevin O'Connor [Thu, 8 Oct 2009 12:51:24 +0000 (08:51 -0400)]
Really fix linker issue with "debuginfo" variable.
The 16bit and 32bit code can't share debuginfo because it points to
code and must point to 16bit code in 16bit mode. Introduce two
separate variables - one for 32bit mode and one for 16bit mode.
Kevin O'Connor [Wed, 7 Oct 2009 23:44:23 +0000 (19:44 -0400)]
resolve memory device roll over reporting issues with >32G guests
The field within the Memory Device type 17 is only a word with the MSB being
used to report MB/KB. Thereby, a guest with 32G and greater would report
incorrect memory device information rolling over to 0.
This presents more than one memory device and associated memory structures
if the memory is larger than 16G
Kevin O'Connor [Tue, 29 Sep 2009 01:32:08 +0000 (21:32 -0400)]
Initial support for USB, UHCI, and USB Keyboards.
This adds preliminary support for USB controllers and keyboards.
Add support for UHCI controllers.
Add support for "HID" USB keyboards.
Also, fix bug in hexdump() - len need not be power of 4.
Kevin O'Connor [Sun, 20 Sep 2009 23:47:45 +0000 (19:47 -0400)]
Allow rom to grow beyond 64K.
If rom is over 64K then use part of e-segment for 32bit code.
Push 32bit code as high as it can go in the f-segment.
Do version building before layoutrom.py - this way layoutrom knows
full size of rom.
Make layoutrom.py build the full ld script - remove now unused ld
scripts that just imported the output of layoutrom.py.
Also, use "objdump" instead of "nm" - reduce toolchain requirements.
Enhance tools/checkrom.py so that it can pad bios.bin to size qemu is
happy with.
Also, add dependencies to build rules for local tools - if tool
changes automatically rerun it.
Make sure option roms don't overwrite the 32bit code (should the 32bit
code be in the e-segment).
Make sure shadow code works even if part of the code is in the
e-segment.
Kevin O'Connor [Sun, 20 Sep 2009 19:33:08 +0000 (15:33 -0400)]
Support sleeping until an irq fires, and use where applicable.
Add wait_irq() - it's more efficient than looping with cpu_relax().
Also, move kbd irq enables down - only kbd_command needs it.
Also, make some minor code layout improvements to kbd.c.
Kevin O'Connor [Sat, 12 Sep 2009 23:35:04 +0000 (19:35 -0400)]
Unify cd emulation access and main disk access code.
Add a new backend driver for cd emulation (DTYPE_CDEMU). This backend
driver now does the work of scheduling mis-sized reads.
Add mechanism for obtaining emulated drive geometry.
Extend disk_1308() to support cdrom emulation.
Use regular disk_13*() calls even for cdemu.
Also, unify the X_SECTOR_SIZE definitions.
Kevin O'Connor [Sat, 12 Sep 2009 17:20:14 +0000 (13:20 -0400)]
Add mechanism for describing internal drives in boot menu.
Allow each drive type to describe itself on the boot menu.
This fixes a bug where driveid was used in place of ataid in the boot
menu.
Also, expand descriptions for each drive type.
Don't overload the IPL type for BCVs - instead introduce new types.
Kevin O'Connor [Sun, 30 Aug 2009 23:31:22 +0000 (19:31 -0400)]
Ramdisk cleanups.
Use malloc code to allocate space for floppy image instead of
searching e820 map - this prevents a possible conflict with memory
allocated by pmm.
Check int 1587 return code.