use shorter ata timeout for identify commands when running from cd
to shorten probe time.
This commit is contained in:
parent
304471a107
commit
c6f8154df0
2 changed files with 34 additions and 8 deletions
|
@ -218,7 +218,8 @@ struct command {
|
||||||
#define ERR_BAD_SECTOR (-2) /* block marked bad detected */
|
#define ERR_BAD_SECTOR (-2) /* block marked bad detected */
|
||||||
|
|
||||||
/* Some controllers don't interrupt, the clock will wake us up. */
|
/* Some controllers don't interrupt, the clock will wake us up. */
|
||||||
#define WAKEUP (32*HZ) /* drive may be out for 31 seconds max */
|
#define WAKEUP_SECS 32 /* drive may be out for 31 seconds max */
|
||||||
|
#define WAKEUP_TICKS (WAKEUP_SECS*HZ)
|
||||||
|
|
||||||
/* Miscellaneous. */
|
/* Miscellaneous. */
|
||||||
#define MAX_DRIVES 8
|
#define MAX_DRIVES 8
|
||||||
|
@ -250,9 +251,9 @@ struct command {
|
||||||
|
|
||||||
/* Timeouts and max retries. */
|
/* Timeouts and max retries. */
|
||||||
int timeout_ticks = DEF_TIMEOUT_TICKS, max_errors = MAX_ERRORS;
|
int timeout_ticks = DEF_TIMEOUT_TICKS, max_errors = MAX_ERRORS;
|
||||||
int wakeup_ticks = WAKEUP;
|
|
||||||
long w_standard_timeouts = 0, w_pci_debug = 0, w_instance = 0,
|
long w_standard_timeouts = 0, w_pci_debug = 0, w_instance = 0,
|
||||||
disable_dma = 0, atapi_debug = 0;
|
disable_dma = 0, atapi_debug = 0, w_identify_wakeup_ticks = WAKEUP_TICKS,
|
||||||
|
wakeup_ticks = WAKEUP_TICKS;
|
||||||
|
|
||||||
int w_testing = 0, w_silent = 0;
|
int w_testing = 0, w_silent = 0;
|
||||||
|
|
||||||
|
@ -426,14 +427,24 @@ PRIVATE void init_params()
|
||||||
struct wini *wn;
|
struct wini *wn;
|
||||||
u8_t params[16];
|
u8_t params[16];
|
||||||
int s;
|
int s;
|
||||||
|
long wakeup_secs;
|
||||||
|
|
||||||
/* Boot variables. */
|
/* Boot variables. */
|
||||||
env_parse("ata_std_timeout", "d", 0, &w_standard_timeouts, 0, 1);
|
env_parse("ata_std_timeout", "d", 0, &w_standard_timeouts, 0, 1);
|
||||||
env_parse("ata_pci_debug", "d", 0, &w_pci_debug, 0, 1);
|
env_parse("ata_pci_debug", "d", 0, &w_pci_debug, 0, 1);
|
||||||
env_parse("ata_instance", "d", 0, &w_instance, 0, 8);
|
env_parse("ata_instance", "d", 0, &w_instance, 0, 8);
|
||||||
env_parse("ata_no_dma", "d", 0, &disable_dma, 0, 1);
|
env_parse("ata_no_dma", "d", 0, &disable_dma, 0, 1);
|
||||||
|
env_parse("ata_id_timeout", "d", 0, &wakeup_secs, 1, 60);
|
||||||
env_parse("atapi_debug", "d", 0, &atapi_debug, 0, 1);
|
env_parse("atapi_debug", "d", 0, &atapi_debug, 0, 1);
|
||||||
|
|
||||||
|
w_identify_wakeup_ticks = wakeup_secs * HZ;
|
||||||
|
|
||||||
|
if(w_identify_wakeup_ticks <= 0) {
|
||||||
|
printf("changing wakeup from %d to %d ticks.\n",
|
||||||
|
w_identify_wakeup_ticks, WAKEUP_TICKS);
|
||||||
|
w_identify_wakeup_ticks = WAKEUP_TICKS;
|
||||||
|
}
|
||||||
|
|
||||||
if (disable_dma)
|
if (disable_dma)
|
||||||
printf("DMA for ATA devices is disabled.\n");
|
printf("DMA for ATA devices is disabled.\n");
|
||||||
|
|
||||||
|
@ -789,6 +800,8 @@ PRIVATE int w_identify()
|
||||||
u16_t w;
|
u16_t w;
|
||||||
unsigned long dma_status;
|
unsigned long dma_status;
|
||||||
unsigned long size;
|
unsigned long size;
|
||||||
|
int prev_wakeup;
|
||||||
|
int r;
|
||||||
#define id_byte(n) (&tmp_buf[2 * (n)])
|
#define id_byte(n) (&tmp_buf[2 * (n)])
|
||||||
#define id_word(n) (((u16_t) id_byte(n)[0] << 0) \
|
#define id_word(n) (((u16_t) id_byte(n)[0] << 0) \
|
||||||
|((u16_t) id_byte(n)[1] << 8))
|
|((u16_t) id_byte(n)[1] << 8))
|
||||||
|
@ -800,7 +813,13 @@ PRIVATE int w_identify()
|
||||||
/* Try to identify the device. */
|
/* Try to identify the device. */
|
||||||
cmd.ldh = wn->ldhpref;
|
cmd.ldh = wn->ldhpref;
|
||||||
cmd.command = ATA_IDENTIFY;
|
cmd.command = ATA_IDENTIFY;
|
||||||
if (com_simple(&cmd) == OK && w_waitfor(STATUS_DRQ, STATUS_DRQ) &&
|
|
||||||
|
/* Execute *_IDENTIFY with configured *_IDENTIFY timeout. */
|
||||||
|
prev_wakeup = wakeup_ticks;
|
||||||
|
wakeup_ticks = w_identify_wakeup_ticks;
|
||||||
|
r = com_simple(&cmd);
|
||||||
|
|
||||||
|
if (r == OK && w_waitfor(STATUS_DRQ, STATUS_DRQ) &&
|
||||||
!(wn->w_status & (STATUS_ERR|STATUS_WF))) {
|
!(wn->w_status & (STATUS_ERR|STATUS_WF))) {
|
||||||
|
|
||||||
/* Device information. */
|
/* Device information. */
|
||||||
|
@ -811,6 +830,7 @@ PRIVATE int w_identify()
|
||||||
if (id_word(0) & ID_GEN_NOT_ATA)
|
if (id_word(0) & ID_GEN_NOT_ATA)
|
||||||
{
|
{
|
||||||
printf("%s: not an ATA device?\n", w_name());
|
printf("%s: not an ATA device?\n", w_name());
|
||||||
|
wakeup_ticks = prev_wakeup;
|
||||||
return ERR;
|
return ERR;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -977,13 +997,19 @@ PRIVATE int w_identify()
|
||||||
/* Not an ATA device; no translations, no special features. Don't
|
/* Not an ATA device; no translations, no special features. Don't
|
||||||
* touch it unless the BIOS knows about it.
|
* touch it unless the BIOS knows about it.
|
||||||
*/
|
*/
|
||||||
if (wn->lcylinders == 0) { return(ERR); } /* no BIOS parameters */
|
if (wn->lcylinders == 0) {
|
||||||
|
wakeup_ticks = prev_wakeup;
|
||||||
|
return(ERR);
|
||||||
|
} /* no BIOS parameters */
|
||||||
wn->pcylinders = wn->lcylinders;
|
wn->pcylinders = wn->lcylinders;
|
||||||
wn->pheads = wn->lheads;
|
wn->pheads = wn->lheads;
|
||||||
wn->psectors = wn->lsectors;
|
wn->psectors = wn->lsectors;
|
||||||
size = (u32_t) wn->pcylinders * wn->pheads * wn->psectors;
|
size = (u32_t) wn->pcylinders * wn->pheads * wn->psectors;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Restore wakeup_ticks. */
|
||||||
|
wakeup_ticks = prev_wakeup;
|
||||||
|
|
||||||
/* Size of the whole drive */
|
/* Size of the whole drive */
|
||||||
wn->part[0].dv_size = mul64u(size, SECTOR_SIZE);
|
wn->part[0].dv_size = mul64u(size, SECTOR_SIZE);
|
||||||
|
|
||||||
|
@ -2365,7 +2391,7 @@ int safe;
|
||||||
/* Restore defaults. */
|
/* Restore defaults. */
|
||||||
timeout_ticks = DEF_TIMEOUT_TICKS;
|
timeout_ticks = DEF_TIMEOUT_TICKS;
|
||||||
max_errors = MAX_ERRORS;
|
max_errors = MAX_ERRORS;
|
||||||
wakeup_ticks = WAKEUP;
|
wakeup_ticks = WAKEUP_TICKS;
|
||||||
w_silent = 0;
|
w_silent = 0;
|
||||||
} else if (timeout < 0) {
|
} else if (timeout < 0) {
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
|
|
|
@ -188,7 +188,7 @@ cdfdboot)
|
||||||
cp -p ../boot/boot /mnt/boot/boot || exit 1
|
cp -p ../boot/boot /mnt/boot/boot || exit 1
|
||||||
umount $dev || exit 1
|
umount $dev || exit 1
|
||||||
installboot -d $dev ../boot/bootblock boot/boot || exit 1
|
installboot -d $dev ../boot/bootblock boot/boot || exit 1
|
||||||
edparams $dev 'unset bootopts; unset servers; disable=inet; image=/boot/image/image; bootbig(1, Regular MINIX 3 (requires at least 16 MB RAM)) { image=/boot/image/image ; boot } bootsmall(2, Small MINIX 3 (intended for 8 MB systems)) { image=/boot/image/image_small ; boot } cdproberoot=1; unset rootdev; unset leader; leader() { echo \n--- Welcome to MINIX 3. This is the boot monitor. ---\n\nChoose an option from the menu or press ESC if you need to do anything special.\nOtherwise I will boot with my defaults in 10 seconds.\n\n }; bootcd=1; main(){trap 10000 boot; menu; }; save' || exit
|
edparams $dev 'unset bootopts; unset servers; disable=inet; image=/boot/image/image; bootbig(1, Regular MINIX 3) { image=/boot/image/image ; boot } bootsmall(2, Small MINIX 3 (uses less memory)) { image=/boot/image/image_small ; boot } cdproberoot=1; ata_id_timeout=2; unset rootdev; unset leader; leader() { echo \n--- Welcome to MINIX 3. This is the boot monitor. ---\n\nChoose an option from the menu or press ESC if you need to do anything special.\nOtherwise I will boot with my defaults in 10 seconds.\n\n }; bootcd=1; main(){trap 10000 boot; menu; }; save' || exit
|
||||||
|
|
||||||
# copy image
|
# copy image
|
||||||
dd if=$dev of=cdfdimage bs=8192 count=180
|
dd if=$dev of=cdfdimage bs=8192 count=180
|
||||||
|
|
Loading…
Reference in a new issue