Commit Graph

2696 Commits

Author SHA1 Message Date
Kevin O'Connor 7913f9df87 Minor change - use set_success() instead of set_cf in pcibios.c.
Using set_success permits easier debug hooks in the future.
2008-03-21 13:30:18 -04:00
Kevin O'Connor 7958de3303 Make sure we zero bss before calling rombios32 code.
This fixes reboots.
2008-03-16 21:07:33 -04:00
Kevin O'Connor a0dc29629c 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.
2008-03-16 14:29:32 -04:00
Kevin O'Connor c38e480c83 Minor cleanups.
Remove some redundant code from Makefile.
Improve a couple of comments.
2008-03-15 11:07:50 -04:00
Kevin O'Connor 68296e8ec0 Fix bug in apm32protected_entry.
Order of stack was not correct.
New implementation still needs to be tested.
2008-03-13 21:33:26 -04:00
Kevin O'Connor aafa6575e0 Split up ata_detect() function.
Split the function into several smaller functions.
2008-03-13 19:57:49 -04:00
Kevin O'Connor 049d5a237d Use LBA disk access methods always; don't use CHS methods.
Using CHS is dependent on the drive type, not the request type.  So,
old code was not correct.  It is simpler to just always use LBA.
2008-03-13 19:09:49 -04:00
Kevin O'Connor 2018eff2cf Move keyboard setup to kbd.c.
Now kbd.c is compiled by both 16bit and 32bit code.
2008-03-12 21:27:02 -04:00
Kevin O'Connor e51313d90c Update interger types in rombios32 code.
- Make rombios32.c to use the interger types already defined in types.h
- Add u64 typedef

Signed-off-by: Nguyen Anh Quynh <aquynh@gmail.com>
2008-03-12 21:19:34 -04:00
Kevin O'Connor 63ccc13b70 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).
2008-03-12 20:57:08 -04:00
Kevin O'Connor 74799df6e9 Move irq_enable/disable out of ata.c
Move irq_enable into all callers - only disk.c had irqs disabled anyway.
2008-03-12 20:49:07 -04:00
Kevin O'Connor efde609a28 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.
2008-03-12 20:33:15 -04:00
Kevin O'Connor 28fe1bd0f0 Add FIELD_SIZEOF macro to types.h 2008-03-11 22:14:15 -04:00
Kevin O'Connor e9061496d9 Use SET_BDA and GET_BDA to modify and retrieve BDA fields (post.c) 2008-03-11 21:54:18 -04:00
Kevin O'Connor ceb5f3f868 Clear area changed during shadow enable.
Clearing the area makes analyzing memory dumps a little easier.
2008-03-11 21:24:53 -04:00
Kevin O'Connor 1d01951aae Don't pass in ebp/esp to irq handlers.
The C code won't clobber these registers, so backing them up isn't needed.
Removing them saves a few bytes on the stack.
2008-03-11 21:21:47 -04:00
Kevin O'Connor 7a558e4417 Don't save/restore flags and ebp on external calls - saves on stack space.
It isn't necessary to save ebp - just mark it as clobbered.
The only important flag to save/restore is irqs - manually fixup all callers.
2008-03-11 20:38:33 -04:00
Kevin O'Connor 64c718d27a use PACKED for bregs declaration
This patch makes bregs structure declared with PACKED macro (biosvar.h)

Signed-off-by: Nguyen Anh Quynh <aquynh@gmail.com>
2008-03-11 19:54:55 -04:00
Kevin O'Connor 86bbda0cb0 Ignore out/ directory. 2008-03-11 19:50:44 -04:00
Kevin O'Connor 1fcf144856 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.
2008-03-11 19:42:41 -04:00
Kevin O'Connor a69bc3a94f Fix bug in atapi_get_sense.
Buffer size was in wrong argument position.
Clarify code by using sizeof().
2008-03-11 19:40:44 -04:00
Kevin O'Connor 83b56406ed Halt machine on call to BX_PANIC. 2008-03-11 19:39:10 -04:00
Kevin O'Connor bc28a2bc4c 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.
2008-03-11 19:32:38 -04:00
Kevin O'Connor 3a04963abc Unify ata_cmd_data_in/out functions.
The functions are very similar.
2008-03-11 11:48:04 -04:00
Kevin O'Connor ed12849c9b 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.
2008-03-11 11:14:59 -04:00
Kevin O'Connor 2cdd8b6fb1 Call to int 1587 shouldn't alter regs->cx.
The asm was setting regs->cx to zero - use a temp variable to avoid that.
2008-03-09 23:37:04 -04:00
Kevin O'Connor f205f9fdb6 Minor debugging improvements. 2008-03-09 16:11:49 -04:00
Kevin O'Connor 67c00dde03 Fix bug in int 1587.
Wrap comparison must be done with 16bit values.
Must use 16bit form of lgdt instruction.
2008-03-09 16:10:19 -04:00
Kevin O'Connor 7af49bf77e Fix booting logic on failure.
Make sure we properly try next device on failures.
2008-03-09 13:46:13 -04:00
Kevin O'Connor a20c4a59be Fix bug in cdrom reads causing incorrect return status.
Unify the return code in ata.trsfsectors (don't use trsfbytes).
Also includes minor code clean ups.
2008-03-09 13:32:36 -04:00
Kevin O'Connor 157e213218 Make sure global variables are zerod before exiting bios post. 2008-03-09 13:32:03 -04:00
Kevin O'Connor 983d619ef3 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.
2008-03-09 12:23:42 -04:00
Kevin O'Connor 6c78122091 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.
2008-03-09 12:19:23 -04:00
Kevin O'Connor 5a869f02df Add build option -fomit-frame-pointer.
It seems to improve code generation.
2008-03-09 12:18:22 -04:00
Kevin O'Connor 16375ab5fb Fix bug in SET_FARVAR.
The (val) parameter needs to be evaluated before setting the segment.
2008-03-09 11:53:22 -04:00
Kevin O'Connor 843a62c3e5 Optimize insb/outsb/insw/etc. functions.
Use "string ops" to simplify port accesses.
Always run "cld" on entry to C code.
2008-03-09 00:59:58 -05:00
Kevin O'Connor dcc7a4f3e7 Minor cleanups.
Improve some debugging messages.
Minor code clean ups.
Improve apmbios entry points (still untested).
2008-03-08 23:25:16 -05:00
Kevin O'Connor 5b15fbf48c Fix bug in ata.c
Code wasn't incrementing offset properly.
Also clean up code a little and add some debugging info.
2008-03-08 23:20:41 -05:00
Kevin O'Connor a4d357638c 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.
2008-03-08 15:43:03 -05:00
Kevin O'Connor a9096f405a Minor hack - allow formats with 'l' to be shown in printf. 2008-03-08 15:40:43 -05:00
Kevin O'Connor ef5789eca9 Revert "Commit missing files from last commit."
This reverts commit a75284dbd7.
2008-03-08 13:17:49 -05:00
Kevin O'Connor 47baa3c82c Revert "This patch adds the BIOS support for SMP, ACPI, PCI, SMM, SMBIOS."
This reverts commit 3d02941716.

Conflicts:

	src/post.c
2008-03-08 13:17:16 -05:00
Kevin O'Connor cbbb6679c2 Make sure to restore %ds on return from call16. 2008-03-08 13:04:10 -05:00
Kevin O'Connor 9bd83915fc Minor cleanup - move init of bda->equipment_list_flags
The init of equipment_list_flags was in kbd_setup() - but it is unrelated.
2008-03-08 12:42:36 -05:00
Kevin O'Connor c77ee3ad21 Fix keyboard init bug.
kbd_flush() wasn't implemented properly.
Don't panic on first kbd_flush call.
2008-03-08 12:28:49 -05:00
Kevin O'Connor 44d653018b Enhance APM support.
Create and register protected mode interfaces.
Still needs more testing.
2008-03-08 11:34:46 -05:00
Kevin O'Connor 127cbd7f06 Clean up disk debugging messages. 2008-03-08 11:34:28 -05:00
Kevin O'Connor e2e5f01356 use symbols for E820 memory types
This patch uses symbols for E820 memory types (system.c)

Signed-off-by: Nguyen Anh Quynh <aquynh@gmail.com>
2008-03-08 10:27:39 -05:00
Kevin O'Connor e09b982176 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>
2008-03-06 19:16:37 -05:00
Kevin O'Connor 19786767cf Rename VISIBLE macro for better control.
VISIBLE16 is used to mark functions externally available in 16bit code.
VISIBLE32 is for 32bit functions.
2008-03-05 21:09:59 -05:00