Commit Graph

2696 Commits

Author SHA1 Message Date
Kevin O'Connor 1cd74716b1 Fix typo in clock.c outb_cmos call.
Register and value were reversed.
2008-05-13 22:29:42 -04:00
Kevin O'Connor ee55c76701 Reduce ide stack usage by reorganizing ata calls.
Break up some functions and play with inlining to reduce stack usage.
2008-05-13 00:18:20 -04:00
Kevin O'Connor 5c4a8c6554 Add tool to check stack usage of 16bit code.
This tool analyzes the assembler and can approximate the stack usage
    of the various entry points.
2008-05-12 23:50:16 -04:00
Kevin O'Connor a2d1692763 Add compile options to reduce stack usage.
Add -fno-defer-pop
Add --param large-stack-frame=8 to prevent stack explosion on gcc 4.3.
2008-05-12 23:44:57 -04:00
Kevin O'Connor 7453453944 Use a linker script for 16bit code.
With a linker script the data sections can be grouped by themselves
   instead of being dispersed throughout the code.
2008-05-12 18:28:58 -04:00
Kevin O'Connor 59fead6413 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.
2008-05-10 15:49:20 -04:00
Kevin O'Connor 4b39b82790 Support 32bit entry point and an elf wrapped binary. 2008-05-08 21:47:33 -04:00
Kevin O'Connor 1812e20b4b Add support for sending debug messages to a serial port.
Enable by turning on CONFIG_DEBUG_SERIAL option.
2008-05-07 21:29:50 -04:00
Kevin O'Connor d9b0659a82 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>
2008-05-06 20:00:12 -04:00
Kevin O'Connor 2ad37441d3 Minor cleanups.
Several minor comment improvements.
Rearrange some definitions to make them more clear.
2008-05-06 19:49:01 -04:00
Kevin O'Connor 0b6972591b Expand floppy_ret to show function names when return code is a failure. 2008-04-24 20:43:24 -04:00
Kevin O'Connor 117fc21837 Compile fixes for gcc 4.3.
Clean up some warnings.
Make sure floppy_dbt structure is aliagned to 1 byte boundary.
2008-04-13 18:17:02 -04:00
Kevin O'Connor e6eb3f5022 Move timer setup from post.c to clock.c. 2008-04-13 17:37:41 -04:00
Kevin O'Connor 913cc2e089 Move serial/lpt setup from post.c to serial.c 2008-04-13 17:31:45 -04:00
Kevin O'Connor 9f0d94dee3 Move hard drive init from post.c to ata.c. 2008-04-13 17:25:30 -04:00
Kevin O'Connor 3bbcc14d94 Move floppy setup code from post.c to floppy.c. 2008-04-13 17:07:33 -04:00
Kevin O'Connor 109432efbb Fix typo causing fdpt1 from structure from being populated.
Also, remove redundant call to init_boot_vectors().
2008-04-13 16:59:49 -04:00
Kevin O'Connor ba2d0df1db Add compile options to Makefile to reduce stack space. 2008-04-13 16:59:03 -04:00
Kevin O'Connor 74f9c0879b Use __always_inline to force inlining.
Before, inline was enough to force inlining.
2008-04-13 16:57:16 -04:00
Kevin O'Connor 0257b4a572 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.
2008-04-12 09:03:34 -04:00
Kevin O'Connor 800eab5f24 Fix bug causing low memory configs to be off by 1024 in e820 maps. 2008-04-12 09:01:23 -04:00
Kevin O'Connor 52c1a8aa4c Fix typo - a memcpy should have been memset in rombios32.c 2008-04-12 09:00:40 -04:00
Kevin O'Connor 5e4235f2c0 Memset should return 'void *' - just to conform to standards. 2008-04-12 09:00:04 -04:00
Kevin O'Connor dfabfe00d9 Fix bug causing write corruption on large disks.
Writes past 1<<28 sectors were not correct - corruption occurs.
2008-04-05 21:08:57 -04:00
Kevin O'Connor 98123b53ef Port fix from bochs-bios for incorrect acpi on boxes < 16M. 2008-04-05 21:07:21 -04:00
Kevin O'Connor 06ad44ee1e Introduce cpu_relax() and use it in busy loops. 2008-04-05 19:30:02 -04:00
Kevin O'Connor e0113c99c0 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.
2008-04-05 15:51:12 -04:00
Kevin O'Connor 567e4e3d34 Make several functions non-inline. 2008-04-05 11:37:51 -04:00
Kevin O'Connor 595fb46812 Add s64 type to types.h. 2008-04-05 10:47:13 -04:00
Kevin O'Connor 0bb2a44ea4 Minor enhancements to README file. 2008-04-01 21:09:05 -04:00
Kevin O'Connor 18f368edc5 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
2008-03-31 21:56:04 -04:00
Kevin O'Connor 67c2cf387f 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.
2008-03-30 23:32:19 -04:00
Kevin O'Connor 41d2810e0e Minor cleanup of GET_VAR usage in output.c.
Don't cast to a u8 - instead, cast the pointer to a u8*.
2008-03-30 23:22:39 -04:00
Kevin O'Connor 438f63515c 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.
2008-03-30 21:46:53 -04:00
Kevin O'Connor 838f08fcb9 Update README file with more information on using the bios. 2008-03-30 11:07:42 -04:00
Kevin O'Connor 2e7ab8b3e7 Unify checksum functions.
Several checksum functions were scattered through source - use just one.
2008-03-29 14:29:35 -04:00
Kevin O'Connor 46df61c21d Fix bugs in GET/SET_FARPTR macros. 2008-03-29 14:28:00 -04:00
Kevin O'Connor 840c5349f5 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.
2008-03-29 14:04:34 -04:00
Kevin O'Connor 56a506d9d6 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.
2008-03-29 13:15:36 -04:00
Kevin O'Connor a6b9f715d9 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'.
2008-03-29 12:53:57 -04:00
Kevin O'Connor 0cdac0e620 Reorder basic_access() to reduce stack usage. 2008-03-29 12:45:53 -04:00
Kevin O'Connor f06f03a872 Minor debugging improvements.
Support '%p' format in bprintf.
Display pointer of register in debug output (useful for calculating
    start stack).
2008-03-29 12:44:32 -04:00
Kevin O'Connor f888f8c55c 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.
2008-03-23 00:04:54 -04:00
Kevin O'Connor aa7ddd79b0 Limit cdrom emulation available functions.
The extended read methods must be disabled.
Resynch with original bochs bios list of available functions.
2008-03-22 23:58:26 -04:00
Kevin O'Connor f04d5c7905 Remove redundant debug statements from disk.c.
Calls to disk_ret with an error code already log - don't log twice.
2008-03-22 23:57:21 -04:00
Kevin O'Connor aa2590c558 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.
2008-03-22 23:13:24 -04:00
Kevin O'Connor 070231b908 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.
2008-03-22 20:44:37 -04:00
Kevin O'Connor fad2da831d Fix disk_1301 handler.
regs->ah was getting clobbered in call to disk_ret().
2008-03-22 20:37:44 -04:00
Kevin O'Connor dfa165052c Breakout cdrom emulation support into CONFIG_CDROM_EMU.
This allows one to support just booting from cdroms that don't require
floppy/harddisk emulation.
2008-03-22 20:13:08 -04:00
Kevin O'Connor faa8b6f1bb Guard header file pci.h
Compilation on Ubuntu fails without this.

Signed-off-by: Nguyen Anh Quynh <aquynh@gmail.com>
2008-03-21 13:32:34 -04:00