This is the mail archive of the ecos-patches@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: redboot ide tweaks


On Mon, 2004-09-27 at 15:13, Iztok Zupet wrote:
> On Mon, 2004-09-27 at 14:45 -0400, Mark Salter wrote:
> > Speed up boot when IDE controller has no devices attached.
> > Also workaround toolchain problem with optimizing an
> > unaligned 4-byte memcpy into a 32-bit load.
> > 
> > --Mark
> > 
> > 
> > diff -u -p -5 -r1.210 ChangeLog
> > --- redboot/current/ChangeLog	25 Sep 2004 10:49:42 -0000	1.210
> > +++ redboot/current/ChangeLog	27 Sep 2004 18:34:23 -0000
> > @@ -1,5 +1,11 @@
> > +2004-09-27  Mark Salter  <msalter@redhat.com>
> > +
> > +	* src/fs/ide.c (ide_presence_detect): New function.
> 
> Hello:
> 
> Where are the diffs for ide.c? They seem missing. I just updated from
> CVS and seem to be missing in CVS too.
> 
> Regards
> Iztok
> 

Sorry about that. Just checked this in:

Index: current/src/fs/ide.c
===================================================================
RCS file: /cvs/ecos/ecos/packages/redboot/current/src/fs/ide.c,v
retrieving revision 1.10
diff -u -p -5 -r1.10 ide.c
--- current/src/fs/ide.c	27 May 2004 06:37:45 -0000	1.10
+++ current/src/fs/ide.c	27 Sep 2004 19:18:57 -0000
@@ -6,11 +6,11 @@
 //
 //==========================================================================
 //####ECOSGPLCOPYRIGHTBEGIN####
 // -------------------------------------------
 // This file is part of eCos, the Embedded Configurable Operating System.
-// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
+// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2004 Red Hat, Inc.
 // Copyright (C) 2003 Gary Thomas <gary@mind.be>
 //
 // eCos is free software; you can redistribute it and/or modify it under
 // the terms of the GNU General Public License as published by the Free
 // Software Foundation; either version 2 or (at your option) any later version.
@@ -116,10 +116,32 @@ ide_reset(int ctlr)
 	  }
     }
     return 0;
 }
 
+// Return true if any devices attached to controller
+static int
+ide_presence_detect(int ctlr)
+{
+    cyg_uint8 sel, val;
+    int i;
+
+    for (i = 0; i < 2; i++) {
+	sel = (i << 4) | 0xA0;
+	CYGACC_CALL_IF_DELAY_US((cyg_uint32)50000);
+	HAL_IDE_WRITE_UINT8(ctlr, IDE_REG_DEVICE, sel);
+	CYGACC_CALL_IF_DELAY_US((cyg_uint32)50000);
+	HAL_IDE_READ_UINT8(ctlr, IDE_REG_DEVICE, val);
+	if (val == sel) {
+	    if (i)
+		HAL_IDE_WRITE_UINT8(ctlr, IDE_REG_DEVICE, 0);
+	    return 1;
+	}
+    }
+    return 0;
+}
+
 static int
 ide_ident(int ctlr, int dev, int is_packet_dev, cyg_uint16 *buf)
 {
     int i;
 
@@ -422,10 +444,15 @@ ide_init(void)
     CYGACC_CALL_IF_DELAY_US(5);
 
     priv = ide_privs;
     for (i = 0; i < num_controllers; i++) {
 
+	if (!ide_presence_detect(i)) {
+	    diag_printf("No devices on IDE controller %d\n", i);
+	    continue;
+	}
+
 	// soft reset the devices on this controller
 	if (!ide_reset(i))
 	    continue;
 
 	// 2 devices per controller


--Mark


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]