[wd2010] display 'number of sectors' for sector R/W ops, display WrLBA in bytes not sectors

Wed, 16 Jan 2013 00:36:51 +0000

author
Philip Pemberton <philpem@philpem.me.uk>
date
Wed, 16 Jan 2013 00:36:51 +0000
changeset 124
ecaec4cfc644
parent 123
82755a8d276e
child 125
7fb4f58f620a

[wd2010] display 'number of sectors' for sector R/W ops, display WrLBA in bytes not sectors

src/wd2010.c file | annotate | diff | revisions
     1.1 diff -r 82755a8d276e -r ecaec4cfc644 src/wd2010.c
     1.2 --- a/src/wd2010.c	Wed Jan 16 00:35:10 2013 +0000
     1.3 +++ b/src/wd2010.c	Wed Jan 16 00:36:51 2013 +0000
     1.4 @@ -341,7 +341,7 @@
     1.5  							break;
     1.6  						case CMD_READ_SECTOR:
     1.7  							/*XXX: does a separate function to set the head have to be added?*/
     1.8 -							LOG("WD2010: READ SECTOR cmd=%02X chs=%d:%d:%d", cmd, ctx->track, ctx->head, ctx->sector);
     1.9 +							LOG("WD2010: READ SECTOR cmd=%02X chs=%d:%d:%d nsectors=%d", cmd, ctx->track, ctx->head, ctx->sector, ctx->sector_count);
    1.10  
    1.11  							// Read Sector
    1.12  
    1.13 @@ -391,8 +391,8 @@
    1.14  						case CMD_WRITE_FORMAT:
    1.15  							ctx->sector = 0;
    1.16  						case CMD_WRITE_SECTOR:
    1.17 -							LOG("WD2010: WRITE SECTOR cmd=%02X chs=%d:%d:%d", cmd, ctx->track, ctx->head, ctx->sector);
    1.18 -							// Read Sector
    1.19 +							LOG("WD2010: WRITE SECTOR cmd=%02X chs=%d:%d:%d nsectors=%d", cmd, ctx->track, ctx->head, ctx->sector, ctx->sector_count);
    1.20 +							// Write Sector
    1.21  
    1.22  							// Check to see if the cyl, hd and sec are valid
    1.23  							if ((ctx->track > (ctx->geom_tracks-1)) || (ctx->head > (ctx->geom_heads-1)) || (ctx->sector > ctx->geom_spt-1)) {
    1.24 @@ -420,8 +420,8 @@
    1.25  							ctx->data_len = ctx->geom_secsz * sector_count;
    1.26  							lba = (((ctx->track * ctx->geom_heads * ctx->geom_spt) + (ctx->head * ctx->geom_spt) + ctx->sector));
    1.27  							// convert LBA to byte address
    1.28 -							ctx->write_pos = lba * ctx->geom_secsz;
    1.29 -							LOG("\tWRITE lba = %lu", lba);
    1.30 +							ctx->write_pos = (lba *= ctx->geom_secsz);
    1.31 +							LOG("\tWRITE lba = %zu", lba);
    1.32  
    1.33  							ctx->status = 0;
    1.34  							ctx->status |= (ctx->data_pos < ctx->data_len) ? SR_DRQ | SR_COMMAND_IN_PROGRESS | SR_BUSY : 0x00;