redboot ide.c patch

Jonathan Larmour jifl@eCosCentric.com
Thu May 27 06:38:00 GMT 2004


Andy Dyer wrote:
> The attached patch changes redboot's fs/ide.c so that
> it first checks the status of the BSY bit to be 0 before
> looking at any of the other bits.  Per the ATA rev. 6
> spec i have:
> 
> 7.3.3 & 7.15.3  Access restrictions (Alternate status register and
> status register)
> 
> When the BSY bit is set to one, the other bits in this register
> shall not be used. The contents of this register are not valid
> while the device is in Sleep mode.
> 
> 
> This was causing a detection failure on a Compact Flash card in
> "True ATA" mode on one of our targets.

Fair enough, although I made a modification:

> Index: redboot/current/src/fs/ide.c
> ===================================================================
> RCS file: /home/cvsroot/Projects/ecos/packages/redboot/current/src/fs/ide.c,v
> retrieving revision 1.1.1.1
> retrieving revision 1.2
> diff -u -5 -w -r1.1.1.1 -r1.2
> --- redboot/current/src/fs/ide.c	28 Mar 2004 18:52:37 -0000	1.1.1.1
> +++ redboot/current/src/fs/ide.c	16 May 2004 20:08:20 -0000	1.2
> @@ -82,16 +82,18 @@
>      cyg_uint8 status;
>  
>      CYGACC_CALL_IF_DELAY_US(10);
>      do {
>  	HAL_IDE_READ_UINT8(ctlr, IDE_REG_STATUS, status);
> +        if (!(status & IDE_STAT_BSY)) {
>  	if (status & IDE_STAT_DRQ)
>  	    return 1;
> -    } while (status & IDE_STAT_BSY);
> -
> +            else
>      return 0;
>  }
> +    } while (1);
> +}

I made this while loop a for loop, just for paranoia so it does eventually 
(probably a long time) terminate.

Thanks!

Jifl
-- 
eCosCentric    http://www.eCosCentric.com/    The eCos and RedBoot experts
--["No sense being pessimistic, it wouldn't work anyway"]-- Opinions==mine



More information about the Ecos-patches mailing list