diff options
author | phk <phk@FreeBSD.org> | 2000-03-17 17:09:55 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 2000-03-17 17:09:55 +0000 |
commit | 62e343d962c6c697d9bb8ec308c654f8bce8db80 (patch) | |
tree | e4f00f56d76f50c187f39286b602b80d9947f2a2 /sbin | |
parent | 77129d8b98aaa140b8bb2fbceadf6bcf86adb9b0 (diff) | |
download | FreeBSD-src-62e343d962c6c697d9bb8ec308c654f8bce8db80.zip FreeBSD-src-62e343d962c6c697d9bb8ec308c654f8bce8db80.tar.gz |
Make the fore_dnld program more robust and reliable.
In particular HZ=1000 would seem to break it before.
Diffstat (limited to 'sbin')
-rw-r--r-- | sbin/atm/fore_dnld/fore_dnld.c | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/sbin/atm/fore_dnld/fore_dnld.c b/sbin/atm/fore_dnld/fore_dnld.c index 13987bd..0369638 100644 --- a/sbin/atm/fore_dnld/fore_dnld.c +++ b/sbin/atm/fore_dnld/fore_dnld.c @@ -169,7 +169,7 @@ int prn; /* * We need to introduce a delay in here or things tend to hang... */ - delay(10); + delay(10000); if ( lineptr >= sizeof(line) ) lineptr = 0; @@ -242,10 +242,13 @@ int dn; { if ( CP_READ(Uart->mon_xmithost) & UART_VALID ) getbyte ( 0 ); - if ( !dn ) delay ( 1000 ); + if ( !dn ) delay ( 10000 ); } val = ( c | UART_VALID ); Uart->mon_xmitmon = CP_WRITE( val ); + if ( !dn ) delay ( 10000 ); + if ( CP_READ(Uart->mon_xmithost) & UART_VALID ) + getbyte ( 0 ); } @@ -756,7 +759,7 @@ u_char *ram; xmit_to_i960 ( cmd, strlen ( cmd ), 0 ); - while ( strncmp ( line, cmd, strlen(cmd) - 3 ) != 0 ) + while ( strncmp ( line, cmd, strlen(cmd) - 3 ) != 0 ) getline ( verbose ); if ( verbose ) @@ -1083,7 +1086,7 @@ char *argv[]; #else ram = (u_char *) mmap(0, air->acp_ramsize, #endif - PROT_READ | PROT_WRITE, MAP_SHARED, + PROT_READ | PROT_WRITE, MAP_SHARED | MAP_HASSEMAPHORE, fd, air->acp_ram); if (ram == (u_char *)-1) { perror ( "mmap ram" ); @@ -1330,14 +1333,20 @@ char *argv[]; */ aap = (Aali *)(ram + CP_READ(Mon->mon_appl)); for (i = 0; i < MAX_CHECK; i++, sleep(1)) { - u_long hb1, hb2; + u_long hb1, hb2, hb3; - if (CP_READ(Mon->mon_bstat) != BOOT_RUNNING) + hb3 = CP_READ(Mon->mon_bstat); + if (hb3 != BOOT_RUNNING) { + if (verbose) + printf("bstat %x\n", hb3); continue; + } hb1 = CP_READ(aap->aali_heartbeat); delay(1); hb2 = CP_READ(aap->aali_heartbeat); + if (verbose) + printf("hb %x %x\n", hb1, hb2); if (hb1 < hb2) break; } |