seabios.git
15 years agoUpdates to TODO items.
Kevin O'Connor [Sat, 28 Jun 2008 16:19:52 +0000 (12:19 -0400)]
Updates to TODO items.

15 years agoSet BIOS checksum at 0xfffff.
Kevin O'Connor [Sat, 28 Jun 2008 16:18:39 +0000 (12:18 -0400)]
Set BIOS checksum at 0xfffff.

15 years agoImprove some debugging output.
Kevin O'Connor [Sat, 28 Jun 2008 16:15:57 +0000 (12:15 -0400)]
Improve some debugging output.

Replace DEBUGF calls with dprintf calls.
Make ata calls consistently use 'int' return codes.
Make each error return code in ata.c use a unique negative number.

15 years agoScan for and relocate mptable when using coreboot.
Kevin O'Connor [Sat, 21 Jun 2008 23:46:43 +0000 (19:46 -0400)]
Scan for and relocate mptable when using coreboot.

15 years agoConvert '\n' to '\r\n' on debug serial output.
Kevin O'Connor [Sat, 21 Jun 2008 16:59:19 +0000 (12:59 -0400)]
Convert '\n' to '\r\n' on debug serial output.

15 years agoAdd code (currently disabled) to mask run away irqs.
Kevin O'Connor [Sat, 21 Jun 2008 16:24:14 +0000 (12:24 -0400)]
Add code (currently disabled) to mask run away irqs.

Add handler that can react to any unknown hardware irq by masking that
    irq.  This can be useful for finding/fixing run away irq issues.
    Don't currently register these hardware irq handlers
Also, sort and improve default debug levels for bios handlers.

15 years agoInit serial port before using it for debug - also reinit after option rom.
Kevin O'Connor [Sat, 21 Jun 2008 16:15:10 +0000 (12:15 -0400)]
Init serial port before using it for debug - also reinit after option rom.

Apparently, some VGA option roms will enable serial irqs - this could
    cause problems with spurious irqs from debug messages.
Also, improve debugging of option roms that fail the checksum check.

15 years agoPCI fixes
Kevin O'Connor [Sat, 21 Jun 2008 15:55:29 +0000 (11:55 -0400)]
PCI fixes

Only set the PIR table signature and checksum in the init function -
    that way, if it is disabled at runtime (eg, due to coreboot) then
    it wont be found by the OS.
Fix parameter swap bug in handle_1ab102.
Add support for more than one bus in pci scanning code (but only have
    1 bus for now).

15 years agoMake 0xa0000 - 0x10000 a "gap" in the e820 map.
Kevin O'Connor [Sat, 21 Jun 2008 15:43:32 +0000 (11:43 -0400)]
Make 0xa0000 - 0x10000 a "gap" in the e820 map.

Declaring memory between 0xa0000 - 0x10000 confuses windows, so don't
    do that.
Add capability to remove mappings in the memory mapping code.

15 years agoMinor enhancement to disk failure reporting.
Kevin O'Connor [Sat, 21 Jun 2008 15:38:21 +0000 (11:38 -0400)]
Minor enhancement to disk failure reporting.

The ata functions return an int not a u8.

15 years agoFixup bios.bin.elf building on other versions of ld.
Kevin O'Connor [Fri, 20 Jun 2008 04:14:19 +0000 (00:14 -0400)]
Fixup bios.bin.elf building on other versions of ld.

Should use -Tdata instead of -Ttext.

15 years agoAdd header guard around pic.h
Kevin O'Connor [Wed, 18 Jun 2008 11:45:38 +0000 (07:45 -0400)]
Add header guard around pic.h

This fixes compiling with AVOIDCOMBINE=1

15 years agoCleanup handling of interrupt controller (PIC).
Kevin O'Connor [Sat, 14 Jun 2008 19:56:16 +0000 (15:56 -0400)]
Cleanup handling of interrupt controller (PIC).

Add new file (pic.h) with helpers for accessing the PIC.
Move irq enabling code to the files that use those interrupts.
Also, don't setup for floppy if floppy support not enabled.

15 years agoSupport config driven debugging of each irq handler.
Kevin O'Connor [Fri, 13 Jun 2008 02:59:43 +0000 (22:59 -0400)]
Support config driven debugging of each irq handler.

This allows one to easily enable verbose output from handlers.

15 years agoWait for RDY bit when resetting ata hard drives.
Kevin O'Connor [Fri, 13 Jun 2008 02:29:30 +0000 (22:29 -0400)]
Wait for RDY bit when resetting ata hard drives.

If the reset doesn't wait for RDY, apparently irqs can get generated
    later in the boot which can confuse the OS.

15 years agoSupport relocating coreboot generated acpi rsdp and pir tables.
Kevin O'Connor [Fri, 13 Jun 2008 02:22:43 +0000 (22:22 -0400)]
Support relocating coreboot generated acpi rsdp and pir tables.

The coreboot code will now scan the areas marked by CB_MEM_TABLE for
    PIR and RSDP tables.  If found, they'll be moved to the 0xf0000
    segment.
Also, the find_cb_memory() function has been made generic.

15 years agoGenerate PIR table at post time.
Kevin O'Connor [Fri, 13 Jun 2008 02:16:35 +0000 (22:16 -0400)]
Generate PIR table at post time.

Move the predefined PIR table (only useful on emulators) to its own
    file - pirtable.c.
Have the pcibios code inspect the pre-built PIR table on 1ab10e
    calls.

15 years agoAdd config option CONFIG_ACPI for turning off ACPI table generation.
Kevin O'Connor [Fri, 13 Jun 2008 02:12:48 +0000 (22:12 -0400)]
Add config option CONFIG_ACPI for turning off ACPI table generation.

15 years agoMove acpi code out of rombios32.c; clean up use of fixed memory addresses.
Kevin O'Connor [Thu, 12 Jun 2008 02:47:01 +0000 (22:47 -0400)]
Move acpi code out of rombios32.c; clean up use of fixed memory addresses.

Move acpi code from rombios32.c to acpi.c.
Move all fixed memory addresses used by the code to config.h and
    consistently use a "BUILD_" prefix on the definitions.
Move some pci defs to pci.h - allows access from acpi.c and rombios32.c.
Introduce ALIGN() macro - remove old align function.

15 years agoMove PIR table definitions to pcibios.h.
Kevin O'Connor [Thu, 12 Jun 2008 02:39:46 +0000 (22:39 -0400)]
Move PIR table definitions to pcibios.h.

Also add a copyright to pci.c.

15 years agoSupport auto-merging e820 maps of same type.
Kevin O'Connor [Thu, 12 Jun 2008 01:23:24 +0000 (21:23 -0400)]
Support auto-merging e820 maps of same type.

Two bordering e820 maps with the same memory type should merge into
    one mapping of the type.

15 years agoEnhance e820 memory map generation - include files missing from last commit.
Kevin O'Connor [Mon, 9 Jun 2008 03:09:42 +0000 (23:09 -0400)]
Enhance e820 memory map generation - include files missing from last commit.

15 years agoEnhance e820 memory map generation.
Kevin O'Connor [Mon, 9 Jun 2008 03:08:12 +0000 (23:08 -0400)]
Enhance e820 memory map generation.

Build e820 maps at post time; just copy the pre-built ones at runtime.
Add support for populating memory and map info from coreboot.

15 years agoMove debugging messages to appropriate functions.
Kevin O'Connor [Sun, 8 Jun 2008 23:18:33 +0000 (19:18 -0400)]
Move debugging messages to appropriate functions.

Move dprintf calls from post() to the function calls that perform the work.

15 years agoSeparate out ram shadow code and permit more code to write to bios.
Kevin O'Connor [Sun, 8 Jun 2008 17:48:06 +0000 (13:48 -0400)]
Separate out ram shadow code and permit more code to write to bios.

Extract shadow code from rombios32.c to its own file - shadow.c.
Reorg post.c so that shadow enable happens early and ram lock happens
    late in boot process.
Also, improve some comments in post.c and reorg code slightly.

15 years agoProperly save/restore %esp high bits.
Kevin O'Connor [Sun, 8 Jun 2008 17:34:43 +0000 (13:34 -0400)]
Properly save/restore %esp high bits.

It turns out that some OSs do call into the bios with junk in the %esp
    high bits.  So, make sure it is properly cleared and then
    saved/restored.
Have the 32bit apm entry point use its own %esp safe entry macro.

15 years agoMisc minor updates.
Kevin O'Connor [Sat, 7 Jun 2008 19:24:19 +0000 (15:24 -0400)]
Misc minor updates.

15 years agoDo proper delays when switching devices.
Kevin O'Connor [Sat, 7 Jun 2008 19:23:11 +0000 (15:23 -0400)]
Do proper delays when switching devices.

Make sure to msleep(50) when switching the drive.
Also, add some debug messages.

15 years agoAPM fixes; don't save/clear/restore %esp high bits.
Kevin O'Connor [Sat, 7 Jun 2008 18:51:14 +0000 (14:51 -0400)]
APM fixes; don't save/clear/restore %esp high bits.

Don't worry about %esp high bits - 16bit protected mode may require
    the bits to be set.  It would be very odd to call into the bios
    with junk in %esp high bits.
Fix 32bit apm entry point.
Don't log apm calls 155306/15530b.

15 years agoIntroduce set_fail_silent() helpers.
Kevin O'Connor [Sat, 7 Jun 2008 18:41:21 +0000 (14:41 -0400)]
Introduce set_fail_silent() helpers.

These functions are equivalent to set_fail() - but don't log an error.

15 years agoSerial debugging code must not access BDA.
Kevin O'Connor [Sat, 7 Jun 2008 14:43:07 +0000 (10:43 -0400)]
Serial debugging code must not access BDA.

Regular serial writing code uses the system timer to timeout failed
    writes - however, serial debugging can't rely on access to the BDA
    segment or the hardware timer.
Therefore, implement a simple debug only serial writing function and
    separate it from the regular serial output code.
Also include change to dump_regs - don't call __dprintf if debugging
    not on.

15 years agoVerify that option roms don't try to move the ebda block.
Kevin O'Connor [Sat, 7 Jun 2008 14:24:48 +0000 (10:24 -0400)]
Verify that option roms don't try to move the ebda block.

15 years agoUpdate PCI devid of PIR table.
Kevin O'Connor [Sat, 7 Jun 2008 14:23:25 +0000 (10:23 -0400)]
Update PCI devid of PIR table.

This devid change synchs code with bochs cvs.
Also fix minor bug causing bus to not be returned in pcibios calls.

15 years agoImprovements to checkstack.py tool.
Kevin O'Connor [Sat, 7 Jun 2008 14:11:36 +0000 (10:11 -0400)]
Improvements to checkstack.py tool.

Ignore BX_PANIC calls - they shouldn't happen in practice.
Ignore "addr32" prefix when looking at instructions.
Add check for "lcallw" insn.
Don't display redundant calls to the same function (with same stack usage).

15 years agoSupport config option to disable APM BIOS calls.
Kevin O'Connor [Mon, 26 May 2008 19:19:33 +0000 (15:19 -0400)]
Support config option to disable APM BIOS calls.

New option CONFIG_APMBIOS can be used to disable apm.

15 years agoFix bug causing ata_reset to not wait for BSY to clear.
Kevin O'Connor [Mon, 26 May 2008 19:06:40 +0000 (15:06 -0400)]
Fix bug causing ata_reset to not wait for BSY to clear.

ata_reset is always called on a valid drive - it shouldn't need to recheck.
All callers expect BSY to be clear upon completion.
This fixes an issue where ata_detect was reading status before drive ready.

15 years agoImprove control of debug messages.
Kevin O'Connor [Sun, 25 May 2008 03:46:33 +0000 (23:46 -0400)]
Improve control of debug messages.

Rename BX_INFO() to dprintf() and add a "severity level" parameter.
Add CONFIG_DEBUG_LEVEL compile option to control debug verbosity.
Add more debug info to init steps of post.c.

15 years agoPCI enhancements.
Kevin O'Connor [Sun, 25 May 2008 03:07:16 +0000 (23:07 -0400)]
PCI enhancements.

Allow one to enable/disable PIR tables separately from PCI BIOS support.
Use standard PORT_* defs for 0xcf8/0xcfc port accesses.
Don't pass PCIDevice pointers around - the struct is small enough to
    pass in a register.
Extract out pci_find_device and pci_find_class functions from PCI BIOS
    code.
Remove PCI_FIXED_HOST_BRIDGE check - the check is too late if standard
    PCI support isn't available.  If standard support is available,
    then the code should be okay to run.

15 years agoMinor cleanup - use usecs instead of msecs.
Kevin O'Connor [Sun, 25 May 2008 03:04:09 +0000 (23:04 -0400)]
Minor cleanup - use usecs instead of msecs.

set_usertimer() takes microseconds, not milliseconds.

16 years agoImplement usleep using real time clock.
Kevin O'Connor [Sun, 18 May 2008 21:12:06 +0000 (17:12 -0400)]
Implement usleep using real time clock.

The old usleep implementation relied on ps2 port refresh bit which is
    not very portable.
This patch also refactors some of the code in clock.c.

16 years agoDon't initialize keyboard hardware on coreboot - coreboot already does it.
Kevin O'Connor [Sun, 18 May 2008 21:10:41 +0000 (17:10 -0400)]
Don't initialize keyboard hardware on coreboot - coreboot already does it.

16 years agoInitial support for coreboot.
Kevin O'Connor [Sun, 18 May 2008 06:42:58 +0000 (02:42 -0400)]
Initial support for coreboot.

Add new option for targetting a coreboot payload.
When in coreboot mode, configure out those parts of the code that wont
    work on real hardware.
Don't include cmos.h in files that don't need it.

16 years agoCleanup ata hard drive detection.
Kevin O'Connor [Sun, 18 May 2008 05:43:07 +0000 (01:43 -0400)]
Cleanup ata hard drive detection.

Don't rely on nvram for hd geometry - instead use values autodetected.
Don't outb() to PORT_HD_DATA - was left over from old code.
Reorganize parts of ata_init/ata_detect.
Separate hd geometry translation code to its own functions.

16 years agoEstablish boot order in post stage.
Kevin O'Connor [Sun, 18 May 2008 04:20:53 +0000 (00:20 -0400)]
Establish boot order in post stage.

Read boot order nvram fields in post stage and store in a variable.
Change boot menu to update boot order instead of using separate variables.

16 years agoAuto-detect equipment byte info - don't require nvram.
Kevin O'Connor [Sun, 18 May 2008 04:14:13 +0000 (00:14 -0400)]
Auto-detect equipment byte info - don't require nvram.

Detect the number of floppies present and add to equipment byte info field.

16 years agoAuto detect EBDA_SIZE from size of data structure.
Kevin O'Connor [Sun, 18 May 2008 04:03:32 +0000 (00:03 -0400)]
Auto detect EBDA_SIZE from size of data structure.

16 years agoUnify memory size detection.
Kevin O'Connor [Sun, 18 May 2008 02:20:27 +0000 (22:20 -0400)]
Unify memory size detection.

Figure out memory size once at startup and save in a variable.
Change all run-time locations to use that variable instead of
    re-detecting memory size.

16 years agoAdd full support for drives with more that 2<<32 sectors.
Kevin O'Connor [Wed, 14 May 2008 04:43:13 +0000 (00:43 -0400)]
Add full support for drives with more that 2<<32 sectors.

Use 64bit integers for sector and lba values.

16 years agoSync rombios32.c with bochs cvs.
Kevin O'Connor [Wed, 14 May 2008 02:31:39 +0000 (22:31 -0400)]
Sync rombios32.c with bochs cvs.

Use 0x30/0x31 for reading memory size (when EXTMEM2 not found).
Also convert cmos ids to use defined names.
Don't advertise support for suspend c2/c3 levels.
Move uuid_probe closer to usage.

16 years agoFix typo in clock.c outb_cmos call.
Kevin O'Connor [Wed, 14 May 2008 02:29:42 +0000 (22:29 -0400)]
Fix typo in clock.c outb_cmos call.

Register and value were reversed.

16 years agoReduce ide stack usage by reorganizing ata calls.
Kevin O'Connor [Tue, 13 May 2008 04:18:20 +0000 (00:18 -0400)]
Reduce ide stack usage by reorganizing ata calls.

Break up some functions and play with inlining to reduce stack usage.

16 years agoAdd tool to check stack usage of 16bit code.
Kevin O'Connor [Tue, 13 May 2008 03:50:16 +0000 (23:50 -0400)]
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.

16 years agoAdd compile options to reduce stack usage.
Kevin O'Connor [Tue, 13 May 2008 03:44:57 +0000 (23:44 -0400)]
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.

16 years agoUse a linker script for 16bit code.
Kevin O'Connor [Mon, 12 May 2008 22:28:58 +0000 (18:28 -0400)]
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.

16 years agoFix elf build; rename target file rom.bin to bios.bin.
Kevin O'Connor [Sat, 10 May 2008 19:49:20 +0000 (15:49 -0400)]
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.

16 years agoSupport 32bit entry point and an elf wrapped binary.
Kevin O'Connor [Fri, 9 May 2008 01:47:33 +0000 (21:47 -0400)]
Support 32bit entry point and an elf wrapped binary.

16 years agoAdd support for sending debug messages to a serial port.
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.

16 years agoThis patch does:
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>
16 years agoMinor cleanups.
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.

16 years agoExpand floppy_ret to show function names when return code is a failure.
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.

16 years agoCompile fixes for gcc 4.3.
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.

16 years agoMove timer setup from post.c to clock.c.
Kevin O'Connor [Sun, 13 Apr 2008 21:37:41 +0000 (17:37 -0400)]
Move timer setup from post.c to clock.c.

16 years agoMove serial/lpt setup from post.c to serial.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

16 years agoMove hard drive init from post.c to ata.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.

16 years agoMove floppy setup code from post.c to floppy.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.

16 years agoFix typo causing fdpt1 from structure from being populated.
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().

16 years agoAdd compile options to Makefile to reduce stack space.
Kevin O'Connor [Sun, 13 Apr 2008 20:59:03 +0000 (16:59 -0400)]
Add compile options to Makefile to reduce stack space.

16 years agoUse __always_inline to force inlining.
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.

16 years agoFix asm dependencies on segment based writes.
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.

16 years agoFix bug causing low memory configs to be off by 1024 in e820 maps.
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.

16 years agoFix typo - a memcpy should have been memset in rombios32.c
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

16 years agoMemset should return 'void *' - just to conform to standards.
Kevin O'Connor [Sat, 12 Apr 2008 13:00:04 +0000 (09:00 -0400)]
Memset should return 'void *' - just to conform to standards.

16 years agoFix bug causing write corruption on large disks.
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.

16 years agoPort fix from bochs-bios for incorrect acpi on boxes < 16M.
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.

16 years agoIntroduce cpu_relax() and use it in busy loops.
Kevin O'Connor [Sat, 5 Apr 2008 23:30:02 +0000 (19:30 -0400)]
Introduce cpu_relax() and use it in busy loops.

16 years agoForward port new boot menu features from bochs bios.
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.

16 years agoMake several functions non-inline.
Kevin O'Connor [Sat, 5 Apr 2008 15:37:51 +0000 (11:37 -0400)]
Make several functions non-inline.

16 years agoAdd s64 type to types.h.
Kevin O'Connor [Sat, 5 Apr 2008 14:47:13 +0000 (10:47 -0400)]
Add s64 type to types.h.

16 years agoMinor enhancements to README file.
Kevin O'Connor [Wed, 2 Apr 2008 01:09:05 +0000 (21:09 -0400)]
Minor enhancements to README file.

16 years agoDon't clobber %esp highbits on C code entry.
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

16 years agoAvoid using volatile on GET/SET_VAR macros.
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.

16 years agoMinor cleanup of GET_VAR usage in output.c.
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*.

16 years agoMinor cleanups.
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.

16 years agoUpdate README file with more information on using the bios.
Kevin O'Connor [Sun, 30 Mar 2008 15:07:42 +0000 (11:07 -0400)]
Update README file with more information on using the bios.

16 years agoUnify checksum functions.
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.

16 years agoFix bugs in GET/SET_FARPTR macros.
Kevin O'Connor [Sat, 29 Mar 2008 18:28:00 +0000 (14:28 -0400)]
Fix bugs in GET/SET_FARPTR macros.

16 years agoCleanup boot order determination.
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.

16 years agoMerge IPL segment into EBDA segment.
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.

16 years agoRefactor ata code.
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'.

16 years agoReorder basic_access() to reduce stack usage.
Kevin O'Connor [Sat, 29 Mar 2008 16:45:53 +0000 (12:45 -0400)]
Reorder basic_access() to reduce stack usage.

16 years agoMinor debugging improvements.
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).

16 years agoMove internal defs from ata.h to ata.c.
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.

16 years agoLimit cdrom emulation available functions.
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.

16 years agoRemove redundant debug statements from disk.c.
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.

16 years agoCleanup cdrom emulation.
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.

16 years agoUse "FARPTR" consistently in macros.
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.

16 years agoFix disk_1301 handler.
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().

16 years agoBreakout cdrom emulation support into CONFIG_CDROM_EMU.
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.

16 years agoGuard header file pci.h
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>
16 years agoMinor change - use set_success() instead of set_cf in pcibios.c.
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.