Kevin O'Connor [Wed, 17 Dec 2008 04:50:52 +0000 (23:50 -0500)]
Don't turn off apic after smp detect; use cmos for smp count on emulators.
Don't restor the APIC_SVR value - doing so confuses kvm.
When running on an emulator, get the smp count from cmos (timing on an
emulator - especially when simulating large cpu counts - is too
unreliable to do a count based on timers.)
Kevin O'Connor [Sat, 13 Dec 2008 23:33:05 +0000 (18:33 -0500)]
Cleanup of fixed space addresses.
The BIOS_CONFIG_TABLE must be aligned to 1 (or gcc may change it).
Consistently use __aligned(x) wrapper throughout C code.
Register the official fixed address handlers - even if it is only a
jump to the real handler.
Declare .type of data objects - it improves disassembler output.
Put labels at all fixed addresses - it improves disassembler output.
entry_hwirq should be calling 'cli' - use regular entry macro.
int1D is a data table, not code - so don't put an iretw there.
Kevin O'Connor [Thu, 11 Dec 2008 01:40:13 +0000 (20:40 -0500)]
Improve support for old 16bit resume handlers.
Detect a non-standard CMOS shutdown code during post and run a
separate resume handler.
Set aside space in the EBDA for the resume handler stack.
Add support for several of the code supported in bochs bios.
Kevin O'Connor [Sun, 7 Dec 2008 04:11:56 +0000 (23:11 -0500)]
Don't overwrite memory on smm init.
Save/restore memory changed during smm init - this is based on a patch
committed to bochs bios.
Also, clean up ioport and base memory address definitions for smm.
Kevin O'Connor [Sun, 7 Dec 2008 00:37:56 +0000 (19:37 -0500)]
Execute smp detect code in place instead of copying it.
Compile the smp detect handler with the rest of the 16bit code.
Implement a simple ljmpw trampoline so the main code can run in place.
Restore memory afterwards to prevent memory corruption.
Kevin O'Connor [Sat, 6 Dec 2008 23:56:19 +0000 (18:56 -0500)]
Makefile cleanups.
Don't assemble romlayout16.S with debugging on - gcc gets confused
when multiple files with debugging are included.
Be more consistent in status messages.
Use ccode instead of blob/romlayout32 -- it's more accurate.
Kevin O'Connor [Sat, 6 Dec 2008 16:57:45 +0000 (11:57 -0500)]
Add additional PCI option rom checks.
PCI_ROM_ADDRESS is only valid for PCI_HEADER_TYPE_NORMAL devices.
Don't attempt to run a rom with address less than 16MiB.
Don't run roms for IDE code when native IDE support is available.
Also, move hardcode option rom defs to config.h.
Also, add some minor code cleanups.
Kevin O'Connor [Fri, 5 Dec 2008 00:39:10 +0000 (19:39 -0500)]
Don't allow start_bdf with new auto max bus detection code.
It's not valid to set a "start bdf" when search for a device now,
because we wont be able to properly detect the maximum bus unless
we start at the beginning.
Change callers that need to resume a search to use foreachpci() macro.
Update all callers so that they don't pass in the now unused start_bdf.
Kevin O'Connor [Sun, 30 Nov 2008 01:39:06 +0000 (20:39 -0500)]
Enance support for PCI option roms.
Scan for the PCI option rom structure on each PCI card.
Support multiple images in an option rom.
Don't map to area just above memory - assume card is already
programmed with a valid address.
Kevin O'Connor [Sun, 30 Nov 2008 01:31:49 +0000 (20:31 -0500)]
Only touch PCI functions > 0 on multi-function devices; rescan max pci each time.
Some single-function devices will respond to all sub-functions - and
this confuses things. So, when scanning the PCI bus make sure to
only touch function 0 on single-function devices.
Since the bus scanning code is necessarily complex now, we might as
well implement max bus detection inline with all pci scans. So,
there is no need to scan for the max bus at startup.
Kevin O'Connor [Fri, 28 Nov 2008 16:56:37 +0000 (11:56 -0500)]
Fix bug - bios writes must be enabled before max PCI bus detected.
The max pci bus is stored in the bios segment, so it must be writable.
So, use a default max size (1 pci bus) for the initial write enable
device scan and then do the full max bus check after write is
enabled.
Kevin O'Connor [Wed, 26 Nov 2008 22:02:43 +0000 (17:02 -0500)]
Enable a default hw irq handler.
Also, only route hw irqs to their handlers when they are enabled.
(This ensures that if a subsystem is disabled that the default
hwirq handler will be used.)
Add helper macros to declare the extern asm handlers.
Always enable the RTC hwirq at startup (as opposed to when it is first
used).
Fix bug in default handler - wrong bit was used for checking the
cascaded irq.
Kevin O'Connor [Sun, 16 Nov 2008 14:17:02 +0000 (09:17 -0500)]
Cleanup a20 code.
Fix two apparent bugs - set_a20() returned new status instead of old
status and handle_152402() checked wrong bit.
Add bit definition for the a20 enable bit: A20_ENABLE_BIT
Allow ioport.h #defines to be used in romlayout.S.
Kevin O'Connor [Wed, 12 Nov 2008 02:34:37 +0000 (21:34 -0500)]
Move POST stack from 0xfffe to 0x7c00.
The BIOS Boot Specification recommends 0x7c00 - 0xffff for option rom
temp storage, so don't use that space as a stack.
Also, default CONFIG_VGAHOOKS off as it isn't generally useful.
Finally, update TODO list.
Kevin O'Connor [Sun, 9 Nov 2008 20:33:47 +0000 (15:33 -0500)]
Overhaul PCI config functions.
Remove PCIDevice struct and replace with a "u16" with BDF -
Bus/Device/Function. This simplifies the code in several places.
Also, scan for and store the maximum PCI bus found during startup.
The previous config option CONFIG_PCI_BUS_COUNT is no longer
needed and has been removed.
Kevin O'Connor [Sun, 9 Nov 2008 02:36:35 +0000 (21:36 -0500)]
Overhaul option rom processing.
Add initial support for scanning PCI devices for option roms.
Implement two pass option rom scan - init first then scan for bev/bcv.
Support calling BCV vectors that are found.
Kevin O'Connor [Sat, 8 Nov 2008 18:35:32 +0000 (13:35 -0500)]
Avoid casting EBDA variables ipl.description and pir_loc.
Define them using their native types (pointers).
Also, fix an apparent bug in mptable coreboot processing - it
incorrectly overwrote the pir_loc variable.
Kevin O'Connor [Sat, 8 Nov 2008 18:05:27 +0000 (13:05 -0500)]
Update e820 map in place instead of copying it.
Allocate the e820 map space in the 0xf0000 segment and do all updates
in place. This reduces the need to access external memory during
post.
Also, move e820 pointer and count from ebda to variables in 0xf0000.
Kevin O'Connor [Sat, 8 Nov 2008 18:02:46 +0000 (13:02 -0500)]
Rework READx_SEG/WRITEx_SEG macro type detection.
Detect types by size instead of by comparison to different integer types.
This allows pointers and other types to be directly accessed.
Note that this does slightly pessimize 64bit accesses.
Kevin O'Connor [Sun, 31 Aug 2008 15:16:33 +0000 (11:16 -0400)]
Use PCI bus scan to find all ATA controllers. Several IDE fixes.
Find all ATA controllers via a pci bus - don't poke random IO ports.
Force IDE drives to 512 byte sector size; word 5 in identify command
isn't defined on recent drives.
Add debugging info for extended_access and int 1348 calls.
int 1348 enhancements - general cleanup, report drives as PCI, correct
iface_path/device_path settings, checksums should be a 2's
complement, call disk_ret() on all return paths, always use dpte
revision 0x11, don't set size above 30 bytes.
Kevin O'Connor [Sun, 31 Aug 2008 15:06:27 +0000 (11:06 -0400)]
Rename pci_find_class() to pci_find_classprog(), and add new functions.
New pci_find_class() searches by just class, not class and prog-if.
Add some new pci config space definitions.
Add inline functions for converting to/from bus/dev/fn to bdf to PCIDevice.
Kevin O'Connor [Sun, 17 Aug 2008 15:26:42 +0000 (11:26 -0400)]
Misc minor improvements.
Update TODO list.
Improve comments in boot.c.
Use debug port 0x0402 instead of 0x0403 (bochs prefers the latter).
Fix formatting of debug messages in kbd.c.
Use proper return check for kbd and mouse init.
Kevin O'Connor [Sun, 17 Aug 2008 15:08:46 +0000 (11:08 -0400)]
Return max bus number in int 1a/b101 call.
Add new option CONFIG_PCI_BUS_COUNT to set max bus count.
Use that option consistently in handle_1ab101() and pci.c.
Also, clean up comments of handle_1ab101().
Kevin O'Connor [Sun, 17 Aug 2008 15:03:24 +0000 (11:03 -0400)]
Remove CONFIG_QEMU option - breakout into other options.
Define all the required app names in config.h directly.
Control UUID detection via new option - CONFIG_UUID_BACKDOOR.
Don't enable mptable on uniprocessor machines (check use to only be
done for qemu, but it is needed everywhere).
Also add new option CONFIG_SMBIOS.
Kevin O'Connor [Sun, 17 Aug 2008 14:50:57 +0000 (10:50 -0400)]
Improve smp detection code.
Use 'lock incw' to ensure proper synchronization between cpus.
Jump to the 0xf0000 segment for the halt (to ensure halt code isn't overwritten).
Improve code comments.
Kevin O'Connor [Tue, 22 Jul 2008 02:23:05 +0000 (22:23 -0400)]
Add additional config options to remove parts of code.
Added options CONFIG_BOOT, CONFIG_SERIAL, CONFIG_LPT, CONFIG_KEYBOARD,
CONFIG_BOOTMENU.
Also extended coverage of existing options to ensure full code got
removed.
Kevin O'Connor [Sat, 19 Jul 2008 18:12:32 +0000 (14:12 -0400)]
Misc fixes and updates.
Minor code cleanups.
Fix parenthesis imbalance in keyboard led test.
The printf() call is only used in 32bit mode - make this explicit to
the compiler - it improves the code generation.
Clear the screen after initializing the vga option rom.
Kevin O'Connor [Tue, 8 Jul 2008 01:37:10 +0000 (21:37 -0400)]
Improve debugging output.
Return the line number of the debug_fail() / debug_stub() call site on
each call.
Show the return status on set_code_fail() calls.
Also, the floppy_1305() code should not clear AL.
Kevin O'Connor [Sun, 6 Jul 2008 13:56:14 +0000 (09:56 -0400)]
Relinking rom32.o twice seems flaky - make third link stage.
Sigh - ld seems to move things around when relinking files. So,
separate out the link stages so that everything is incremental.
Also, improve diagnostics of checkrom.py tool.
Kevin O'Connor [Sun, 6 Jul 2008 00:41:53 +0000 (20:41 -0400)]
Use ld to build final rom; remove custom build utilities.
It's possible to build the final rom with a little LD magic - so use
that instead of the buildrom.py / defsyms.py method.
Also, rename all occurances of ".globl" to the more clear ".global".