]> git.kernelconcepts.de Git - karo-tx-redboot.git/blobdiff - packages/devs/disk/ide/v2_0/src/ide_disk.c
unified MX27, MX25, MX37 trees
[karo-tx-redboot.git] / packages / devs / disk / ide / v2_0 / src / ide_disk.c
index 620d414d9d9472f5de1522a504f47a1434d0defb..8b405543a796d8a2eb2d924e075777a8044c6af9 100644 (file)
@@ -9,7 +9,7 @@
 // -------------------------------------------
 // This file is part of eCos, the Embedded Configurable Operating System.
 // Copyright (C) 1998, 1999, 2000, 2001, 2002, 2004 Red Hat, Inc.
-// Copyright (C) 2004 eCosCentric, Ltd.
+// Copyright (C) 2004, 2006 eCosCentric, Ltd.
 //
 // 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
 
 // ----------------------------------------------------------------------------
 
+// No h/w controller structure is needed in this driver, but the address of the
+// second argument is taken anyway.
+DISK_CONTROLLER(ide_disk_controller, ide_disk_controller);
+
 #ifdef CYGVAR_DEVS_DISK_IDE_DISK0
 IDE_DISK_INSTANCE(0, 0, 0, true, CYGDAT_IO_DISK_IDE_DISK0_NAME);
 #endif
@@ -260,8 +264,8 @@ ide_read_sector(int ctlr, int dev, cyg_uint32 start,
     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) *b++=p&0xff;
-        if (c++<len) *b++=(p>>8)&0xff;
+        if (c++<(len*512)) *b++=p&0xff;
+        if (c++<(len*512)) *b++=(p>>8)&0xff;
     }
     return 1;
 }
@@ -294,8 +298,8 @@ ide_write_sector(int ctlr, int dev, cyg_uint32 start,
     //
     for (j = 0, c=0 ; j < (CYGDAT_DEVS_DISK_IDE_SECTOR_SIZE / sizeof(cyg_uint16));
          j++) {
-        p = (c++<len) ? *b++ : 0;
-        p |= (c++<len) ? (*b++<<8) : 0; 
+        p = (c++<(len*512)) ? *b++ : 0;
+        p |= (c++<(len*512)) ? (*b++<<8) : 0; 
         HAL_IDE_WRITE_UINT16(ctlr, IDE_REG_DATA, p);
     }
     return 1;
@@ -355,6 +359,8 @@ ide_disk_init(struct cyg_devtab_entry *tab)
     ident.sectors_num = ide_idData->num_sectors;
     ident.lba_sectors_num = ide_idData->lba_total_sectors[1] << 16 | 
                             ide_idData->lba_total_sectors[0];
+    ident.phys_block_size = 1;
+    ident.max_transfer = 512;
     
     D("\tSerial : %s\n", ident.serial);
     D("\tFirmware rev. : %s\n", ident.firmware_rev);