]> xenbits.xensource.com Git - seabios.git/commitdiff
Don't 'autodetect' ATA PIO32 mode - use compile def instead.
authorKevin O'Connor <kevin@koconnor.net>
Sat, 28 Feb 2009 02:23:01 +0000 (21:23 -0500)
committerKevin O'Connor <kevin@koconnor.net>
Sat, 28 Feb 2009 02:23:01 +0000 (21:23 -0500)
The PIO32 detection appears to use a hack built for emulators.  It
    wont work on real hardware.
Implement with a compile time define instead.
This also improves the quality of the compiled code.

src/ata.c
src/config.h
src/disk.c
src/disk.h

index adf39295d44eb344b3f29c98c675edaa4ac2ac0e..e9f9c7cf855c0d01cf461d2517b0f41c37c948a8 100644 (file)
--- a/src/ata.c
+++ b/src/ata.c
@@ -220,10 +220,10 @@ send_cmd(int driveid, struct ata_pio_command *cmd)
 
 // Read and discard x number of bytes from an io channel.
 static void
-insx_discard(int mode, int iobase1, int bytes)
+insx_discard(int iobase1, int bytes)
 {
     int count, i;
-    if (mode == ATA_MODE_PIO32) {
+    if (CONFIG_ATA_PIO32) {
         count = bytes / 4;
         for (i=0; i<count; i++)
             inl(iobase1);
@@ -254,13 +254,12 @@ ata_transfer(int driveid, int iswrite, int count, int blocksize
     u8 channel  = driveid / 2;
     u16 iobase1 = GET_GLOBAL(ATA.channels[channel].iobase1);
     u16 iobase2 = GET_GLOBAL(ATA.channels[channel].iobase2);
-    u8 mode     = GET_GLOBAL(ATA.devices[driveid].mode);
     int current = 0;
     int status;
     for (;;) {
         int bsize = blocksize;
         if (skipfirst && current == 0) {
-            insx_discard(mode, iobase1, skipfirst);
+            insx_discard(iobase1, skipfirst);
             bsize -= skipfirst;
         }
         if (skiplast && current == count-1)
@@ -269,14 +268,14 @@ ata_transfer(int driveid, int iswrite, int count, int blocksize
         if (iswrite) {
             // Write data to controller
             dprintf(16, "Write sector id=%d dest=%p\n", driveid, buf_fl);
-            if (mode == ATA_MODE_PIO32)
+            if (CONFIG_ATA_PIO32)
                 outsl_fl(iobase1, buf_fl, bsize / 4);
             else
                 outsw_fl(iobase1, buf_fl, bsize / 2);
         } else {
             // Read data from controller
             dprintf(16, "Read sector id=%d dest=%p\n", driveid, buf_fl);
-            if (mode == ATA_MODE_PIO32)
+            if (CONFIG_ATA_PIO32)
                 insl_fl(iobase1, buf_fl, bsize / 4);
             else
                 insw_fl(iobase1, buf_fl, bsize / 2);
@@ -284,7 +283,7 @@ ata_transfer(int driveid, int iswrite, int count, int blocksize
         buf_fl += bsize;
 
         if (skiplast && current == count-1)
-            insx_discard(mode, iobase1, skiplast);
+            insx_discard(iobase1, skiplast);
 
         status = pause_await_not_bsy(iobase1, iobase2);
         if (status < 0)
@@ -642,9 +641,6 @@ extract_identify(int driveid, u16 *buffer)
 
     // Common flags.
     SET_GLOBAL(ATA.devices[driveid].removable, (buffer[0] & 0x80) ? 1 : 0);
-    // XXX - what is buffer[48]?
-    SET_GLOBAL(ATA.devices[driveid].mode
-               , buffer[48] ? ATA_MODE_PIO32 : ATA_MODE_PIO16);
 }
 
 static int
index ac99dae4446ec63c13d91ebe97aa5dd900fce1a3..13b847261134f4da60c6bf0a54fd8175109912c3 100644 (file)
 
 // Support for int13 floppy drive access
 #define CONFIG_FLOPPY_SUPPORT 1
-// Support for int15c2 mouse calls
-#define CONFIG_PS2_MOUSE 1
 // Support for IDE disk code
 #define CONFIG_ATA 1
-// Support calling int155f on each keyboard event
-#define CONFIG_KBD_CALL_INT15_4F 1
+// Use 32bit PIO accesses on ATA (minor optimization on PCI transfers)
+#define CONFIG_ATA_PIO32 0
 // Support for booting from a CD
 #define CONFIG_CDROM_BOOT 1
 // Support for emulating a boot CD as a floppy/harddrive
 #define CONFIG_LPT 1
 // Support int 16 keyboard calls
 #define CONFIG_KEYBOARD 1
+// Support calling int155f on each keyboard event
+#define CONFIG_KBD_CALL_INT15_4F 1
+// Support for int15c2 mouse calls
+#define CONFIG_PS2_MOUSE 1
 // Support finding and running option roms during post.
 #define CONFIG_OPTIONROMS 1
 // Set if option roms are already copied to 0xc0000-0xf0000
index 9bad1d709219c3d323a60ec4f495825b7041ab12..898fe499217c711dfdd06b9b0eb1a5a595ebbe6d 100644 (file)
@@ -452,7 +452,6 @@ disk_1348(struct bregs *regs, u8 device)
     u16 iobase1 = GET_GLOBAL(ATA.channels[channel].iobase1);
     u16 iobase2 = GET_GLOBAL(ATA.channels[channel].iobase2);
     u8 irq = GET_GLOBAL(ATA.channels[channel].irq);
-    u8 mode = GET_GLOBAL(ATA.devices[device].mode);
 
     u16 options = 0;
     if (type == ATA_TYPE_ATA) {
@@ -470,7 +469,7 @@ disk_1348(struct bregs *regs, u8 device)
         options |= 1<<6; // atapi device
     }
     options |= 1<<4; // lba translation
-    if (mode == ATA_MODE_PIO32)
+    if (CONFIG_ATA_PIO32)
         options |= 1<<7;
 
     SET_EBDA2(ebda_seg, dpte.iobase1, iobase1);
index 3661d27f7abd0059ce41555e5c1517ec286764b7..8e9f1cbff296df9b6993be560bb337204e1f7cae 100644 (file)
@@ -174,7 +174,6 @@ struct ata_device_s {
     u8  type;         // Detected type of ata (ata/atapi/none/unknown)
     u8  device;       // Detected type of attached devices (hd/cd/none)
     u8  removable;    // Removable device flag
-    u8  mode;         // transfer mode : PIO 16/32 bits - IRQ - ISADMA - PCIDMA
     u16 blksize;      // block size
     u8  version;      // ATA/ATAPI version