Kevin O'Connor [Sat, 28 Jun 2008 16:15:57 +0000 (12:15 -0400)]
Improve some debugging output.
Replace DEBUGF calls with dprintf calls.
Make ata calls consistently use 'int' return codes.
Make each error return code in ata.c use a unique negative number.
Kevin O'Connor [Sat, 21 Jun 2008 16:24:14 +0000 (12:24 -0400)]
Add code (currently disabled) to mask run away irqs.
Add handler that can react to any unknown hardware irq by masking that
irq. This can be useful for finding/fixing run away irq issues.
Don't currently register these hardware irq handlers
Also, sort and improve default debug levels for bios handlers.
Kevin O'Connor [Sat, 21 Jun 2008 16:15:10 +0000 (12:15 -0400)]
Init serial port before using it for debug - also reinit after option rom.
Apparently, some VGA option roms will enable serial irqs - this could
cause problems with spurious irqs from debug messages.
Also, improve debugging of option roms that fail the checksum check.
Kevin O'Connor [Sat, 21 Jun 2008 15:55:29 +0000 (11:55 -0400)]
PCI fixes
Only set the PIR table signature and checksum in the init function -
that way, if it is disabled at runtime (eg, due to coreboot) then
it wont be found by the OS.
Fix parameter swap bug in handle_1ab102.
Add support for more than one bus in pci scanning code (but only have
1 bus for now).
Kevin O'Connor [Sat, 14 Jun 2008 19:56:16 +0000 (15:56 -0400)]
Cleanup handling of interrupt controller (PIC).
Add new file (pic.h) with helpers for accessing the PIC.
Move irq enabling code to the files that use those interrupts.
Also, don't setup for floppy if floppy support not enabled.
Kevin O'Connor [Fri, 13 Jun 2008 02:22:43 +0000 (22:22 -0400)]
Support relocating coreboot generated acpi rsdp and pir tables.
The coreboot code will now scan the areas marked by CB_MEM_TABLE for
PIR and RSDP tables. If found, they'll be moved to the 0xf0000
segment.
Also, the find_cb_memory() function has been made generic.
Kevin O'Connor [Fri, 13 Jun 2008 02:16:35 +0000 (22:16 -0400)]
Generate PIR table at post time.
Move the predefined PIR table (only useful on emulators) to its own
file - pirtable.c.
Have the pcibios code inspect the pre-built PIR table on 1ab10e
calls.
Kevin O'Connor [Thu, 12 Jun 2008 02:47:01 +0000 (22:47 -0400)]
Move acpi code out of rombios32.c; clean up use of fixed memory addresses.
Move acpi code from rombios32.c to acpi.c.
Move all fixed memory addresses used by the code to config.h and
consistently use a "BUILD_" prefix on the definitions.
Move some pci defs to pci.h - allows access from acpi.c and rombios32.c.
Introduce ALIGN() macro - remove old align function.
Kevin O'Connor [Sun, 8 Jun 2008 17:48:06 +0000 (13:48 -0400)]
Separate out ram shadow code and permit more code to write to bios.
Extract shadow code from rombios32.c to its own file - shadow.c.
Reorg post.c so that shadow enable happens early and ram lock happens
late in boot process.
Also, improve some comments in post.c and reorg code slightly.
Kevin O'Connor [Sun, 8 Jun 2008 17:34:43 +0000 (13:34 -0400)]
Properly save/restore %esp high bits.
It turns out that some OSs do call into the bios with junk in the %esp
high bits. So, make sure it is properly cleared and then
saved/restored.
Have the 32bit apm entry point use its own %esp safe entry macro.
Kevin O'Connor [Sat, 7 Jun 2008 18:51:14 +0000 (14:51 -0400)]
APM fixes; don't save/clear/restore %esp high bits.
Don't worry about %esp high bits - 16bit protected mode may require
the bits to be set. It would be very odd to call into the bios
with junk in %esp high bits.
Fix 32bit apm entry point.
Don't log apm calls 155306/15530b.
Kevin O'Connor [Sat, 7 Jun 2008 14:43:07 +0000 (10:43 -0400)]
Serial debugging code must not access BDA.
Regular serial writing code uses the system timer to timeout failed
writes - however, serial debugging can't rely on access to the BDA
segment or the hardware timer.
Therefore, implement a simple debug only serial writing function and
separate it from the regular serial output code.
Also include change to dump_regs - don't call __dprintf if debugging
not on.
Kevin O'Connor [Sat, 7 Jun 2008 14:11:36 +0000 (10:11 -0400)]
Improvements to checkstack.py tool.
Ignore BX_PANIC calls - they shouldn't happen in practice.
Ignore "addr32" prefix when looking at instructions.
Add check for "lcallw" insn.
Don't display redundant calls to the same function (with same stack usage).
Kevin O'Connor [Mon, 26 May 2008 19:06:40 +0000 (15:06 -0400)]
Fix bug causing ata_reset to not wait for BSY to clear.
ata_reset is always called on a valid drive - it shouldn't need to recheck.
All callers expect BSY to be clear upon completion.
This fixes an issue where ata_detect was reading status before drive ready.
Kevin O'Connor [Sun, 25 May 2008 03:46:33 +0000 (23:46 -0400)]
Improve control of debug messages.
Rename BX_INFO() to dprintf() and add a "severity level" parameter.
Add CONFIG_DEBUG_LEVEL compile option to control debug verbosity.
Add more debug info to init steps of post.c.
Kevin O'Connor [Sun, 25 May 2008 03:07:16 +0000 (23:07 -0400)]
PCI enhancements.
Allow one to enable/disable PIR tables separately from PCI BIOS support.
Use standard PORT_* defs for 0xcf8/0xcfc port accesses.
Don't pass PCIDevice pointers around - the struct is small enough to
pass in a register.
Extract out pci_find_device and pci_find_class functions from PCI BIOS
code.
Remove PCI_FIXED_HOST_BRIDGE check - the check is too late if standard
PCI support isn't available. If standard support is available,
then the code should be okay to run.
Kevin O'Connor [Sun, 18 May 2008 06:42:58 +0000 (02:42 -0400)]
Initial support for coreboot.
Add new option for targetting a coreboot payload.
When in coreboot mode, configure out those parts of the code that wont
work on real hardware.
Don't include cmos.h in files that don't need it.
Kevin O'Connor [Sun, 18 May 2008 05:43:07 +0000 (01:43 -0400)]
Cleanup ata hard drive detection.
Don't rely on nvram for hd geometry - instead use values autodetected.
Don't outb() to PORT_HD_DATA - was left over from old code.
Reorganize parts of ata_init/ata_detect.
Separate hd geometry translation code to its own functions.
Kevin O'Connor [Wed, 14 May 2008 02:31:39 +0000 (22:31 -0400)]
Sync rombios32.c with bochs cvs.
Use 0x30/0x31 for reading memory size (when EXTMEM2 not found).
Also convert cmos ids to use defined names.
Don't advertise support for suspend c2/c3 levels.
Move uuid_probe closer to usage.
Kevin O'Connor [Sat, 10 May 2008 19:49:20 +0000 (15:49 -0400)]
Fix elf build; rename target file rom.bin to bios.bin.
The main output file is now called out/bios.bin (instead of out/rom.bin).
Use ld to build final elf file and call the result out/bios.bin.elf
Make sure to long jump from external 32bit entry point.
Kevin O'Connor [Wed, 7 May 2008 00:00:12 +0000 (20:00 -0400)]
This patch does:
- Rename BX_* options to CONFIG_* (rombios32.c)
- Add QEMU_SUPPORT compile time option (config.h)
- Properly check compile options, so we can turn off them by assigning
them values of 0s. (rombios32.c)
Signed-off-by: Nguyen Anh Quynh <aquynh@gmail.com>
Kevin O'Connor [Sat, 5 Apr 2008 19:51:12 +0000 (15:51 -0400)]
Forward port new boot menu features from bochs bios.
Support boot menu during last stage of post.
Improve description of option roms.
Support printf of "%.s" to force printing strings on stack.
Enhance memcpy so that it also works in real-mode.
Kevin O'Connor [Tue, 1 Apr 2008 01:56:04 +0000 (21:56 -0400)]
Don't clobber %esp highbits on C code entry.
Theoretically, %esp high bits could be set - the C code will use %esp
(not %sp), so these bits need to be zeroed. However, they can't
be clobbered, so the entry code needs to save/restore it.
Also improve some comments in romlayout.S
Kevin O'Connor [Mon, 31 Mar 2008 03:32:19 +0000 (23:32 -0400)]
Avoid using volatile on GET/SET_VAR macros.
Instead of using volatile, use a dummy variable definition so the
compiler can track the link between segment updates and accesses.
This gives gcc more flexibility in instruction scheduling.
Also update GET/SET_VAR macros to support signed integer variants.
Kevin O'Connor [Mon, 31 Mar 2008 01:46:53 +0000 (21:46 -0400)]
Minor cleanups.
Rename EBDA_SEG to SEG_EBDA - it is more consistent with other defs.
Introduce SEG_BDA definition and use it instead of 0x0000 wherea appropriate.
Move ACPI_DATA_SIZE to CONFIG_ACPI_DATA_SIZE and move to config.h
Use an alias (PORT_HD_DATA) for io port 0x03f6.
Kevin O'Connor [Sat, 29 Mar 2008 17:15:36 +0000 (13:15 -0400)]
Merge IPL segment into EBDA segment.
It does not appear that IPL info needs to be at exactly 0x9ff00.
Have IPL struct be part of ebda structure - it prevents unintended overlaps.
Also, ATA structs don't need to be packed.
Kevin O'Connor [Sat, 29 Mar 2008 16:53:57 +0000 (12:53 -0400)]
Refactor ata code.
Have await_ide return status code (so callers don't need to reread status).
Introduce pause_await_ide for cases where we need to wait an ata cycle.
Implement 400ns wait according to ata specs.
Consistently used 'driveid' instead of 'biosid', 'devid', 'device'.
Unify cdrom and hd transfer code into single function - ata_transfer.
Use less inlining.
Remove unused ebda variable 'trsfbytes'.
Kevin O'Connor [Sun, 23 Mar 2008 03:13:24 +0000 (23:13 -0400)]
Cleanup cdrom emulation.
Remove 'header' param for ata_cmd_packet - the only code that uses it
is cdrom emulation. So, bury this detail in ata.c.
Introduce new helpers cdrom_read_emu and cdrom_read_512 for working
with emulated cdrom drives.
Unify basic_access() and emu_access() - now basic_access() can read
from cdrom drives.