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.
Kevin O'Connor [Wed, 27 Feb 2008 15:41:41 +0000 (10:41 -0500)]
Some cleanups based on patch by Nguyen Anh Quynh
Add include guards to header files.
Disable stack protector on gcc versions with that option.
Fix lds bug in src/rombios32.lds.S
Don't forward declare "struct bregs;" - it may be confusing gcc on some versions.
Kevin O'Connor [Wed, 27 Feb 2008 02:33:14 +0000 (21:33 -0500)]
Misc updates.
Try to fix up make dependency tracking by including a "null.c" file.
Initialize hard disk tables during post.
Move RTC handlers from system.c to clock.c
Use a macro to init stacks in romlayout.S
Add C-Code stats to buildrom step.