Remove (incorrect) drive count detection stuff.
For now hard-code the drive count as 1 for integrated, and 2 for normal.
The second drive will error out if it isn't there.
(Which is what it did before anyway.)
If the second drive isn't really there back it out from the drive count.
The original code was starting at one and then detecting
   the _adapter_ and incrementing the drive count.
Still need to research the correct way to do drive count detection.

Again at
http://www.sound.net/~hald/projects/ps2esdi/ps2esdi-2.4.4-patch3

Hal Duston
[EMAIL PROTECTED]
Remove (incorrect) drive count detection stuff.
For now hard-code the drive count as 1 for integrated, and 2 for normal.
The second drive will error out if it isn't there.
(Which is what it did before anyway.)
If the second drive isn't really there back it out from the drive count.
The original code was starting at one and then detecting
   the _adapter_ and incrementing the drive count.
Still need to research the correct way to do drive count detection.

--- linux-2.4.5-pre4/drivers/block/ps2esdi.c.2  Mon May 21 00:03:02 2001
+++ linux-2.4.5-pre4/drivers/block/ps2esdi.c.3  Mon May 21 00:05:34 2001
@@ -125,7 +125,6 @@
 static int ps2esdi_slot = -1;
 static u_char ps2esdi_pos[8];
 static int tp720esdi = 0;      /* Is it Integrated ESDI of ThinkPad-720? */
-static int intg_esdi = 0;       /* If integrated adapter */
 struct ps2esdi_i_struct {
        unsigned int head, sect, cyl, wpcom, lzone, ctl;
 };
@@ -478,7 +477,10 @@
 
        /* Integrated ESDI Disk and Controller has only one drive! */
        if (adapterID == INTG_ESDI_ID) {/* if not "normal" PS2 ESDI adapter */
-               ps2esdi_drives = 1;     /* then we have only one physical disk! */     
         intg_esdi = 1;
+               ps2esdi_drives = 1;     /* then we have only one physical disk! */
+       }
+       else {
+               ps2esdi_drives = 2;
        }
 
 
@@ -487,13 +489,6 @@
 
        ps2esdi_get_device_cfg();
 
-       /* some annoyance in the above routine returns TWO drives?
-        Is something else happining in the background?
-        Regaurdless we fix the # of drives again. AJK */
-       /* Integrated ESDI Disk and Controller has only one drive! */
-       if (adapterID == INTG_ESDI_ID)  /* if not "normal" PS2 ESDI adapter */
-               ps2esdi_drives = 1;     /* Not three or two, ONE DAMNIT! */
-
        current_int_handler = ps2esdi_normal_interrupt_handler;
 
        ps2esdi_gendisk.nr_real = ps2esdi_drives;
@@ -517,25 +512,19 @@
 static void __init ps2esdi_get_device_cfg(void)
 {
        u_short cmd_blk[TYPE_0_CMD_BLK_LENGTH];
+       int i;
 
-       /*BA */ printk("%s: Drive 0\n", DEVICE_NAME);
+       /*BA */
        current_int_handler = ps2esdi_geometry_int_handler;
-       cmd_blk[0] = CMD_GET_DEV_CONFIG | 0x600;
-       cmd_blk[1] = 0;
-       no_int_yet = TRUE;
-       ps2esdi_out_cmd_blk(cmd_blk);
-       if (no_int_yet)
-               sleep_on(&ps2esdi_int);
-
-       if (ps2esdi_drives > 1) {
-               printk("%s: Drive 1\n", DEVICE_NAME);   /*BA */
-               cmd_blk[0] = CMD_GET_DEV_CONFIG | (1 << 5) | 0x600;
+       for(i = 0; i < ps2esdi_drives; ++i) {
+               printk("%s: Drive %d\n", DEVICE_NAME, i);       /*BA */
+               cmd_blk[0] = CMD_GET_DEV_CONFIG | (i << 5) | 0x600;
                cmd_blk[1] = 0;
                no_int_yet = TRUE;
                ps2esdi_out_cmd_blk(cmd_blk);
                if (no_int_yet)
                        sleep_on(&ps2esdi_int);
-       }                       /* if second physical drive is present */
+       }
        return;
 }
 
@@ -862,9 +851,6 @@
                                                ps2esdi_info[0].cyl = reply[3];
                                                ps2esdi_info[0].wpcom = 0;
                                                ps2esdi_info[0].lzone = reply[3];
-                                       } else {
-                                               if (!intg_esdi)
-                                                       ps2esdi_drives++;
                                        }
                                }
 #ifdef OBSOLETE
@@ -880,8 +866,6 @@
                                                ps2esdi_info[0].cyl = reply[3];
                                                ps2esdi_info[0].wpcom = 0;
                                                ps2esdi_info[0].lzone = reply[3];
-                                       } else {
-                                               ps2esdi_drives++;
                                        }
                                }
 #endif
@@ -900,6 +884,7 @@
                printk("%s: Attention error. interrupt status : %02X\n", DEVICE_NAME,
                       int_ret_code);
                printk("%s: Device not available\n", DEVICE_NAME);
+               --ps2esdi_drives;
                break;
        case INT_CMD_ECC:
        case INT_CMD_RETRY:
@@ -912,6 +897,7 @@
                /*BA */ printk("%s: Whaa. Error occurred...\n", DEVICE_NAME);
                dump_cmd_complete_status(int_ret_code);
                outb((int_ret_code & 0xe0) | ATT_EOI, ESDI_ATTN);
+               --ps2esdi_drives;
                break;
        default:
                printk("%s: Unknown interrupt reason: %02X\n",

Reply via email to