[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[tyndur-devel] [PATCH 2/4] atapi: Support for transferring more than one sector
This contains not only the modifications to actually split requests by
the block size of 2048, but also included a fix to request.c, which used
packet_size before it was initialised, so that always only a single
block would be transferred.
Cc: cdi-devel@xxxxxxxxxx
Signed-off-by: Kevin Wolf <kevin@xxxxxxxxxx>
---
src/modules/cdi/ata/atapi.c | 9 +++++++--
src/modules/cdi/ata/request.c | 2 +-
2 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/src/modules/cdi/ata/atapi.c b/src/modules/cdi/ata/atapi.c
index eaac06d..b866551 100644
--- a/src/modules/cdi/ata/atapi.c
+++ b/src/modules/cdi/ata/atapi.c
@@ -127,13 +127,18 @@ int atapi_request(struct cdi_scsi_device* scsi,struct cdi_scsi_packet* packet)
.lba = 1,
.ata = 1
},
- .block_count = 1,
- .block_size = packet->bufsize,
+ .block_count = packet->bufsize / 2048,
+ .block_size = 2048,
.blocks_done = 0,
.buffer = packet->buffer,
.error = 0
};
+ if (packet->bufsize < 2048) {
+ rw_request.block_count = 1;
+ rw_request.block_size = packet->bufsize;
+ }
+
// Lesen bzw. Schreiben der Daten
// TODO: DMA
if (packet->direction==CDI_SCSI_READ) ata_protocol_pio_in(&rw_request);
diff --git a/src/modules/cdi/ata/request.c b/src/modules/cdi/ata/request.c
index ff5d479..838f83c 100644
--- a/src/modules/cdi/ata/request.c
+++ b/src/modules/cdi/ata/request.c
@@ -278,7 +278,7 @@ int ata_protocol_pio_in(struct ata_request* request)
// Wenn alle Blocks gelesen wurden ist der Transfer
// abgeschlossen.
return 1;
- } else if (request->flags.ata &&
+ } else if (request->flags.ata && packet_size &&
request->blocks_done*request->block_size>=packet_size)
{
// Wenn alle Bytes des ATAPI-Paketes gelesen wurden
--
2.1.2