Move ata_detect call to 32bit code.
authorKevin O'Connor <kevin@koconnor.net>
Thu, 13 Mar 2008 00:57:08 +0000 (20:57 -0400)
committerKevin O'Connor <kevin@koconnor.net>
Thu, 13 Mar 2008 00:57:08 +0000 (20:57 -0400)
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).

Makefile
src/boot.c
src/post.c

index 7415f6afc64988220393b49b843ca250c5c8daf8..10c849ce48e5be3696d629b6b359e97474541889 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -10,7 +10,7 @@ OUT=out/
 # Source files
 SRC16=floppy.c disk.c system.c clock.c serial.c kbd.c mouse.c output.c \
       boot.c ata.c cdrom.c apm.c util.c
-SRC32=post.c output.c rombios32.c util.c
+SRC32=post.c output.c rombios32.c util.c ata.c
 TABLESRC=font.c cbt.c floppy_dbt.c
 
 cc-option = $(shell if test -z "`$(1) $(2) -S -o /dev/null -xc \
index c75bc1b24804d3de7410f292f408760f500d89b7..c1968a5da307c01e98121ec5d19370f8f3f9713e 100644 (file)
@@ -206,14 +206,3 @@ handle_19()
     debug_enter(NULL);
     do_boot(0);
 }
-
-// Called from 32bit code - start boot process
-void VISIBLE16
-begin_boot()
-{
-    if (CONFIG_ATA)
-        ata_detect();
-    struct bregs br;
-    memset(&br, 0, sizeof(br));
-    call16_int(0x19, &br);
-}
index 321d20b127aa9a64def2ee5ff296ce286040dce5..3ff8f305fe1e0b0356227bee475f331b46bbcdb2 100644 (file)
@@ -11,6 +11,7 @@
 #include "cmos.h" // CMOS_*
 #include "util.h" // memset
 #include "biosvar.h" // struct bios_data_area_s
+#include "ata.h"
 
 #define bda ((struct bios_data_area_s *)0)
 #define ebda ((struct extended_bios_data_area_s *)(EBDA_SEG<<4))
@@ -532,19 +533,23 @@ post()
 
     floppy_drive_post();
     hard_drive_post();
-    if (CONFIG_ATA)
+    if (CONFIG_ATA) {
         ata_init();
+        ata_detect();
+    }
 
     init_boot_vectors();
 
-    // XXX - original bios calls ata_detect before rom scan.
     rom_scan(0xc8000, 0xe0000);
 
     // reset the memory (some boot loaders such as syslinux suppose
     // that the memory is set to zero)
     memset((void*)0x40000, 0, 0x40000); // XXX - shouldn't use globals
 
-    callrom(SEG_BIOS, OFFSET_begin_boot);
+    // Invoke int 19 to start boot process.
+    struct bregs br;
+    memset(&br, 0, sizeof(br));
+    call16_int(0x19, &br);
 }
 
 static void