wd driver would fail on calling wdgetctlr() for older drives and

controllers. New behaviour is that if the standard method fails, try
to recalibrate the drive. Success means the drive exists.  patch by
hpeyerl@novatel.cuc.ab.ca (who owns several of these historical
artifacts)
This commit is contained in:
deraadt 1993-04-15 06:39:00 +00:00
parent 9c736c1dcf
commit bf6814fb30
3 changed files with 72 additions and 15 deletions

View File

@ -1130,11 +1130,21 @@ wdgetctlr(int u, struct disk *du)
return(stat); return(stat);
} }
#endif #endif
/*
* If WDCC_READP fails then we might have an old drive so we try
* a seek to 0; if that passes then the drive is there but it's
* OLD AND KRUSTY.
*/
if (stat & WDCS_ERR) { if (stat & WDCS_ERR) {
splx(x); stat = wdcommand(du, WDCC_RESTORE | WD_STEP);
return(inb(wdc+wd_error)); if(stat & WDCS_ERR) {
splx(x);
return(inb(wdc+wd_error));
}
stat = 0x7f; /* MFM/RLL marker for later. */
} }
/* obtain parameters */ /* obtain parameters */
wp = &du->dk_params; wp = &du->dk_params;
insw(wdc+wd_data, tb, sizeof(tb)/sizeof(short)); insw(wdc+wd_data, tb, sizeof(tb)/sizeof(short));
@ -1146,6 +1156,7 @@ wdgetctlr(int u, struct disk *du)
p = (u_short *) (wp->wdp_model + i); p = (u_short *) (wp->wdp_model + i);
*p = ntohs(*p); *p = ntohs(*p);
} }
/* /*
printf("gc %x cyl %d trk %d sec %d type %d sz %d model %s\n", wp->wdp_config, printf("gc %x cyl %d trk %d sec %d type %d sz %d model %s\n", wp->wdp_config,
wp->wdp_fixedcyl+wp->wdp_removcyl, wp->wdp_heads, wp->wdp_sectors, wp->wdp_fixedcyl+wp->wdp_removcyl, wp->wdp_heads, wp->wdp_sectors,
@ -1161,10 +1172,18 @@ wdgetctlr(int u, struct disk *du)
du->dk_dd.d_partitions[1].p_offset = 0; du->dk_dd.d_partitions[1].p_offset = 0;
/* dubious ... */ /* dubious ... */
bcopy("ESDI/IDE", du->dk_dd.d_typename, 9); if(stat == 0x7f) {
strncpy(du->dk_dd.d_typename, "ST506", sizeof du->dk_dd.d_typename);
for(i=0; i<sizeof(wp->wdp_model); i++)
wp->wdp_model[i] = ' ';
strncpy(wp->wdp_model, "KrUsTy DiSk", sizeof wp->wdp_model);
du->dk_dd.d_type = DTYPE_ST506;
} else {
strncpy(du->dk_dd.d_typename, "ESDI/IDE", sizeof du->dk_dd.d_typename);
du->dk_dd.d_type = DTYPE_ESDI;
}
bcopy(wp->wdp_model+20, du->dk_dd.d_packname, 14-1); bcopy(wp->wdp_model+20, du->dk_dd.d_packname, 14-1);
/* better ... */ /* better ... */
du->dk_dd.d_type = DTYPE_ESDI;
du->dk_dd.d_subtype |= DSTYPE_GEOMETRY; du->dk_dd.d_subtype |= DSTYPE_GEOMETRY;
/* XXX sometimes possibly needed */ /* XXX sometimes possibly needed */

View File

@ -1130,11 +1130,21 @@ wdgetctlr(int u, struct disk *du)
return(stat); return(stat);
} }
#endif #endif
/*
* If WDCC_READP fails then we might have an old drive so we try
* a seek to 0; if that passes then the drive is there but it's
* OLD AND KRUSTY.
*/
if (stat & WDCS_ERR) { if (stat & WDCS_ERR) {
splx(x); stat = wdcommand(du, WDCC_RESTORE | WD_STEP);
return(inb(wdc+wd_error)); if(stat & WDCS_ERR) {
splx(x);
return(inb(wdc+wd_error));
}
stat = 0x7f; /* MFM/RLL marker for later. */
} }
/* obtain parameters */ /* obtain parameters */
wp = &du->dk_params; wp = &du->dk_params;
insw(wdc+wd_data, tb, sizeof(tb)/sizeof(short)); insw(wdc+wd_data, tb, sizeof(tb)/sizeof(short));
@ -1146,6 +1156,7 @@ wdgetctlr(int u, struct disk *du)
p = (u_short *) (wp->wdp_model + i); p = (u_short *) (wp->wdp_model + i);
*p = ntohs(*p); *p = ntohs(*p);
} }
/* /*
printf("gc %x cyl %d trk %d sec %d type %d sz %d model %s\n", wp->wdp_config, printf("gc %x cyl %d trk %d sec %d type %d sz %d model %s\n", wp->wdp_config,
wp->wdp_fixedcyl+wp->wdp_removcyl, wp->wdp_heads, wp->wdp_sectors, wp->wdp_fixedcyl+wp->wdp_removcyl, wp->wdp_heads, wp->wdp_sectors,
@ -1161,10 +1172,18 @@ wdgetctlr(int u, struct disk *du)
du->dk_dd.d_partitions[1].p_offset = 0; du->dk_dd.d_partitions[1].p_offset = 0;
/* dubious ... */ /* dubious ... */
bcopy("ESDI/IDE", du->dk_dd.d_typename, 9); if(stat == 0x7f) {
strncpy(du->dk_dd.d_typename, "ST506", sizeof du->dk_dd.d_typename);
for(i=0; i<sizeof(wp->wdp_model); i++)
wp->wdp_model[i] = ' ';
strncpy(wp->wdp_model, "KrUsTy DiSk", sizeof wp->wdp_model);
du->dk_dd.d_type = DTYPE_ST506;
} else {
strncpy(du->dk_dd.d_typename, "ESDI/IDE", sizeof du->dk_dd.d_typename);
du->dk_dd.d_type = DTYPE_ESDI;
}
bcopy(wp->wdp_model+20, du->dk_dd.d_packname, 14-1); bcopy(wp->wdp_model+20, du->dk_dd.d_packname, 14-1);
/* better ... */ /* better ... */
du->dk_dd.d_type = DTYPE_ESDI;
du->dk_dd.d_subtype |= DSTYPE_GEOMETRY; du->dk_dd.d_subtype |= DSTYPE_GEOMETRY;
/* XXX sometimes possibly needed */ /* XXX sometimes possibly needed */

View File

@ -1130,11 +1130,21 @@ wdgetctlr(int u, struct disk *du)
return(stat); return(stat);
} }
#endif #endif
/*
* If WDCC_READP fails then we might have an old drive so we try
* a seek to 0; if that passes then the drive is there but it's
* OLD AND KRUSTY.
*/
if (stat & WDCS_ERR) { if (stat & WDCS_ERR) {
splx(x); stat = wdcommand(du, WDCC_RESTORE | WD_STEP);
return(inb(wdc+wd_error)); if(stat & WDCS_ERR) {
splx(x);
return(inb(wdc+wd_error));
}
stat = 0x7f; /* MFM/RLL marker for later. */
} }
/* obtain parameters */ /* obtain parameters */
wp = &du->dk_params; wp = &du->dk_params;
insw(wdc+wd_data, tb, sizeof(tb)/sizeof(short)); insw(wdc+wd_data, tb, sizeof(tb)/sizeof(short));
@ -1146,6 +1156,7 @@ wdgetctlr(int u, struct disk *du)
p = (u_short *) (wp->wdp_model + i); p = (u_short *) (wp->wdp_model + i);
*p = ntohs(*p); *p = ntohs(*p);
} }
/* /*
printf("gc %x cyl %d trk %d sec %d type %d sz %d model %s\n", wp->wdp_config, printf("gc %x cyl %d trk %d sec %d type %d sz %d model %s\n", wp->wdp_config,
wp->wdp_fixedcyl+wp->wdp_removcyl, wp->wdp_heads, wp->wdp_sectors, wp->wdp_fixedcyl+wp->wdp_removcyl, wp->wdp_heads, wp->wdp_sectors,
@ -1161,10 +1172,18 @@ wdgetctlr(int u, struct disk *du)
du->dk_dd.d_partitions[1].p_offset = 0; du->dk_dd.d_partitions[1].p_offset = 0;
/* dubious ... */ /* dubious ... */
bcopy("ESDI/IDE", du->dk_dd.d_typename, 9); if(stat == 0x7f) {
strncpy(du->dk_dd.d_typename, "ST506", sizeof du->dk_dd.d_typename);
for(i=0; i<sizeof(wp->wdp_model); i++)
wp->wdp_model[i] = ' ';
strncpy(wp->wdp_model, "KrUsTy DiSk", sizeof wp->wdp_model);
du->dk_dd.d_type = DTYPE_ST506;
} else {
strncpy(du->dk_dd.d_typename, "ESDI/IDE", sizeof du->dk_dd.d_typename);
du->dk_dd.d_type = DTYPE_ESDI;
}
bcopy(wp->wdp_model+20, du->dk_dd.d_packname, 14-1); bcopy(wp->wdp_model+20, du->dk_dd.d_packname, 14-1);
/* better ... */ /* better ... */
du->dk_dd.d_type = DTYPE_ESDI;
du->dk_dd.d_subtype |= DSTYPE_GEOMETRY; du->dk_dd.d_subtype |= DSTYPE_GEOMETRY;
/* XXX sometimes possibly needed */ /* XXX sometimes possibly needed */