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.
Kevin O'Connor [Sun, 16 Mar 2008 18:29:32 +0000 (14:29 -0400)]
Basic support for PCI BIOS.
This patch adds real-mode pci bios callbacks.
It also adds support for a hardcoded $PIR table.
The pci config functions are moved from rombios32.c to pci.c.
Note that protected mode pci-bios calls were not added.
Kevin O'Connor [Thu, 13 Mar 2008 00:57:08 +0000 (20:57 -0400)]
Move ata_detect call to 32bit code.
It's more natural to call the detect code from post. It does require
some of the ATA support code be compiled in twice (once in 32bit mode
and once in 16 bit), however that only leads to a small increase in
total C code (~250 bytes).
Kevin O'Connor [Thu, 13 Mar 2008 00:33:15 +0000 (20:33 -0400)]
Use 32bit absolute pointers for buffers in ATA code.
Using 32bit pointers makes the code a little simpler. It also allows
the code to be used from 32 bit mode. It does require all callers to
encode the segment/offset into an absolute address. The ins/outs
functions also need to know how to convert from 32bit back to
segment/offset addresses.
The change also includes a minor cleanup of the macros in farptr.h.
Kevin O'Connor [Tue, 11 Mar 2008 23:42:41 +0000 (19:42 -0400)]
Reorganize ata code; reduce stack usage.
This fixes an issue with freedos lbacache - the bios was overrunning
the stack on disk requests.
The code has been simplified by extracting common code.
Some handlers moved to inline code to reduce overall stack usage.
Kevin O'Connor [Tue, 11 Mar 2008 23:32:38 +0000 (19:32 -0400)]
Force functions marked as inline to always be inlined.
Inline alters stack usage, so don't let gcc uninline.
Also, gcc seems to include multiple copies of uninlined functions when
using -combine.
With inlining forced on, the no null check optimization causes
problems, so disable it.
Kevin O'Connor [Tue, 11 Mar 2008 15:14:59 +0000 (11:14 -0400)]
Reduce stack usage for ISRs; minor fixes.
Don't back up all registers on isr handlers - they don't read/modify
them. This saves stack space.
extended_bios_data_area_s must be packed to match ebda spec.
Enable irqs on int 08 - follows old bochs bios code.
Fix bug in int 76 -- should clear disk_interrupt_flag not
floppy_harddisk_info.
Make sure we alert in disk_ret on failure case.
int 18/19 entry points need to setup cld/%ds too.
asm in handle_1587 clobbers flags - note that in clobber list.
Kevin O'Connor [Sun, 9 Mar 2008 16:23:42 +0000 (12:23 -0400)]
Simplify e820 map generation.
Clean up by moving code from handle_15e820 to set_e820_range.
Set ES explicilty prior to populating the map - the code was relying
on nothing changing it.
Kevin O'Connor [Sun, 9 Mar 2008 16:19:23 +0000 (12:19 -0400)]
Replace debug_exit calls with debug info while setting a failure.
Calling debug_exit at the end of a call doesn't help much - several of
the registers are already clobbered at this point. It also increases
stack usage because it prevents call tail optimization in many places.
Kevin O'Connor [Sat, 8 Mar 2008 20:43:03 +0000 (15:43 -0500)]
Port rombios32 code from bochs-bios.
This adds acpi, smbios, pci init, etc.
Changes from original rombios32.c code:
* Header file translation.
* Use common functions already in code (eg, outb, memset, bios_printf,
usleep)
* Implement trampoline for disabling bios shadowing (rombios32 code
actually runs in the 0xf0000 area).
* Copy asm code from rombios32start.S to an asm() statement in C
code.
Kevin O'Connor [Fri, 7 Mar 2008 00:16:37 +0000 (19:16 -0500)]
Use symbols for cmos offsets in ram_probe()
This patches uses symbols for cmos offsets when calculating ram size
in ram_probe()
Besides, it adds some cmos offset symbols into cmos.h, and changes
some memory cmos offset to be more meaningful.
Signed-off-by: Nguyen Anh Quynh <aquynh@gmail.com>
Kevin O'Connor [Wed, 5 Mar 2008 03:50:53 +0000 (22:50 -0500)]
Get CDROM emulation working.
Fix bug causing ata_cmd_packet to insl to wrong address.
Add new cdrom_read helper.
Join ata.hdidmap/cdidmap into one array variable.
Rename CONFIG_ELTORITO_BOOT to CONFIG_CDROM_BOOT.
Add cd emulation code.
Kevin O'Connor [Sun, 2 Mar 2008 18:58:23 +0000 (13:58 -0500)]
Bug fixes; get mouse working.
Fix bug in post causing PIC2 to not be initialized properly.
Only run ata_detect if CONFIG_ATA enabled.
Improve debugging aids - introduce debug_isr(); move DEBUGF to each file.
Enable mouse by default.
Fix bug in floppy causing extra test of PORT_FD_STATUS on recalibrate.
Always disable/enable kbd in handle_09 event.
Kevin O'Connor [Sun, 2 Mar 2008 16:24:36 +0000 (11:24 -0500)]
Enhance included bios tables.
Moved floppy parameter table to its 0xefc7 location.
Define floppy base table as a struct.
Cleaned up definitions in romlayout.S
Fixed bug in handle_15c0 - wasn't clearing cf.
Clean up some post.c usages of bios tables.