#include "ide-types.h"
#include "atapi-types.h"
-#ifndef CONFIG_DEBUG_IDE
+#ifndef V3_CONFIG_DEBUG_IDE
#undef PrintDebug
#define PrintDebug(fmt, args...)
#endif
#include "ata.h"
-#ifdef CONFIG_DEBUG_IDE
+#ifdef V3_CONFIG_DEBUG_IDE
static void print_prd_table(struct ide_internal * ide, struct ide_channel * channel) {
struct ide_dma_prd prd_entry;
int index = 0;
// Read in the data buffer....
// Read a sector/block at a time until the prd entry is full.
-#ifdef CONFIG_DEBUG_IDE
+#ifdef V3_CONFIG_DEBUG_IDE
print_prd_table(ide, channel);
#endif
}
} else {
// This was the final read of the request
+
+ drive->req_len = 0;
channel->status.data_req = 0;
channel->status.ready = 1;
PrintDebug("Attempting to select a non-present drive\n");
channel->error_reg.abort = 1;
channel->status.error = 1;
+ } else {
+ channel->status.busy = 0;
+ channel->status.ready = 1;
+ channel->status.data_req = 0;
+ channel->status.error = 0;
+ channel->status.seek_complete = 1;
+
+ channel->dma_status.active = 0;
+ channel->dma_status.err = 0;
}
break;
return -1;
}
- strncpy(drive->model, model_str, sizeof(drive->model) - 1);
-
+ if (model_str != NULL) {
+ strncpy(drive->model, model_str, sizeof(drive->model) - 1);
+ }
+
if (strcasecmp(type_str, "cdrom") == 0) {
drive->drive_type = BLOCK_CDROM;