Kevin O'Connor [Fri, 9 May 2008 01:47:33 +0000 (21:47 -0400)]
Support 32bit entry point and an elf wrapped binary.
Kevin O'Connor [Thu, 8 May 2008 01:29:50 +0000 (21:29 -0400)]
Add support for sending debug messages to a serial port.
Enable by turning on CONFIG_DEBUG_SERIAL option.
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 [Tue, 6 May 2008 23:49:01 +0000 (19:49 -0400)]
Minor cleanups.
Several minor comment improvements.
Rearrange some definitions to make them more clear.
Kevin O'Connor [Fri, 25 Apr 2008 00:43:24 +0000 (20:43 -0400)]
Expand floppy_ret to show function names when return code is a failure.
Kevin O'Connor [Sun, 13 Apr 2008 22:17:02 +0000 (18:17 -0400)]
Compile fixes for gcc 4.3.
Clean up some warnings.
Make sure floppy_dbt structure is aliagned to 1 byte boundary.
Kevin O'Connor [Sun, 13 Apr 2008 21:37:41 +0000 (17:37 -0400)]
Move timer setup from post.c to clock.c.
Kevin O'Connor [Sun, 13 Apr 2008 21:31:45 +0000 (17:31 -0400)]
Move serial/lpt setup from post.c to serial.c
Kevin O'Connor [Sun, 13 Apr 2008 21:25:30 +0000 (17:25 -0400)]
Move hard drive init from post.c to ata.c.
Kevin O'Connor [Sun, 13 Apr 2008 21:07:33 +0000 (17:07 -0400)]
Move floppy setup code from post.c to floppy.c.
Kevin O'Connor [Sun, 13 Apr 2008 20:59:49 +0000 (16:59 -0400)]
Fix typo causing fdpt1 from structure from being populated.
Also, remove redundant call to init_boot_vectors().
Kevin O'Connor [Sun, 13 Apr 2008 20:59:03 +0000 (16:59 -0400)]
Add compile options to Makefile to reduce stack space.
Kevin O'Connor [Sun, 13 Apr 2008 20:57:16 +0000 (16:57 -0400)]
Use __always_inline to force inlining.
Before, inline was enough to force inlining.
Kevin O'Connor [Sat, 12 Apr 2008 13:03:34 +0000 (09:03 -0400)]
Fix asm dependencies on segment based writes.
The variable was marked as an input instead of an output.
This could cause gcc bugs - it also forced the asm to be volatile.
Kevin O'Connor [Sat, 12 Apr 2008 13:01:23 +0000 (09:01 -0400)]
Fix bug causing low memory configs to be off by 1024 in e820 maps.
Kevin O'Connor [Sat, 12 Apr 2008 13:00:40 +0000 (09:00 -0400)]
Fix typo - a memcpy should have been memset in rombios32.c
Kevin O'Connor [Sat, 12 Apr 2008 13:00:04 +0000 (09:00 -0400)]
Memset should return 'void *' - just to conform to standards.
Kevin O'Connor [Sun, 6 Apr 2008 01:08:57 +0000 (21:08 -0400)]
Fix bug causing write corruption on large disks.
Writes past 1<<28 sectors were not correct - corruption occurs.
Kevin O'Connor [Sun, 6 Apr 2008 01:07:21 +0000 (21:07 -0400)]
Port fix from bochs-bios for incorrect acpi on boxes < 16M.
Kevin O'Connor [Sat, 5 Apr 2008 23:30:02 +0000 (19:30 -0400)]
Introduce cpu_relax() and use it in busy loops.
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 [Sat, 5 Apr 2008 15:37:51 +0000 (11:37 -0400)]
Make several functions non-inline.
Kevin O'Connor [Sat, 5 Apr 2008 14:47:13 +0000 (10:47 -0400)]
Add s64 type to types.h.
Kevin O'Connor [Wed, 2 Apr 2008 01:09:05 +0000 (21:09 -0400)]
Minor enhancements to README file.
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 03:22:39 +0000 (23:22 -0400)]
Minor cleanup of GET_VAR usage in output.c.
Don't cast to a u8 - instead, cast the pointer to a u8*.
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 [Sun, 30 Mar 2008 15:07:42 +0000 (11:07 -0400)]
Update README file with more information on using the bios.
Kevin O'Connor [Sat, 29 Mar 2008 18:29:35 +0000 (14:29 -0400)]
Unify checksum functions.
Several checksum functions were scattered through source - use just one.
Kevin O'Connor [Sat, 29 Mar 2008 18:28:00 +0000 (14:28 -0400)]
Fix bugs in GET/SET_FARPTR macros.
Kevin O'Connor [Sat, 29 Mar 2008 18:04:34 +0000 (14:04 -0400)]
Cleanup boot order determination.
Determining which device to boot from should not depend on CONFIG_CDROM_BOOT
Instead, always use the cmos 0x38/0x3d for determining boot order.
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 [Sat, 29 Mar 2008 16:45:53 +0000 (12:45 -0400)]
Reorder basic_access() to reduce stack usage.
Kevin O'Connor [Sat, 29 Mar 2008 16:44:32 +0000 (12:44 -0400)]
Minor debugging improvements.
Support '%p' format in bprintf.
Display pointer of register in debug output (useful for calculating
start stack).
Kevin O'Connor [Sun, 23 Mar 2008 04:04:54 +0000 (00:04 -0400)]
Move internal defs from ata.h to ata.c.
With -fwhole-program it is not necessary to put inline functions into
headers. So, move the internal defs and code to ata.c.
Kevin O'Connor [Sun, 23 Mar 2008 03:58:26 +0000 (23:58 -0400)]
Limit cdrom emulation available functions.
The extended read methods must be disabled.
Resynch with original bochs bios list of available functions.
Kevin O'Connor [Sun, 23 Mar 2008 03:57:21 +0000 (23:57 -0400)]
Remove redundant debug statements from disk.c.
Calls to disk_ret with an error code already log - don't log twice.
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, 23 Mar 2008 00:44:37 +0000 (20:44 -0400)]
Use "FARPTR" consistently in macros.
Rename MAKE_32_PTR to MAKE_FARPTR.
Rename PTR_TO_SEG to FARPTR_TO_SEG.
Rename PTR_TO_OFFSET to FARPTR_TO_OFFSET.
Kevin O'Connor [Sun, 23 Mar 2008 00:37:44 +0000 (20:37 -0400)]
Fix disk_1301 handler.
regs->ah was getting clobbered in call to disk_ret().
Kevin O'Connor [Sun, 23 Mar 2008 00:13:08 +0000 (20:13 -0400)]
Breakout cdrom emulation support into CONFIG_CDROM_EMU.
This allows one to support just booting from cdroms that don't require
floppy/harddisk emulation.
Kevin O'Connor [Fri, 21 Mar 2008 17:32:34 +0000 (13:32 -0400)]
Guard header file pci.h
Compilation on Ubuntu fails without this.
Signed-off-by: Nguyen Anh Quynh <aquynh@gmail.com>
Kevin O'Connor [Fri, 21 Mar 2008 17:30:18 +0000 (13:30 -0400)]
Minor change - use set_success() instead of set_cf in pcibios.c.
Using set_success permits easier debug hooks in the future.
Kevin O'Connor [Mon, 17 Mar 2008 01:07:33 +0000 (21:07 -0400)]
Make sure we zero bss before calling rombios32 code.
This fixes reboots.
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 [Sat, 15 Mar 2008 15:07:50 +0000 (11:07 -0400)]
Minor cleanups.
Remove some redundant code from Makefile.
Improve a couple of comments.
Kevin O'Connor [Fri, 14 Mar 2008 01:33:26 +0000 (21:33 -0400)]
Fix bug in apm32protected_entry.
Order of stack was not correct.
New implementation still needs to be tested.
Kevin O'Connor [Thu, 13 Mar 2008 23:57:49 +0000 (19:57 -0400)]
Split up ata_detect() function.
Split the function into several smaller functions.
Kevin O'Connor [Thu, 13 Mar 2008 23:09:49 +0000 (19:09 -0400)]
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.
Kevin O'Connor [Thu, 13 Mar 2008 01:27:02 +0000 (21:27 -0400)]
Move keyboard setup to kbd.c.
Now kbd.c is compiled by both 16bit and 32bit code.
Kevin O'Connor [Thu, 13 Mar 2008 01:19:34 +0000 (21:19 -0400)]
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>
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:49:07 +0000 (20:49 -0400)]
Move irq_enable/disable out of ata.c
Move irq_enable into all callers - only disk.c had irqs disabled anyway.
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 [Wed, 12 Mar 2008 02:14:15 +0000 (22:14 -0400)]
Add FIELD_SIZEOF macro to types.h
Kevin O'Connor [Wed, 12 Mar 2008 01:54:18 +0000 (21:54 -0400)]
Use SET_BDA and GET_BDA to modify and retrieve BDA fields (post.c)
Kevin O'Connor [Wed, 12 Mar 2008 01:24:53 +0000 (21:24 -0400)]
Clear area changed during shadow enable.
Clearing the area makes analyzing memory dumps a little easier.
Kevin O'Connor [Wed, 12 Mar 2008 01:21:47 +0000 (21:21 -0400)]
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.
Kevin O'Connor [Wed, 12 Mar 2008 00:38:33 +0000 (20:38 -0400)]
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.
Kevin O'Connor [Tue, 11 Mar 2008 23:54:55 +0000 (19:54 -0400)]
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>
Kevin O'Connor [Tue, 11 Mar 2008 23:50:44 +0000 (19:50 -0400)]
Ignore out/ directory.
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:40:44 +0000 (19:40 -0400)]
Fix bug in atapi_get_sense.
Buffer size was in wrong argument position.
Clarify code by using sizeof().
Kevin O'Connor [Tue, 11 Mar 2008 23:39:10 +0000 (19:39 -0400)]
Halt machine on call to BX_PANIC.
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:48:04 +0000 (11:48 -0400)]
Unify ata_cmd_data_in/out functions.
The functions are very similar.
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 [Mon, 10 Mar 2008 03:37:04 +0000 (23:37 -0400)]
Call to int 1587 shouldn't alter regs->cx.
The asm was setting regs->cx to zero - use a temp variable to avoid that.
Kevin O'Connor [Sun, 9 Mar 2008 20:11:49 +0000 (16:11 -0400)]
Minor debugging improvements.
Kevin O'Connor [Sun, 9 Mar 2008 20:10:19 +0000 (16:10 -0400)]
Fix bug in int 1587.
Wrap comparison must be done with 16bit values.
Must use 16bit form of lgdt instruction.
Kevin O'Connor [Sun, 9 Mar 2008 17:46:13 +0000 (13:46 -0400)]
Fix booting logic on failure.
Make sure we properly try next device on failures.
Kevin O'Connor [Sun, 9 Mar 2008 17:32:36 +0000 (13:32 -0400)]
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.
Kevin O'Connor [Sun, 9 Mar 2008 17:32:03 +0000 (13:32 -0400)]
Make sure global variables are zerod before exiting bios post.
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 [Sun, 9 Mar 2008 16:18:22 +0000 (12:18 -0400)]
Add build option -fomit-frame-pointer.
It seems to improve code generation.
Kevin O'Connor [Sun, 9 Mar 2008 15:53:22 +0000 (11:53 -0400)]
Fix bug in SET_FARVAR.
The (val) parameter needs to be evaluated before setting the segment.
Kevin O'Connor [Sun, 9 Mar 2008 05:59:58 +0000 (00:59 -0500)]
Optimize insb/outsb/insw/etc. functions.
Use "string ops" to simplify port accesses.
Always run "cld" on entry to C code.
Kevin O'Connor [Sun, 9 Mar 2008 04:25:16 +0000 (23:25 -0500)]
Minor cleanups.
Improve some debugging messages.
Minor code clean ups.
Improve apmbios entry points (still untested).
Kevin O'Connor [Sun, 9 Mar 2008 04:20:41 +0000 (23:20 -0500)]
Fix bug in ata.c
Code wasn't incrementing offset properly.
Also clean up code a little and add some debugging info.
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 [Sat, 8 Mar 2008 20:40:43 +0000 (15:40 -0500)]
Minor hack - allow formats with 'l' to be shown in printf.
Kevin O'Connor [Sat, 8 Mar 2008 18:17:49 +0000 (13:17 -0500)]
Revert "Commit missing files from last commit."
This reverts commit
a75284dbd70acc7ec4a832045c8a2fbec2d773d8.
Kevin O'Connor [Sat, 8 Mar 2008 18:17:16 +0000 (13:17 -0500)]
Revert "This patch adds the BIOS support for SMP, ACPI, PCI, SMM, SMBIOS."
This reverts commit
3d029417164e9a6dffee491fb061de3de6d85595.
Conflicts:
src/post.c
Kevin O'Connor [Sat, 8 Mar 2008 18:04:10 +0000 (13:04 -0500)]
Make sure to restore %ds on return from call16.
Kevin O'Connor [Sat, 8 Mar 2008 17:42:36 +0000 (12:42 -0500)]
Minor cleanup - move init of bda->equipment_list_flags
The init of equipment_list_flags was in kbd_setup() - but it is unrelated.
Kevin O'Connor [Sat, 8 Mar 2008 17:28:49 +0000 (12:28 -0500)]
Fix keyboard init bug.
kbd_flush() wasn't implemented properly.
Don't panic on first kbd_flush call.
Kevin O'Connor [Sat, 8 Mar 2008 16:34:46 +0000 (11:34 -0500)]
Enhance APM support.
Create and register protected mode interfaces.
Still needs more testing.
Kevin O'Connor [Sat, 8 Mar 2008 16:34:28 +0000 (11:34 -0500)]
Clean up disk debugging messages.
Kevin O'Connor [Sat, 8 Mar 2008 15:27:39 +0000 (10:27 -0500)]
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>
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 [Thu, 6 Mar 2008 02:09:59 +0000 (21:09 -0500)]
Rename VISIBLE macro for better control.
VISIBLE16 is used to mark functions externally available in 16bit code.
VISIBLE32 is for 32bit functions.
Kevin O'Connor [Thu, 6 Mar 2008 01:56:23 +0000 (20:56 -0500)]
Commit missing files from last commit.
Kevin O'Connor [Thu, 6 Mar 2008 01:43:38 +0000 (20:43 -0500)]
This patch adds the BIOS support for SMP, ACPI, PCI, SMM, SMBIOS.
Signed-off-by: Nguyen Anh Quynh
Several compile fixes provided by Kevin O'Connor
Kevin O'Connor [Thu, 6 Mar 2008 00:52:06 +0000 (19:52 -0500)]
Add initial support for apmbios code.
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 [Wed, 5 Mar 2008 03:27:55 +0000 (22:27 -0500)]
Ignore precision specifiers in printf code.
This at least allows the variable to be printed.
Kevin O'Connor [Wed, 5 Mar 2008 00:56:41 +0000 (19:56 -0500)]
Move cdrom code to its own file (cdrom.c).