This is the mail archive of the ecos-patches@sourceware.org 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: [ECOS] Renaiming disk devices....


Hi folks

This continues the discussion about renaming all disk device names to
make then unique. Here is the proposed patch.

This patch also contains Frank Pagliughi patch for CF disks.

Please let me have comments ASAP, i'm likely to commit it tomorrow.

NOTE: SUCH NAME CHANGES MAY BREAK RUNNING SYSTEMS.

      Andrew
Index: devs/disk/generic/mmc/current/ChangeLog
===================================================================
RCS file: /cvs/ecos/ecos/packages/devs/disk/generic/mmc/current/ChangeLog,v
retrieving revision 1.4
diff -u -r1.4 ChangeLog
--- devs/disk/generic/mmc/current/ChangeLog	31 May 2007 15:56:39 -0000	1.4
+++ devs/disk/generic/mmc/current/ChangeLog	20 Aug 2008 05:16:04 -0000
@@ -1,3 +1,8 @@
+2008-08-19  Andrew Lunn  <andrew.lunn@ascom.ch>
+
+	* cdl/devs_disk_mmc.cdl: Renamed the device to /dev/mmcdiskX so
+	that it is unique with respect to other disk drivers.
+
 2007-05-30  Hajime Ishitani <pigmon@mail.snd.co.jp>
 
 	* src/mmc_spi.c: Revise debug information with addition.
Index: devs/disk/generic/mmc/current/cdl/devs_disk_mmc.cdl
===================================================================
RCS file: /cvs/ecos/ecos/packages/devs/disk/generic/mmc/current/cdl/devs_disk_mmc.cdl,v
retrieving revision 1.3
diff -u -r1.3 devs_disk_mmc.cdl
--- devs/disk/generic/mmc/current/cdl/devs_disk_mmc.cdl	31 May 2007 15:56:54 -0000	1.3
+++ devs/disk/generic/mmc/current/cdl/devs_disk_mmc.cdl	20 Aug 2008 05:16:04 -0000
@@ -77,18 +77,11 @@
 	cdl_option CYGDAT_DEVS_DISK_MMC_SPI_DISK0_NAME {
 	    display		"Device name for the MMC/SPI disk 0 device"
 	    flavor		data
-	    default_value	{ "\"/dev/hd0/\"" }
+	    default_value	{ "\"/dev/mmcdisk0/\"" }
 	    description "
                 This is the device name used to access the raw disk device
                 in eCos, for example for mount operations. Note that the
                 trailing slash must be present."
-
-	    # Testing support. For now just hard-code some values for partition 0
-	    # on the card.
-	    define_proc {
-		puts $::cdl_header "#define CYGDAT_DEVS_DISK_TEST_DEVICE CYGDAT_DEVS_DISK_MMC_SPI_DISK0_NAME \"1\""
-		puts $::cdl_header "#define CYGDAT_DEVS_DISK_TEST_MOUNTPOINT \"/dosfs\""
-		puts $::cdl_header "#define CYGDAT_DEVS_DISK_TEST_DIRECTORY  \"/test\""
 	    }
 	}
 	
@@ -96,18 +89,23 @@
 	    display		"Run the driver in polled mode rather than interrupt-driven"
 	    default_value	!CYGPKG_KERNEL
 	    description "
-                By default the MMC disk driver will operate in interrupt-driven
-                mode if the kernel is present, i.e. if the application is likely
-                to be multi-threaded. Otherwise it will operate in polled mode."
+                By default the MMC disk driver will operate in
+                interrupt-driven mode if the kernel is present,
+                i.e. if the application is likely to be
+                multi-threaded. Otherwise it will operate in polled
+                mode."
+
 	}
-    cdl_option CYGPKG_DEVS_DISK_MMC_SPI_IDLE_RETRIES_WAIT {
-        display          "Idle to operational retry wait"
-        flavor           booldata
-        default_value    10000
-        description      "
-            This option sets how long to wait between retries of attempts to change the
-            card state from idle to operational. It is measured in microseconds."
-    }
+        cdl_option CYGPKG_DEVS_DISK_MMC_SPI_IDLE_RETRIES_WAIT {
+            display          "Idle to operational retry wait"
+            flavor           booldata
+            default_value    10000
+            description      "
+
+                This option sets how long to wait between retries of
+                attempts to change the card state from idle to
+                operational. It is measured in microseconds."
+        }
 }
 
 # EOF devs_disk_mmc.cdl
Index: devs/disk/ide/current/ChangeLog
===================================================================
RCS file: /cvs/ecos/ecos/packages/devs/disk/ide/current/ChangeLog,v
retrieving revision 1.4
diff -u -r1.4 ChangeLog
--- devs/disk/ide/current/ChangeLog	17 Nov 2006 18:04:43 -0000	1.4
+++ devs/disk/ide/current/ChangeLog	20 Aug 2008 05:16:04 -0000
@@ -1,3 +1,16 @@
+2008-08-19  Andrew Lunn  <andrew.lunn@ascom.ch>
+
+	* cdl/ide_disk.cdl: Rename of the devices to be /dev/idediskX/Y
+	so that all disk drivers have unique device names.
+
+2008-08-18 Frank Pagliughi <fpagliughi@mindspring.com>
+
+	* cdl/ide_disk.cdl:
+	* src/ide_diskc: Add a configurable startup delay to allow slow
+	disks to initialize. Add support for 8-bit data path. Remove the
+	identity check which are retired in the ATA standard. Optimize the
+	read/write functions.
+
 2006-11-17  Jonathan Larmour  <jifl@eCosCentric.com>
 
 	* src/ide_disk.c (ide_read_sector, ide_write_sector): Length
Index: devs/disk/ide/current/cdl/ide_disk.cdl
===================================================================
RCS file: /cvs/ecos/ecos/packages/devs/disk/ide/current/cdl/ide_disk.cdl,v
retrieving revision 1.1
diff -u -r1.1 ide_disk.cdl
--- devs/disk/ide/current/cdl/ide_disk.cdl	18 Oct 2004 09:03:45 -0000	1.1
+++ devs/disk/ide/current/cdl/ide_disk.cdl	20 Aug 2008 05:16:04 -0000
@@ -55,7 +55,7 @@
     compile     -library=libextras.a   ide_disk.c
     
     cdl_component CYGVAR_DEVS_DISK_IDE_DISK0 {
-    	display         "Provide disk 0 device"
+        display         "Provide disk 0 device"
         flavor          bool
         default_value   1
         description     "IDE chanel 0:0 disk driver"
@@ -63,12 +63,12 @@
         cdl_option CYGDAT_IO_DISK_IDE_DISK0_NAME {
             display       "Device name for disk 0 device"
             flavor        data
-            default_value {"\"/dev/hda/\""}
+            default_value {"\"/dev/idedisk0/\""}
         }
     }
     
     cdl_component CYGVAR_DEVS_DISK_IDE_DISK1 {
-     display         "Provide disk 1 device"
+        display         "Provide disk 1 device"
         flavor          bool
         default_value   0
         description     "IDE chanel 0:1 disk driver"
@@ -76,12 +76,12 @@
         cdl_option CYGDAT_IO_DISK_IDE_DISK1_NAME {
             display       "Device name for disk 1 device"
             flavor        data
-            default_value {"\"/dev/hdb/\""}
+            default_value {"\"/dev/idedisk1/\""}
         }
     }
     
     cdl_component CYGVAR_DEVS_DISK_IDE_DISK2 {
-     display         "Provide disk 2 device"
+        display         "Provide disk 2 device"
         flavor          bool
         default_value   0
         description     "IDE chanel 1:0 disk driver"
@@ -89,12 +89,12 @@
         cdl_option CYGDAT_IO_DISK_IDE_DISK2_NAME {
             display       "Device name for disk 2 device"
             flavor        data
-            default_value {"\"/dev/hdc/\""}
+            default_value {"\"/dev/idedisk2/\""}
         }
     }
     
     cdl_component CYGVAR_DEVS_DISK_IDE_DISK3 {
-     display         "Provide disk 3 device"
+        display         "Provide disk 3 device"
         flavor          bool
         default_value   0
         description     "IDE chanel 1:1 disk driver"
@@ -102,7 +102,7 @@
         cdl_option CYGDAT_IO_DISK_IDE_DISK3_NAME {
             display       "Device name for disk 3 device"
             flavor        data
-            default_value {"\"/dev/hdd/\""}
+            default_value {"\"/dev/idedisk3/\""}
         }
     }
 
@@ -112,7 +112,35 @@
         default_value 512
         description "
         This option controls the disk sector size (default=512)"
-     }
+    }
+
+    cdl_option CYGDAT_DEVS_DISK_IDE_STARTUP_DELAY {
+        display       "Startup delay (in ms)"
+        flavor        data
+        default_value 0
+        description "
+		The amount of time (in ms) to wait for the IDE drives to 
+		initialize on startup. For hard drives, this can usually
+		be set to zero, but for Compact Flash and other solid
+		state media this could be up to 500ms. If drives are not
+		detected at power-up, try increasing this value.
+		"
+    }
+
+    cdl_option CYGDAT_DEVS_DISK_IDE_8_BIT_DATA_PATH {
+        display       "8-bit data path"
+        flavor        bool
+        default_value false
+        description "
+            This allows the host to communicate with the IDE drives using an 
+            8-bit data, rather than 16-bits. It does so by requesting a \"Set
+            Feature\" on the drive for the 8-bit path. Note that this may
+            be ignored by most modern disk drives, but is supported by Compact
+            Flash drives. This is only used by proprietary boards, and should
+	    be disabled for standard IDE controllers.
+        "
+    }
+
 
     cdl_option CYGSEM_DEVS_DISK_IDE_VMWARE {
         display       "Work with VMware virtual disks"
@@ -121,7 +149,6 @@
         description "
         This option controls the disk driver behaviour at ide-init"
      }
-
 }
 
 # EOF ide_disk.cdl
Index: devs/disk/ide/current/src/ide_disk.c
===================================================================
RCS file: /cvs/ecos/ecos/packages/devs/disk/ide/current/src/ide_disk.c,v
retrieving revision 1.4
diff -u -r1.4 ide_disk.c
--- devs/disk/ide/current/src/ide_disk.c	17 Nov 2006 18:04:43 -0000	1.4
+++ devs/disk/ide/current/src/ide_disk.c	20 Aug 2008 05:16:04 -0000
@@ -48,6 +48,7 @@
 //==========================================================================
 
 #include <pkgconf/devs_disk_ide.h>
+#include <pkgconf/io_disk.h>
 
 #include <cyg/infra/cyg_type.h>
 #include <cyg/infra/cyg_ass.h>
@@ -64,7 +65,9 @@
 
 // ----------------------------------------------------------------------------
 
-//#define DEBUG 1
+#ifdef CYGDBG_IO_DISK_DEBUG
+# define DEBUG 1
+#endif
 
 #ifdef DEBUG
 # define D(fmt,args...) diag_printf(fmt, ## args)
@@ -94,6 +97,8 @@
 IDE_DISK_INSTANCE(3, 1, 1, true, CYGDAT_IO_DISK_IDE_DISK3_NAME);
 #endif
 
+#define MIN(a,b) (((a) < (b)) ? (a) : (b))
+
 // ----------------------------------------------------------------------------
 
 static void
@@ -101,8 +106,7 @@
 {
     int i;
 
-    for (i = 0; i < size; i+=2)
-    {
+    for (i=0; i<size; i+=2) {
         *dest++ = (char)(*src >> 8);
         *dest++ = (char)(*src & 0x00FF);
         src++;
@@ -121,7 +125,9 @@
     } while (status & (IDE_STAT_BSY | IDE_STAT_DRQ));
 }
 
+// ----------------------------------------------------------------------------
 // Wait while the device is busy with the last command
+
 static inline int
 __wait_busy(int ctlr)
 {
@@ -137,6 +143,8 @@
     return 0;   
 }
 
+// ----------------------------------------------------------------------------
+
 static inline int
 __wait_for_drq(int ctlr)
 {
@@ -156,18 +164,20 @@
     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++) {
+    for (i = 0; i < HAL_IDE_NUM_CONTROLLERS; i++) {
         sel = (i << 4) | 0xA0;
-        CYGACC_CALL_IF_DELAY_US((cyg_uint32)50000);
+        CYGACC_CALL_IF_DELAY_US(50000U);
         HAL_IDE_WRITE_UINT8(ctlr, IDE_REG_DEVICE, sel);
-        CYGACC_CALL_IF_DELAY_US((cyg_uint32)50000);
+        CYGACC_CALL_IF_DELAY_US(50000U);
         HAL_IDE_READ_UINT8(ctlr, IDE_REG_DEVICE, val);
         if (val == sel) {
 #ifndef CYGSEM_DEVS_DISK_IDE_VMWARE
@@ -180,6 +190,8 @@
     return 0;
 }
 
+// ----------------------------------------------------------------------------
+
 static int
 ide_reset(int ctlr)
 {
@@ -193,14 +205,14 @@
 //
 #ifndef CYGSEM_DEVS_DISK_IDE_VMWARE
     HAL_IDE_WRITE_CONTROL(ctlr, 6);    // polled mode, reset asserted
-    CYGACC_CALL_IF_DELAY_US(5000);
+    CYGACC_CALL_IF_DELAY_US(5000U);
     HAL_IDE_WRITE_CONTROL(ctlr, 2);   // polled mode, reset cleared
-    CYGACC_CALL_IF_DELAY_US((cyg_uint32)50000);
+    CYGACC_CALL_IF_DELAY_US(50000U);
 #endif
 
     // wait 30 seconds max for not busy and drive ready
-    for (delay = 0; delay < 300; ++delay) {
-        CYGACC_CALL_IF_DELAY_US((cyg_uint32)100000);
+    for (delay=0; delay<300; ++delay) {
+        CYGACC_CALL_IF_DELAY_US(100000U);
         HAL_IDE_READ_UINT8(ctlr, IDE_REG_STATUS, status);
             if (!(status & IDE_STAT_BSY)) {
                 if (status & IDE_STAT_DRDY) {
@@ -211,43 +223,76 @@
     return 0;
 }
 
+// ----------------------------------------------------------------------------
+
 static int
 ide_ident(int ctlr, int dev, cyg_uint16 *buf)
 {
     int i;
 
-    if (!__wait_busy(ctlr)) {
+    if (!__wait_busy(ctlr))
          return 0;
-    }
-    
+
     HAL_IDE_WRITE_UINT8(ctlr, IDE_REG_DEVICE, dev << 4);
     HAL_IDE_WRITE_UINT8(ctlr, IDE_REG_COMMAND, 0xEC);
-    CYGACC_CALL_IF_DELAY_US((cyg_uint32)50000);
+    CYGACC_CALL_IF_DELAY_US(50000U);
 
-    if (!__wait_for_drq(ctlr)) {
+    if (!__wait_for_drq(ctlr))
          return 0;
+
+    for (i=0; i<(CYGDAT_DEVS_DISK_IDE_SECTOR_SIZE/sizeof(cyg_uint16)); 
+         i++, buf++) {
+      HAL_IDE_READ_UINT16(ctlr, IDE_REG_DATA, *buf);
     }
+    return 1;
+}
+
+// ----------------------------------------------------------------------------
+// Requests the disk to use an 8-bit data path. This is probably ignored by
+// most modern drives, but is supported by compact flash devices.
+
+#ifdef CYGDAT_DEVS_DISK_IDE_8_BIT_DATA_PATH
+static int
+ide_8bit_mode(int ctlr, int dev, cyg_bool on)
+{
+    cyg_uint8 stat;
+
+    if (!__wait_busy(ctlr))
+         return 0;
     
-    for (i = 0; i < (CYGDAT_DEVS_DISK_IDE_SECTOR_SIZE / sizeof(cyg_uint16));
-         i++, buf++)
-        HAL_IDE_READ_UINT16(ctlr, IDE_REG_DATA, *buf);
+    HAL_IDE_WRITE_UINT8(ctlr, IDE_REG_DEVICE, dev << 4);
+    HAL_IDE_WRITE_UINT8(ctlr, IDE_REG_FEATURES, 0x01);
+    HAL_IDE_WRITE_UINT8(ctlr, IDE_REG_COMMAND,  0xEF);
 
-    return 1;
+    if (!__wait_busy(ctlr))
+        return 0;
+
+    HAL_IDE_READ_UINT8(ctlr, IDE_REG_STATUS, stat);
+    return (stat & 1) ? 0 : 1;
 }
+#endif
+
+// ----------------------------------------------------------------------------
+// Reads a group of contiguous sectors from the drive.
+// It can read up to 256 sectors.
 
 static int
 ide_read_sector(int ctlr, int dev, cyg_uint32 start, 
                 cyg_uint8 *buf, cyg_uint32 len)
 {
-    int j, c;
-    cyg_uint16 p;
-    cyg_uint8 * b=buf;
+    int i, nword;
+    cyg_uint8 lenb;
+    cyg_uint16 w;
 
-    if(!__wait_busy(ctlr)) {
-         return 0;
-    }
-    
-    HAL_IDE_WRITE_UINT8(ctlr, IDE_REG_COUNT, 1);    // count =1
+    if (len==0 || !__wait_busy(ctlr))
+       return 0;
+
+    len = MIN(len, 256);
+    lenb = (len == 256) ? 0 : ((cyg_uint8) len);
+
+    nword = len * CYGDAT_DEVS_DISK_IDE_SECTOR_SIZE / sizeof(cyg_uint16);
+
+    HAL_IDE_WRITE_UINT8(ctlr, IDE_REG_COUNT, lenb);
     HAL_IDE_WRITE_UINT8(ctlr, IDE_REG_LBALOW, start & 0xff);
     HAL_IDE_WRITE_UINT8(ctlr, IDE_REG_LBAMID, (start >>  8) & 0xff);
     HAL_IDE_WRITE_UINT8(ctlr, IDE_REG_LBAHI,  (start >> 16) & 0xff);
@@ -257,52 +302,68 @@
 
     if (!__wait_for_drq(ctlr))
         return 0;
-    // 
-    // It would be fine if all buffers were word aligned,
-    // but who knows
-    //
-    for (j = 0, c=0 ; j < (CYGDAT_DEVS_DISK_IDE_SECTOR_SIZE / sizeof(cyg_uint16));
-         j++) {
-        HAL_IDE_READ_UINT16(ctlr, IDE_REG_DATA, p);
-        if (c++<(len*512)) *b++=p&0xff;
-        if (c++<(len*512)) *b++=(p>>8)&0xff;
+
+    if ((int) buf & 1) {
+        // Unaligned buffer, so split each word manually
+        for (i=0; i<nword; i++) {
+            HAL_IDE_READ_UINT16(ctlr, IDE_REG_DATA, w);
+            *buf++ = w & 0xff;
+            *buf++ = (w>>8) & 0xff;
+        }
     }
-    return 1;
+    else {
+        cyg_uint16* wbuf = (cyg_uint16*) buf;
+        for (i=0; i<nword; i++, wbuf++)
+            HAL_IDE_READ_UINT16(ctlr, IDE_REG_DATA, *wbuf);
+    }
+    return (int) len;
 }
 
+// ----------------------------------------------------------------------------
+// Writes a group of contiguous sectors to the drive.
+// It can write up to 256 sectors.
+
 static int
 ide_write_sector(int ctlr, int dev, cyg_uint32 start, 
-                cyg_uint8 *buf, cyg_uint32 len)
+                 cyg_uint8 *buf, cyg_uint32 len)
 {
-    int j, c;
-    cyg_uint16 p;
-    cyg_uint8 * b=buf;
+    int i, nword;
+    cyg_uint8 lenb;
+    cyg_uint16 w;
 
-    if(!__wait_busy(ctlr)) {
-         return 0;
-    }
-    
-    HAL_IDE_WRITE_UINT8(ctlr, IDE_REG_COUNT, 1);    // count =1
+    if (len==0 || !__wait_busy(ctlr))
+       return 0;
+
+    len = MIN(len, 256);
+    lenb = (len == 256) ? 0 : ((cyg_uint8) len);
+
+    nword = len * CYGDAT_DEVS_DISK_IDE_SECTOR_SIZE / sizeof(cyg_uint16);
+
+    HAL_IDE_WRITE_UINT8(ctlr, IDE_REG_COUNT, lenb);
     HAL_IDE_WRITE_UINT8(ctlr, IDE_REG_LBALOW, start & 0xff);
     HAL_IDE_WRITE_UINT8(ctlr, IDE_REG_LBAMID, (start >>  8) & 0xff);
     HAL_IDE_WRITE_UINT8(ctlr, IDE_REG_LBAHI,  (start >> 16) & 0xff);
     HAL_IDE_WRITE_UINT8(ctlr, IDE_REG_DEVICE,
-          ((start >> 24) & 0xf) | (dev << 4) | 0x40);
+                            ((start >> 24) & 0xf) | (dev << 4) | 0x40);
     HAL_IDE_WRITE_UINT8(ctlr, IDE_REG_COMMAND, 0x30);
 
     if (!__wait_for_drq(ctlr))
         return 0;
-    // 
-    // It would be fine if all buffers were word aligned,
-    // but who knows
-    //
-    for (j = 0, c=0 ; j < (CYGDAT_DEVS_DISK_IDE_SECTOR_SIZE / sizeof(cyg_uint16));
-         j++) {
-        p = (c++<(len*512)) ? *b++ : 0;
-        p |= (c++<(len*512)) ? (*b++<<8) : 0; 
-        HAL_IDE_WRITE_UINT16(ctlr, IDE_REG_DATA, p);
+
+    if ((int) buf & 1) {
+        // Unaligned buffer, so assemble each word manually
+        for (i=0; i<nword; ++i) {
+            w  = *buf++;
+            w |= (cyg_uint16) (*buf++) << 8;
+            HAL_IDE_WRITE_UINT16(ctlr, IDE_REG_DATA, w);
+        }
     }
-    return 1;
+    else {
+        cyg_uint16* wbuf = (cyg_uint16*) buf;
+        for (i=0; i<nword; ++i)
+            HAL_IDE_WRITE_UINT16(ctlr, IDE_REG_DATA, *wbuf++);
+    }
+    return (int) len;
 }
 
 // ----------------------------------------------------------------------------
@@ -328,6 +389,11 @@
         D("No IDE controller for channel %d:%d\n", info->port, info->chan);
         return false;
     }
+
+#if CYGDAT_DEVS_DISK_IDE_STARTUP_DELAY
+    CYGACC_CALL_IF_DELAY_US(CYGDAT_DEVS_DISK_IDE_STARTUP_DELAY*1000U);
+#endif
+
     if (!ide_present[info->port]) {
         ide_present[info->port]=ide_presence_detect(info->port);
         if (!ide_present[info->port]) {
@@ -342,6 +408,13 @@
             return false;
         }
     }
+
+#ifdef CYGDAT_DEVS_DISK_IDE_8_BIT_DATA_PATH
+    if (!ide_8bit_mode(info->port, info->chan, true)) {
+        D("IDE disk %d:%d failed to enter 8-bit mode\n",
+          info->port, info->chan);
+    }
+#endif
     
     D("IDE %d:%d identify drive\n", info->port, info->chan);
     
@@ -350,9 +423,9 @@
         return false;
     }
 
-    id_strcpy(ident.serial, ide_idData->serial,       20);
+    id_strcpy(ident.serial, ide_idData->serial, 20);
     id_strcpy(ident.firmware_rev, ide_idData->firmware_rev, 8);
-    id_strcpy(ident.model_num, ide_idData->model_num,    40);
+    id_strcpy(ident.model_num, ide_idData->model_num, 40);
     
     ident.cylinders_num  = ide_idData->num_cylinders;
     ident.heads_num = ide_idData->num_heads;
@@ -360,6 +433,8 @@
     ident.lba_sectors_num = ide_idData->lba_total_sectors[1] << 16 | 
                             ide_idData->lba_total_sectors[0];
     ident.phys_block_size = 1;
+
+    // TODO: Should this be CYGDAT_DEVS_DISK_IDE_SECTOR_SIZE?
     ident.max_transfer = 512;
     
     D("\tSerial : %s\n", ident.serial);
@@ -367,13 +442,7 @@
     D("\tModel : %s\n", ident.model_num);
     D("\tC/H/S : %d/%d/%d\n", ident.cylinders_num, 
                               ident.heads_num, ident.sectors_num);
-    D("\tKind : %x\n", (ide_idData->general_conf>>8)&0x1f);
 
-    if (((ide_idData->general_conf>>8)&0x1f)!=2) {
-        diag_printf("IDE device %d:%d is not a hard disk!\n",
-                    info->port, info->chan);
-        return false;
-    }
     if (!(chan->callbacks->disk_init)(tab))
         return false;
 
Index: devs/disk/synth/current/ChangeLog
===================================================================
RCS file: /cvs/ecos/ecos/packages/devs/disk/synth/current/ChangeLog,v
retrieving revision 1.3
diff -u -r1.3 ChangeLog
--- devs/disk/synth/current/ChangeLog	21 Sep 2006 16:36:04 -0000	1.3
+++ devs/disk/synth/current/ChangeLog	20 Aug 2008 05:16:04 -0000
@@ -1,3 +1,10 @@
+2008-08-19  Andrew Lunn  <andrew.lunn@ascom.ch>
+
+	* cdl/synthdisk.cdl: Renamed the disk device to /dev/synthdiskX to
+	be unique with respect to other disk drivers. Remove the test
+	configury which is not used anywhere.
+	
+
 2006-02-03  Nick Garnett  <nickg@ecoscentric.com>
 
 	* src/synthdisk.c: Updated to match changes in io/disk package.
Index: devs/disk/synth/current/cdl/synthdisk.cdl
===================================================================
RCS file: /cvs/ecos/ecos/packages/devs/disk/synth/current/cdl/synthdisk.cdl,v
retrieving revision 1.2
diff -u -r1.2 synthdisk.cdl
--- devs/disk/synth/current/cdl/synthdisk.cdl	21 Sep 2006 16:36:04 -0000	1.2
+++ devs/disk/synth/current/cdl/synthdisk.cdl	20 Aug 2008 05:16:04 -0000
@@ -68,7 +68,7 @@
         cdl_option CYGDAT_IO_DISK_ECOSYNTH_DISK0_NAME {
             display       "Device name for ecosynth disk 0 device"
             flavor        data
-            default_value {"\"/dev/hd0/\""}
+            default_value {"\"/dev/synthdisk0/\""}
             description   "This is the device name used to access this
                            device in eCos. Note that the trailing slash
                            character must be present."
@@ -170,48 +170,4 @@
                 the set of global flags if present."
         }
     }
-
-    cdl_component CYGPKG_DEVS_DISK_ECOSYNTH_TESTING {
-        display          "Testing configuration"
-        default_value    1
-        
-        cdl_option CYGDAT_DEVS_DISK_TEST_DEVICE {
-            display      "Test device driver"
-            flavor       data
-            default_value {"\"/dev/hd0/1\"" }
-        }
-
-        cdl_option CYGDAT_DEVS_DISK_TEST_MOUNTPOINT {
-            display      "Test filesystem mountpoint"
-            flavor       data
-            default_value {"\"/dosfs\"" }
-        }
-
-        cdl_option CYGDAT_DEVS_DISK_TEST_DIRECTORY {
-            display      "Test directory on test device"
-            flavor       data
-            default_value {"\"/test\"" }
-        }
-
-        
-        cdl_option CYGDAT_DEVS_DISK_TEST_DEVICE2 {
-            display      "Second Test device driver"
-            flavor       data
-            default_value {"\"/dev/hd0/2\"" }
-        }
-
-        cdl_option CYGDAT_DEVS_DISK_TEST_MOUNTPOINT2 {
-            display      "Second Test filesystem mountpoint"
-            flavor       data
-            default_value {"\"/dosfs2\"" }
-        }
-
-        cdl_option CYGDAT_DEVS_DISK_TEST_DIRECTORY2 {
-            display      "Test directory on second test device"
-            flavor       data
-            default_value {"\"/test\"" }
-        }
-
-    }
-
 }
Index: devs/disk/v85x/edb_v850/current/ChangeLog
===================================================================
RCS file: /cvs/ecos/ecos/packages/devs/disk/v85x/edb_v850/current/ChangeLog,v
retrieving revision 1.3
diff -u -r1.3 ChangeLog
--- devs/disk/v85x/edb_v850/current/ChangeLog	21 Sep 2006 16:35:04 -0000	1.3
+++ devs/disk/v85x/edb_v850/current/ChangeLog	20 Aug 2008 05:16:04 -0000
@@ -1,3 +1,8 @@
+2008-08-19  Andrew Lunn  <andrew.lunn@ascom.ch>
+
+	* cdl/v85x_edb_v850_disk.cdl: Rename the disk device to
+	/dev/v85xdiskX to be unique with respect to other disk drivers.
+	
 2006-09-21  Jonathan Larmour  <jifl@eCosCentric.com>
 
 	* src/v85x_edb_v850_disk.c (cf_disk_init): Provide phys_block_size
Index: devs/disk/v85x/edb_v850/current/cdl/v85x_edb_v850_disk.cdl
===================================================================
RCS file: /cvs/ecos/ecos/packages/devs/disk/v85x/edb_v850/current/cdl/v85x_edb_v850_disk.cdl,v
retrieving revision 1.1
diff -u -r1.1 v85x_edb_v850_disk.cdl
--- devs/disk/v85x/edb_v850/current/cdl/v85x_edb_v850_disk.cdl	19 Jan 2004 14:35:01 -0000	1.1
+++ devs/disk/v85x/edb_v850/current/cdl/v85x_edb_v850_disk.cdl	20 Aug 2008 05:16:04 -0000
@@ -63,7 +63,7 @@
         cdl_option CYGDAT_IO_DISK_V85X_EDB_V850_DISK0_NAME {
             display       "Device name for disk 0 device"
             flavor        data
-            default_value {"\"/dev/disk0/\""}
+            default_value {"\"/dev/v85xdisk0/\""}
         }
     }
 }
Index: fs/fat/current/ChangeLog
===================================================================
RCS file: /cvs/ecos/ecos/packages/fs/fat/current/ChangeLog,v
retrieving revision 1.18
diff -u -r1.18 ChangeLog
--- fs/fat/current/ChangeLog	13 May 2008 17:57:35 -0000	1.18
+++ fs/fat/current/ChangeLog	20 Aug 2008 05:16:04 -0000
@@ -1,6 +1,14 @@
+2008-08-19  Andrew Lunn  <andrew.lunn@ascom.ch>
+
+	* cdl/fatfs.cdl: Add configury for the disk device names to be
+	used for the tests. Default to the synthetic tests, since what
+	seems to be the most used test platform.
+	* doc/README.txt: Updates for the naming scheme.
+	* doc/fat16.ecm: Fit the new naming scheme.
+	
 2008-05-13  Savin Zlobec <savinz@users.sourceforge.net>
 
-	* src/fatfs.c: Fix handling of '.' and '..' nodes in dirsearch. 
+	* src/fatfs.c: Fix handling of '.' and '..' nodes in dirsearch.
 
 2008-04-02  Xinghua Yang <yxinghua@sunnorth.com.cn>
             Andrew Lunn <andrew.lunn@ascom.ch>
Index: fs/fat/current/cdl/fatfs.cdl
===================================================================
RCS file: /cvs/ecos/ecos/packages/fs/fat/current/cdl/fatfs.cdl,v
retrieving revision 1.5
diff -u -r1.5 fatfs.cdl
--- fs/fat/current/cdl/fatfs.cdl	1 May 2008 09:40:55 -0000	1.5
+++ fs/fat/current/cdl/fatfs.cdl	20 Aug 2008 05:16:05 -0000
@@ -126,6 +126,24 @@
     
     # --------------------------------------------------------------------
     
+    cdl_component CYGPKG_DEVS_DISK_TESTING {
+        display          "Testing configuration"
+        default_value    1
+
+        cdl_option CYGDAT_DEVS_DISK_TEST_DEVICE {
+            display      "Test device driver"
+            flavor       data
+            default_value {"\"/dev/synthdisk0/1\"" }
+        }
+
+        cdl_option CYGDAT_DEVS_DISK_TEST_DEVICE2 {
+            display      "Second Test device driver"
+            flavor       data
+            default_value {"\"/dev/synthdisk0/2\"" }
+        }
+
+    }
+
     cdl_option      CYGPKG_FS_FAT_TESTS {
         display         "FAT FS tests"
         flavor          data
Index: fs/fat/current/doc/README.txt
===================================================================
RCS file: /cvs/ecos/ecos/packages/fs/fat/current/doc/README.txt,v
retrieving revision 1.1
diff -u -r1.1 README.txt
--- fs/fat/current/doc/README.txt	19 Jan 2004 14:35:02 -0000	1.1
+++ fs/fat/current/doc/README.txt	20 Aug 2008 05:16:05 -0000
@@ -33,6 +33,8 @@
         device on a platform that is otherwise unsupported. It has not
         been tested.        
 
+and other disk drivers which have been added in the mean time.
+
 In addition the above new packages, FAT support also relies on the
 following existing packages:
 
@@ -62,40 +64,26 @@
 The disk device interface is divided into a generic layer in the
 CYGPKG_IO_DISK package and drivers for each device.
 
-Apart from providing the main API, the other thing that the DISK
-package does is to provide support for disk partitions. It interprets
-the on-disk data structures and provides an independent channel to
-access each partition independently. Partitions are referenced using
-an additional element to the device name. If the device is named
-"/dev/disk0" then "/dev/disk0/1" refers to partition 1, "/dev/disk0/2"
-to partition 2 and so on. If the disk is not partitioned, for example
-a floppy disk, then "/dev/disk0/0" refers to the whole disk.
-
-There are two device drivers currently supported:
-
-Linux Synthetic Driver
-----------------------
-
-This driver treats a disk file on Linux as a disk image and read or
-writes blocks from/to it to simulate disk IO. At present it supports
-just a single disk device image. There are a number of configuration
-options for this device, see the CDL file for details, and the .ecm
-files for examples.
-
-EDB V850 Compact Flash Device
------------------------------
-
-This uses an IDE interface to a Compact Flash device. This is actually
-for a platform that is not supported in the current source tree, so
-cannot be tested. However, it should be possible to adapt the code for
-other devices.
+Each disk driver provides a number of device files. The drivers use a
+naming convention to ensure they are unique. The convention is
+/dev/XXXdiskY/Z. XXX is the name of the device driver, eg ide, mmc,
+synth etc. The DISK packages provide support for disk partitions. They
+interpret the on-disk data structures and provides an independent
+channel to access each partition independently. Partitions are
+referenced using an additional element to the device name. If the
+device is named "/dev/XXXdisk0" then "/dev/XXXdisk0/1" refers to
+partition 1, "/dev/XXXdisk0/2" to partition 2 and so on. If the disk
+is not partitioned, for example a floppy disk, then "/dev/XXXdisk0/0"
+refers to the whole disk.
 
 Testing
 =======
 
 There is currently just one test available for the FAT filesystem,
 fileio1. This test will currently only run on the Linux synthetic
-target and needs a special disk image.
+target and needs a special disk image. However, with some work it
+should be possible to make this test run on other disk drivers, if the
+image can be installed and the configury set appropriately.
 
 To run the test you first need to configure the synthetic disk driver
 to access the disk image. This is most easily done by importing the
Index: fs/fat/current/doc/fat16.ecm
===================================================================
RCS file: /cvs/ecos/ecos/packages/fs/fat/current/doc/fat16.ecm,v
retrieving revision 1.1
diff -u -r1.1 fat16.ecm
--- fs/fat/current/doc/fat16.ecm	19 Jan 2004 14:35:02 -0000	1.1
+++ fs/fat/current/doc/fat16.ecm	20 Aug 2008 05:16:05 -0000
@@ -28,10 +28,6 @@
     user_value   1
 };
 
-cdl_option CYGDAT_IO_DISK_ECOSYNTH_DISK0_NAME {
-    user_value {"/dev/disk0/"}
-};
-
 cdl_option CYGDAT_IO_DISK_ECOSYNTH_DISK0_FILENAME {
     user_value {"/tmp/disk0.img"}
 };
Index: fs/fat/current/doc/fatfd.ecm
===================================================================
RCS file: /cvs/ecos/ecos/packages/fs/fat/current/doc/fatfd.ecm,v
retrieving revision 1.1
diff -u -r1.1 fatfd.ecm
--- fs/fat/current/doc/fatfd.ecm	19 Jan 2004 14:35:02 -0000	1.1
+++ fs/fat/current/doc/fatfd.ecm	20 Aug 2008 05:16:05 -0000
@@ -28,10 +28,6 @@
     user_value   1
 };
 
-cdl_option CYGDAT_IO_DISK_ECOSYNTH_DISK0_NAME {
-    user_value {"/dev/disk0/"}
-};
-
 cdl_option CYGDAT_IO_DISK_ECOSYNTH_DISK0_FILENAME {
     user_value {"/dev/fd0"}
 };
Index: fs/fat/current/src/fatfs_supp.c
===================================================================
RCS file: /cvs/ecos/ecos/packages/fs/fat/current/src/fatfs_supp.c,v
retrieving revision 1.8
diff -u -r1.8 fatfs_supp.c
--- fs/fat/current/src/fatfs_supp.c	13 May 2008 17:57:35 -0000	1.8
+++ fs/fat/current/src/fatfs_supp.c	20 Aug 2008 05:16:06 -0000
@@ -1868,7 +1868,8 @@
         return err;
 
     // Check some known boot record values
-    if (0x29 != boot_rec.ext_sig       ||
+    if (!(0x29 == boot_rec.ext_sig ||
+          0x28 == boot_rec.ext_sig)    ||
         0x55 != boot_rec.exe_marker[0] ||
         0xAA != boot_rec.exe_marker[1])
         return EINVAL;
Index: fs/fat/current/tests/fatfs1.c
===================================================================
RCS file: /cvs/ecos/ecos/packages/fs/fat/current/tests/fatfs1.c,v
retrieving revision 1.5
diff -u -r1.5 fatfs1.c
--- fs/fat/current/tests/fatfs1.c	1 May 2008 09:40:56 -0000	1.5
+++ fs/fat/current/tests/fatfs1.c	20 Aug 2008 05:16:06 -0000
@@ -447,7 +447,7 @@
 
     // --------------------------------------------------------------
 
-    err = mount( "/dev/disk0/1", "/", "fatfs" );    
+    err = mount( CYGDAT_DEVS_DISK_TEST_DEVICE, "/", "fatfs" );    
     if( err < 0 ) SHOW_RESULT( mount, err );    
 
     err = chdir( "/" );
@@ -543,7 +543,7 @@
     if( err < 0 ) SHOW_RESULT( mkdir, err );
 #else
     diag_printf("<INFO>: mount /disk2\n");    
-    err = mount( "/dev/disk0/2", "/disk2", "fatfs" );    
+    err = mount( CYGDAT_DEVS_DISK_TEST_DEVICE2, "/disk2", "fatfs" );    
     if( err < 0 ) SHOW_RESULT( mount, err );    
 #endif
     

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