--- linux-2.4.18-orig/drivers/scsi/constants.c Mon Nov 18 14:13:29 2002 +++ linux-2.4.18/drivers/scsi/constants.c Mon Nov 18 14:10:53 2002 @@ -13,6 +13,7 @@ #include #include "scsi.h" #include "hosts.h" +#include "scsi_evlog.h" #define CONST_COMMAND 0x01 #define CONST_STATUS 0x02 @@ -121,22 +122,22 @@ const char **table = commands[ group(opcode) ]; switch ((unsigned long) table) { case RESERVED_GROUP: - printk("%s(0x%02x) ", reserved, opcode); + EPRINTK("%s(0x%02x) ", reserved, opcode); break; case VENDOR_GROUP: - printk("%s(0x%02x) ", vendor, opcode); + EPRINTK("%s(0x%02x) ", vendor, opcode); break; default: if (table[opcode & 0x1f] != unknown) - printk("%s ",table[opcode & 0x1f]); + EPRINTK("%s ",table[opcode & 0x1f]); else - printk("%s(0x%02x) ", unknown, opcode); + EPRINTK("%s(0x%02x) ", unknown, opcode); break; } } #else /* CONST & CONST_COMMAND */ static void print_opcode(int opcode) { - printk("0x%02x ", opcode); + EPRINTK("0x%02x ", opcode); } #endif @@ -144,8 +145,8 @@ int i,s; print_opcode(command[0]); for ( i = 1, s = COMMAND_SIZE(command[0]); i < s; ++i) - printk("%02x ", command[i]); - printk("\n"); + EPRINTK("%02x ", command[i]); + EPRINTK("\n"); } #if (CONSTANTS & CONST_STATUS) @@ -163,9 +164,9 @@ void print_status (int status) { status = (status >> 1) & 0x1f; #if (CONSTANTS & CONST_STATUS) - printk("%s ",statuses[status]); + EPRINTK("%s ",statuses[status]); #else - printk("0x%0x ", status); + EPRINTK("0x%0x ", status); #endif } @@ -725,22 +726,22 @@ } #if (CONSTANTS & CONST_SENSE) - printk("%s %s: sense error %02x;%02x;%02x %s\n", devclass, + EPRINTK("%s %s: sense error %02x;%02x;%02x %s\n", devclass, kdevname(dev), key, asc, ascq, snstext[key]); /* Check to see if additional sense information is meaningful. */ if (!(asc == 0 && ascq == 0)) { for(i=0; additional[i].text; i++) if(additional[i].code1 == asc && additional[i].code2 == ascq) - printk("Additional sense indicates %s\n", additional[i].text); + EPRINTK("Additional sense indicates %s\n", additional[i].text); for(i=0; additional2[i].text; i++) if(additional2[i].code1 == asc && additional2[i].code2_min >= ascq && additional2[i].code2_max <= ascq) { - printk("Additional sense indicates "); - printk(additional2[i].text, ascq); - printk("\n"); + EPRINTK("Additional sense indicates "); + EPRINTK(additional2[i].text, ascq); + EPRINTK("\n"); }; } @@ -756,10 +757,10 @@ sprintf(bitstr,", Bit #%d is in error.\n", sense_buffer[15] & 0x07); else sprintf(bitstr," is in error.\n"); - printk("%s%s",pstr,bitstr); + EPRINTK("%s%s",pstr,bitstr); } #else - printk("%s %s: sense error, class=%2x Key=%02x ASC=%02x ASCQ=%02x\n", + EPRINTK("%s %s: sense error, class=%2x Key=%02x ASC=%02x ASCQ=%02x\n", devclass, kdevname(dev), sense_buffer[0], sense_buffer[2], asc, ascq); #endif @@ -791,7 +792,7 @@ default: error = "Invalid"; } - printk("%s %s\n",pstr,error); /* show flags & info */ + EPRINTK("%s %s\n",pstr,error); /* show flags & info */ } else { /* non-extended sense data */ @@ -805,29 +806,29 @@ #if (CONSTANTS & CONST_SENSE) if (sense_buffer[0] < 15) - printk("%s%s: old sense key %s\n", devclass, + EPRINTK("%s%s: old sense key %s\n", devclass, kdevname(dev), snstext[sense_buffer[0] & 0x0f]); else #endif - printk("%s%s: sns = %2x %2x\n", devclass, + EPRINTK("%s%s: sns = %2x %2x\n", devclass, kdevname(dev), sense_buffer[0], sense_buffer[2]); - printk("Non-extended sense class %d code 0x%0x\n", sense_class, code); + EPRINTK("Non-extended sense class %d code 0x%0x\n", sense_class, code); s = 4; } done: #if !(CONSTANTS & CONST_SENSE) - printk("Raw sense data: \n"); + EPRINTK("Raw sense data: \n"); error = pstr; *error = 0; for (i = 0; i < s; ++i) { sprintf(error,"%02x ", sense_buffer[i]); if (i > 0 && (i % 16) == 0) { - printk("%s\n",pstr); + EPRINTK("%s\n",pstr); error = pstr; *error = 0; } else error += 3; } - printk("%s\n",pstr); + EPRINTK("%s\n",pstr); #endif return; } @@ -877,79 +878,79 @@ len = 3 + msg[1]; #if (CONSTANTS & CONST_MSG) if (msg[2] < NO_EXTENDED_MSGS) - printk ("%s ", extended_msgs[msg[2]]); + EPRINTK ("%s ", extended_msgs[msg[2]]); else - printk ("Extended Message, reserved code (0x%02x) ", (int) msg[2]); + EPRINTK ("Extended Message, reserved code (0x%02x) ", (int) msg[2]); switch (msg[2]) { case EXTENDED_MODIFY_DATA_POINTER: - printk("pointer = %d", (int) (msg[3] << 24) | (msg[4] << 16) | + EPRINTK("pointer = %d", (int) (msg[3] << 24) | (msg[4] << 16) | (msg[5] << 8) | msg[6]); break; case EXTENDED_SDTR: - printk("period = %d ns, offset = %d", (int) msg[3] * 4, (int) + EPRINTK("period = %d ns, offset = %d", (int) msg[3] * 4, (int) msg[4]); break; case EXTENDED_WDTR: - printk("width = 2^%d bytes", msg[3]); + EPRINTK("width = 2^%d bytes", msg[3]); break; default: for (i = 2; i < len; ++i) - printk("%02x ", msg[i]); + EPRINTK("%02x ", msg[i]); } #else for (i = 0; i < len; ++i) - printk("%02x ", msg[i]); + EPRINTK("%02x ", msg[i]); #endif /* Identify */ } else if (msg[0] & 0x80) { #if (CONSTANTS & CONST_MSG) - printk("Identify disconnect %sallowed %s %d ", + EPRINTK("Identify disconnect %sallowed %s %d ", (msg[0] & 0x40) ? "" : "not ", (msg[0] & 0x20) ? "target routine" : "lun", msg[0] & 0x7); #else - printk("%02x ", msg[0]); + EPRINTK("%02x ", msg[0]); #endif len = 1; /* Normal One byte */ } else if (msg[0] < 0x1f) { #if (CONSTANTS & CONST_MSG) if (msg[0] < NO_ONE_BYTE_MSGS) - printk(one_byte_msgs[msg[0]]); + EPRINTK(one_byte_msgs[msg[0]]); else - printk("reserved (%02x) ", msg[0]); + EPRINTK("reserved (%02x) ", msg[0]); #else - printk("%02x ", msg[0]); + EPRINTK("%02x ", msg[0]); #endif len = 1; /* Two byte */ } else if (msg[0] <= 0x2f) { #if (CONSTANTS & CONST_MSG) if ((msg[0] - 0x20) < NO_TWO_BYTE_MSGS) - printk("%s %02x ", two_byte_msgs[msg[0] - 0x20], + EPRINTK("%s %02x ", two_byte_msgs[msg[0] - 0x20], msg[1]); else - printk("reserved two byte (%02x %02x) ", + EPRINTK("reserved two byte (%02x %02x) ", msg[0], msg[1]); #else - printk("%02x %02x", msg[0], msg[1]); + EPRINTK("%02x %02x", msg[0], msg[1]); #endif len = 2; } else #if (CONSTANTS & CONST_MSG) - printk(reserved); + EPRINTK(reserved); #else - printk("%02x ", msg[0]); + EPRINTK("%02x ", msg[0]); #endif return len; } void print_Scsi_Cmnd (Scsi_Cmnd *cmd) { - printk("scsi%d : destination target %d, lun %d\n", + EPRINTK("scsi%d : destination target %d, lun %d\n", cmd->host->host_no, cmd->target, cmd->lun); - printk(" command = "); + EPRINTK(" command = "); print_command (cmd->cmnd); } @@ -967,16 +968,16 @@ for(i=0;hostbyte_table[i];i++) ; maxcode=i-1; } - printk("Hostbyte=0x%02x",host_byte(scsiresult)); + EPRINTK("Hostbyte=0x%02x",host_byte(scsiresult)); if(host_byte(scsiresult)>maxcode) { - printk("is invalid "); + EPRINTK("is invalid "); return; } - printk("(%s) ",hostbyte_table[host_byte(scsiresult)]); + EPRINTK("(%s) ",hostbyte_table[host_byte(scsiresult)]); } #else void print_hostbyte(int scsiresult) -{ printk("Hostbyte=0x%02x ",host_byte(scsiresult)); +{ EPRINTK("Hostbyte=0x%02x ",host_byte(scsiresult)); } #endif @@ -1001,14 +1002,14 @@ for(i=0;driversuggest_table[i];i++) ; suggest_max=i; } - printk("Driverbyte=0x%02x",driver_byte(scsiresult)); - printk("(%s,%s) ", + EPRINTK("Driverbyte=0x%02x",driver_byte(scsiresult)); + EPRINTK("(%s,%s) ", drname = kmalloc(hname_len + 1, GFP_ATOMIC); @@ -224,7 +225,7 @@ retval->host_self_blocked = FALSE; #ifdef DEBUG - printk("Register %x %x: %d\n", (int)retval, (int)retval->hostt, j); + EPRINTK("Register %x %x: %d\n", (int)retval, (int)retval->hostt, j); #endif /* The next six are the default values which can be overridden --- linux-2.4.18-orig/drivers/scsi/scsi.c Mon Nov 18 14:13:29 2002 +++ linux-2.4.18/drivers/scsi/scsi.c Mon Nov 18 14:09:35 2002 @@ -69,6 +69,7 @@ #include "scsi.h" #include "hosts.h" #include "constants.h" +#include "scsi_evlog.h" #ifdef CONFIG_KMOD #include @@ -206,7 +207,7 @@ scsi_logging_level = (tmp ? ~0 : 0); return 1; } else { - printk(KERN_INFO "scsi_logging_setup : usage scsi_logging_level=n " + EPRINTK(KERN_INFO "scsi_logging_setup : usage scsi_logging_level=n " "(n should be 0 or non-zero)\n"); return 0; } @@ -502,7 +503,7 @@ spin_unlock_irqrestore(&device_request_lock, flags); - SCSI_LOG_MLQUEUE(5, printk("Activating command for device %d (%d)\n", + SCSI_LOG_MLQUEUE(5, EPRINTK("Activating command for device %d (%d)\n", SCpnt->target, atomic_read(&SCpnt->host->host_active))); @@ -524,12 +525,12 @@ atomic_dec(&SCpnt->host->host_active); atomic_dec(&SDpnt->device_active); - SCSI_LOG_MLQUEUE(5, printk("Deactivating command for device %d (active=%d, failed=%d)\n", + SCSI_LOG_MLQUEUE(5, EPRINTK("Deactivating command for device %d (active=%d, failed=%d)\n", SCpnt->target, atomic_read(&SCpnt->host->host_active), SCpnt->host->host_failed)); if (SCpnt->host->host_failed != 0) { - SCSI_LOG_ERROR_RECOVERY(5, printk("Error handler thread %d %d\n", + SCSI_LOG_ERROR_RECOVERY(5, EPRINTK("Error handler thread %d %d\n", SCpnt->host->in_recovery, SCpnt->host->eh_active)); } @@ -540,7 +541,7 @@ if (SCpnt->host->in_recovery && !SCpnt->host->eh_active && SCpnt->host->host_busy == SCpnt->host->host_failed) { - SCSI_LOG_ERROR_RECOVERY(5, printk("Waking error handler thread (%d)\n", + SCSI_LOG_ERROR_RECOVERY(5, EPRINTK("Waking error handler thread (%d)\n", atomic_read(&SCpnt->host->eh_wait->count))); up(SCpnt->host->eh_wait); } @@ -671,7 +672,7 @@ * We will use a queued command if possible, otherwise we will emulate the * queuing and calling of completion function ourselves. */ - SCSI_LOG_MLQUEUE(3, printk("scsi_dispatch_cmnd (host = %d, channel = %d, target = %d, " + SCSI_LOG_MLQUEUE(3, EPRINTK("scsi_dispatch_cmnd (host = %d, channel = %d, target = %d, " "command = %p, buffer = %p, \nbufflen = %d, done = %p)\n", SCpnt->host->host_no, SCpnt->channel, SCpnt->target, SCpnt->cmnd, SCpnt->buffer, SCpnt->bufflen, SCpnt->done)); @@ -679,7 +680,7 @@ SCpnt->state = SCSI_STATE_QUEUED; SCpnt->owner = SCSI_OWNER_LOWLEVEL; if (host->can_queue) { - SCSI_LOG_MLQUEUE(3, printk("queuecommand : routine at %p\n", + SCSI_LOG_MLQUEUE(3, EPRINTK("queuecommand : routine at %p\n", host->hostt->queuecommand)); /* * Use the old error handling code if we haven't converted the driver @@ -698,10 +699,10 @@ if (rtn != 0) { scsi_delete_timer(SCpnt); scsi_mlqueue_insert(SCpnt, SCSI_MLQUEUE_HOST_BUSY); - SCSI_LOG_MLQUEUE(3, printk("queuecommand : request rejected\n")); + SCSI_LOG_MLQUEUE(3, EPRINTK("queuecommand : request rejected\n")); } } else { - SCSI_LOG_MLQUEUE(3, printk("queuecommand : command too long.\n")); + SCSI_LOG_MLQUEUE(3, EPRINTK("queuecommand : command too long.\n")); SCpnt->result = (DID_ABORT << 16); spin_lock_irqsave(&io_request_lock, flags); scsi_done(SCpnt); @@ -718,7 +719,7 @@ host->hostt->queuecommand(SCpnt, scsi_old_done); spin_unlock_irqrestore(&io_request_lock, flags); } else { - SCSI_LOG_MLQUEUE(3, printk("queuecommand : command too long.\n")); + SCSI_LOG_MLQUEUE(3, EPRINTK("queuecommand : command too long.\n")); SCpnt->result = (DID_ABORT << 16); spin_lock_irqsave(&io_request_lock, flags); scsi_old_done(SCpnt); @@ -729,7 +730,7 @@ } else { int temp; - SCSI_LOG_MLQUEUE(3, printk("command() : routine at %p\n", host->hostt->command)); + SCSI_LOG_MLQUEUE(3, EPRINTK("command() : routine at %p\n", host->hostt->command)); spin_lock_irqsave(&io_request_lock, flags); temp = host->hostt->command(SCpnt); SCpnt->result = temp; @@ -740,7 +741,7 @@ barrier(); cpu_relax(); } - printk("done(host = %d, result = %04x) : routine at %p\n", + EPRINTK("done(host = %d, result = %04x) : routine at %p\n", host->host_no, temp, host->hostt->command); spin_lock_irqsave(&io_request_lock, flags); #endif @@ -751,7 +752,7 @@ } spin_unlock_irqrestore(&io_request_lock, flags); } - SCSI_LOG_MLQUEUE(3, printk("leaving scsi_dispatch_cmnd()\n")); + SCSI_LOG_MLQUEUE(3, EPRINTK("leaving scsi_dispatch_cmnd()\n")); return rtn; } @@ -826,14 +827,14 @@ int i; int target = SDpnt->id; int size = COMMAND_SIZE(((const unsigned char *)cmnd)[0]); - printk("scsi_do_req (host = %d, channel = %d target = %d, " + EPRINTK("scsi_do_req (host = %d, channel = %d target = %d, " "buffer =%p, bufflen = %d, done = %p, timeout = %d, " "retries = %d)\n" "command : ", host->host_no, SDpnt->channel, target, buffer, bufflen, done, timeout, retries); for (i = 0; i < size; ++i) - printk("%02x ", ((unsigned char *) cmnd)[i]); - printk("\n"); + EPRINTK("%02x ", ((unsigned char *) cmnd)[i]); + EPRINTK("\n"); }); if (!host) { @@ -885,7 +886,7 @@ */ scsi_insert_special_req(SRpnt, 0); - SCSI_LOG_MLQUEUE(3, printk("Leaving scsi_do_req()\n")); + SCSI_LOG_MLQUEUE(3, EPRINTK("Leaving scsi_do_req()\n")); } /* @@ -971,7 +972,7 @@ SCpnt->abort_reason = 0; SCpnt->result = 0; - SCSI_LOG_MLQUEUE(3, printk("Leaving scsi_init_cmd_from_req()\n")); + SCSI_LOG_MLQUEUE(3, EPRINTK("Leaving scsi_init_cmd_from_req()\n")); } /* @@ -1016,14 +1017,14 @@ int i; int target = SCpnt->target; int size = COMMAND_SIZE(((const unsigned char *)cmnd)[0]); - printk("scsi_do_cmd (host = %d, channel = %d target = %d, " + EPRINTK("scsi_do_cmd (host = %d, channel = %d target = %d, " "buffer =%p, bufflen = %d, done = %p, timeout = %d, " "retries = %d)\n" "command : ", host->host_no, SCpnt->channel, target, buffer, bufflen, done, timeout, retries); for (i = 0; i < size; ++i) - printk("%02x ", ((unsigned char *) cmnd)[i]); - printk("\n"); + EPRINTK("%02x ", ((unsigned char *) cmnd)[i]); + EPRINTK("\n"); }); if (!host) { @@ -1086,7 +1087,7 @@ */ scsi_insert_special_cmd(SCpnt, 0); - SCSI_LOG_MLQUEUE(3, printk("Leaving scsi_do_cmd()\n")); + SCSI_LOG_MLQUEUE(3, EPRINTK("Leaving scsi_do_cmd()\n")); } /* @@ -1149,7 +1150,7 @@ * the test of the return status of del_timer(). */ if (SCpnt->state == SCSI_STATE_TIMEOUT) { - SCSI_LOG_MLCOMPLETE(1, printk("Ignoring completion of %p due to timeout status", SCpnt)); + SCSI_LOG_MLCOMPLETE(1, EPRINTK("Ignoring completion of %p due to timeout status", SCpnt)); return; } spin_lock_irqsave(&scsi_bhqueue_lock, flags); @@ -1238,7 +1239,7 @@ /* * Add to BH queue. */ - SCSI_LOG_MLCOMPLETE(3, printk("Command finished %d %d 0x%x\n", SCpnt->host->host_busy, + SCSI_LOG_MLCOMPLETE(3, EPRINTK("Command finished %d %d 0x%x\n", SCpnt->host->host_busy, SCpnt->host->host_failed, SCpnt->result)); @@ -1251,7 +1252,7 @@ * keeping track of the number of tries, so we don't end up looping, * of course. */ - SCSI_LOG_MLCOMPLETE(3, printk("Command needs retry %d %d 0x%x\n", SCpnt->host->host_busy, + SCSI_LOG_MLCOMPLETE(3, EPRINTK("Command needs retry %d %d 0x%x\n", SCpnt->host->host_busy, SCpnt->host->host_failed, SCpnt->result)); scsi_retry_command(SCpnt); @@ -1265,7 +1266,7 @@ * from being sent to the device, so we shouldn't end up * with tons of things being sent down that shouldn't be. */ - SCSI_LOG_MLCOMPLETE(3, printk("Command rejected as device queue full, put on ml queue %p\n", + SCSI_LOG_MLCOMPLETE(3, EPRINTK("Command rejected as device queue full, put on ml queue %p\n", SCpnt)); scsi_mlqueue_insert(SCpnt, SCSI_MLQUEUE_DEVICE_BUSY); break; @@ -1274,7 +1275,7 @@ * Here we have a fatal error of some sort. Turn it over to * the error handler. */ - SCSI_LOG_MLCOMPLETE(3, printk("Command failed %p %x active=%d busy=%d failed=%d\n", + SCSI_LOG_MLCOMPLETE(3, EPRINTK("Command failed %p %x active=%d busy=%d failed=%d\n", SCpnt, SCpnt->result, atomic_read(&SCpnt->host->host_active), SCpnt->host->host_busy, @@ -1296,7 +1297,7 @@ * command that might have failed. If so, wake up the error handler. */ if (SCpnt->host->host_busy == SCpnt->host->host_failed) { - SCSI_LOG_ERROR_RECOVERY(5, printk("Waking error handler thread (%d)\n", + SCSI_LOG_ERROR_RECOVERY(5, EPRINTK("Waking error handler thread (%d)\n", atomic_read(&SCpnt->host->eh_wait->count))); up(SCpnt->host->eh_wait); } @@ -1390,7 +1391,7 @@ if (scsi_sense_valid(SCpnt)) { SCpnt->result |= (DRIVER_SENSE << 24); } - SCSI_LOG_MLCOMPLETE(3, printk("Notifying upper driver of completion for device %d %x\n", + SCSI_LOG_MLCOMPLETE(3, EPRINTK("Notifying upper driver of completion for device %d %x\n", SCpnt->device->id, SCpnt->result)); SCpnt->owner = SCSI_OWNER_HIGHLEVEL; @@ -1507,7 +1508,7 @@ SCpnt->owner = SCSI_OWNER_NOBODY; } if (j < SDpnt->queue_depth) { /* low on space (D.Gilbert 990424) */ - printk(KERN_WARNING "scsi_build_commandblocks: want=%d, space for=%d blocks\n", + EPRINTK(KERN_WARNING "scsi_build_commandblocks: want=%d, space for=%d blocks\n", SDpnt->queue_depth, j); SDpnt->queue_depth = j; SDpnt->has_cmdblocks = (0 != j); @@ -1706,7 +1707,7 @@ } } - printk(KERN_INFO "scsi logging level set to 0x%8.8x\n", scsi_logging_level); + EPRINTK(KERN_INFO "scsi logging level set to 0x%8.8x\n", scsi_logging_level); } #endif /* CONFIG_SCSI_LOGGING */ /* } */ @@ -1729,7 +1730,7 @@ id = simple_strtoul(p + 1, &p, 0); lun = simple_strtoul(p + 1, &p, 0); - printk(KERN_INFO "scsi singledevice %d %d %d %d\n", host, channel, + EPRINTK(KERN_INFO "scsi singledevice %d %d %d %d\n", host, channel, id, lun); for (HBA_ptr = scsi_hostlist; HBA_ptr; HBA_ptr = HBA_ptr->next) { @@ -1894,7 +1895,7 @@ if (tpnt->present) { if (pcount == next_scsi_host) { if (tpnt->present > 1) { - printk(KERN_ERR "scsi: Failure to register low-level scsi driver"); + EPRINTK(KERN_ERR "scsi: Failure to register low-level scsi driver"); scsi_unregister_host(tpnt); return 1; } @@ -1904,7 +1905,7 @@ */ if(scsi_register(tpnt, 0)==NULL) { - printk(KERN_ERR "scsi: register failed.\n"); + EPRINTK(KERN_ERR "scsi: register failed.\n"); scsi_unregister_host(tpnt); return 1; } @@ -1946,7 +1947,7 @@ } else { name = tpnt->name; } - printk(KERN_INFO "scsi%d : %s\n", /* And print a little message */ + EPRINTK(KERN_INFO "scsi%d : %s\n", /* And print a little message */ shpnt->host_no, name); } } @@ -2005,7 +2006,7 @@ } } #if defined(USE_STATIC_SCSI_MEMORY) - printk("SCSI memory: total %ldKb, used %ldKb, free %ldKb.\n", + EPRINTK("SCSI memory: total %ldKb, used %ldKb, free %ldKb.\n", (scsi_memory_upper_value - scsi_memory_lower_value) / 1024, (scsi_init_memory_start - scsi_memory_lower_value) / 1024, (scsi_memory_upper_value - scsi_init_memory_start) / 1024); @@ -2087,7 +2088,7 @@ online_status = SDpnt->online; SDpnt->online = FALSE; if (SCpnt->request.rq_status != RQ_INACTIVE) { - printk(KERN_ERR "SCSI device not inactive - rq_status=%d, target=%d, pid=%ld, state=%d, owner=%d.\n", + EPRINTK(KERN_ERR "SCSI device not inactive - rq_status=%d, target=%d, pid=%ld, state=%d, owner=%d.\n", SCpnt->request.rq_status, SCpnt->target, SCpnt->pid, SCpnt->state, SCpnt->owner); for (SDpnt1 = shpnt->host_queue; SDpnt1; @@ -2098,7 +2099,7 @@ SCpnt->request.rq_status = RQ_INACTIVE; } SDpnt->online = online_status; - printk(KERN_ERR "Device busy???\n"); + EPRINTK(KERN_ERR "Device busy???\n"); goto err_out; } /* @@ -2124,7 +2125,7 @@ /* If something still attached, punt */ if (SDpnt->attached) { - printk(KERN_ERR "Attached usage count = %d\n", SDpnt->attached); + EPRINTK(KERN_ERR "Attached usage count = %d\n", SDpnt->attached); goto err_out; } devfs_unregister (SDpnt->de); @@ -2205,11 +2206,11 @@ scsi_resize_dma_pool(); if (pcount0 != next_scsi_host) - printk(KERN_INFO "scsi : %d host%s left.\n", next_scsi_host, + EPRINTK(KERN_INFO "scsi : %d host%s left.\n", next_scsi_host, (next_scsi_host == 1) ? "" : "s"); #if defined(USE_STATIC_SCSI_MEMORY) - printk("SCSI memory: total %ldKb, used %ldKb, free %ldKb.\n", + EPRINTK("SCSI memory: total %ldKb, used %ldKb, free %ldKb.\n", (scsi_memory_upper_value - scsi_memory_lower_value) / 1024, (scsi_init_memory_start - scsi_memory_lower_value) / 1024, (scsi_memory_upper_value - scsi_init_memory_start) / 1024); @@ -2458,10 +2459,10 @@ struct Scsi_Host *shpnt; Scsi_Cmnd *SCpnt; Scsi_Device *SDpnt; - printk(KERN_INFO "Dump of scsi host parameters:\n"); + EPRINTK(KERN_INFO "Dump of scsi host parameters:\n"); i = 0; for (shpnt = scsi_hostlist; shpnt; shpnt = shpnt->next) { - printk(KERN_INFO " %d %d %d : %d %d\n", + EPRINTK(KERN_INFO " %d %d %d : %d %d\n", shpnt->host_failed, shpnt->host_busy, atomic_read(&shpnt->host_active), @@ -2469,14 +2470,14 @@ shpnt->host_self_blocked); } - printk(KERN_INFO "\n\n"); - printk(KERN_INFO "Dump of scsi command parameters:\n"); + EPRINTK(KERN_INFO "\n\n"); + EPRINTK(KERN_INFO "Dump of scsi command parameters:\n"); for (shpnt = scsi_hostlist; shpnt; shpnt = shpnt->next) { - printk(KERN_INFO "h:c:t:l (dev sect nsect cnumsec sg) (ret all flg) (to/cmd to ito) cmd snse result\n"); + EPRINTK(KERN_INFO "h:c:t:l (dev sect nsect cnumsec sg) (ret all flg) (to/cmd to ito) cmd snse result\n"); for (SDpnt = shpnt->host_queue; SDpnt; SDpnt = SDpnt->next) { for (SCpnt = SDpnt->device_queue; SCpnt; SCpnt = SCpnt->next) { /* (0) h:c:t:l (dev sect nsect cnumsec sg) (ret all flg) (to/cmd to ito) cmd snse result %d %x */ - printk(KERN_INFO "(%3d) %2d:%1d:%2d:%2d (%6s %4ld %4ld %4ld %4x %1d) (%1d %1d 0x%2x) (%4d %4d %4d) 0x%2.2x 0x%2.2x 0x%8.8x\n", + EPRINTK(KERN_INFO "(%3d) %2d:%1d:%2d:%2d (%6s %4ld %4ld %4ld %4x %1d) (%1d %1d 0x%2x) (%4d %4d %4d) 0x%2.2x 0x%2.2x 0x%8.8x\n", i++, SCpnt->host->host_no, @@ -2509,7 +2510,7 @@ for (shpnt = scsi_hostlist; shpnt; shpnt = shpnt->next) { for (SDpnt = shpnt->host_queue; SDpnt; SDpnt = SDpnt->next) { /* Now dump the request lists for each block device */ - printk(KERN_INFO "Dump of pending block device requests\n"); + EPRINTK(KERN_INFO "Dump of pending block device requests\n"); for (i = 0; i < MAX_BLKDEV; i++) { struct list_head * queue_head; @@ -2518,18 +2519,18 @@ struct request *req; struct list_head * entry; - printk(KERN_INFO "%d: ", i); + EPRINTK(KERN_INFO "%d: ", i); entry = queue_head->next; do { req = blkdev_entry_to_request(entry); - printk("(%s %d %ld %ld %ld) ", + EPRINTK("(%s %d %ld %ld %ld) ", kdevname(req->rq_dev), req->cmd, req->sector, req->nr_sectors, req->current_nr_sectors); } while ((entry = entry->next) != queue_head); - printk("\n"); + EPRINTK("\n"); } } } @@ -2578,7 +2579,7 @@ { struct proc_dir_entry *generic; - printk(KERN_INFO "SCSI subsystem driver " REVISION "\n"); + EPRINTK(KERN_INFO "SCSI subsystem driver " REVISION "\n"); if( scsi_init_minimal_dma_pool() != 0 ) { @@ -2591,12 +2592,12 @@ #ifdef CONFIG_PROC_FS proc_scsi = proc_mkdir("scsi", 0); if (!proc_scsi) { - printk (KERN_ERR "cannot init /proc/scsi\n"); + EPRINTK (KERN_ERR "cannot init /proc/scsi\n"); return -ENOMEM; } generic = create_proc_info_entry ("scsi/scsi", 0, 0, scsi_proc_info); if (!generic) { - printk (KERN_ERR "cannot init /proc/scsi/scsi\n"); + EPRINTK (KERN_ERR "cannot init /proc/scsi/scsi\n"); remove_proc_entry("scsi", 0); return -ENOMEM; } @@ -2605,7 +2606,7 @@ scsi_devfs_handle = devfs_mk_dir (NULL, "scsi", NULL); if (scsihosts) - printk(KERN_INFO "scsi: host order: %s\n", scsihosts); + EPRINTK(KERN_INFO "scsi: host order: %s\n", scsihosts); scsi_host_no_init (scsihosts); /* * This is where the processing takes place for most everything --- linux-2.4.18-orig/drivers/scsi/scsi_dma.c Mon Feb 25 14:38:04 2002 +++ linux-2.4.18/drivers/scsi/scsi_dma.c Mon Nov 18 14:09:35 2002 @@ -14,6 +14,7 @@ #include "scsi.h" #include "hosts.h" #include "constants.h" +#include "scsi_evlog.h" #ifdef CONFIG_KMOD #include @@ -89,8 +90,8 @@ dma_malloc_freelist[i] |= (mask << j); scsi_dma_free_sectors -= nbits; #ifdef DEBUG - SCSI_LOG_MLQUEUE(3, printk("SMalloc: %d %p [From:%p]\n", len, dma_malloc_pages[i] + (j << 9))); - printk("SMalloc: %d %p [From:%p]\n", len, dma_malloc_pages[i] + (j << 9)); + SCSI_LOG_MLQUEUE(3, EPRINTK("SMalloc: %d %p [From:%p]\n", len, dma_malloc_pages[i] + (j << 9))); + EPRINTK("SMalloc: %d %p [From:%p]\n", len, dma_malloc_pages[i] + (j << 9)); #endif spin_unlock_irqrestore(&allocator_request_lock, flags); return (void *) ((unsigned long) dma_malloc_pages[i] + (j << 9)); @@ -132,8 +133,8 @@ #else ret = __builtin_return_address(0); #endif - printk("scsi_free %p %d\n", obj, len); - SCSI_LOG_MLQUEUE(3, printk("SFree: %p %d\n", obj, len)); + EPRINTK("scsi_free %p %d\n", obj, len); + SCSI_LOG_MLQUEUE(3, EPRINTK("SFree: %p %d\n", obj, len)); #endif spin_lock_irqsave(&allocator_request_lock, flags); @@ -153,7 +154,7 @@ if ((dma_malloc_freelist[page] & (mask << sector)) != (mask << sector)) { #ifdef DEBUG - printk("scsi_free(obj=%p, len=%d) called from %08lx\n", + EPRINTK("scsi_free(obj=%p, len=%d) called from %08lx\n", obj, len, ret); #endif panic("scsi_free:Trying to free unused memory"); @@ -267,7 +268,7 @@ new_dma_sectors += (4096 >> 9) * SDpnt->queue_depth; } else { if (SDpnt->type != TYPE_TAPE) { - printk("resize_dma_pool: unknown device type %d\n", SDpnt->type); + EPRINTK("resize_dma_pool: unknown device type %d\n", SDpnt->type); new_dma_sectors += (4096 >> 9) * SDpnt->queue_depth; } } @@ -283,7 +284,7 @@ } #ifdef DEBUG_INIT - printk("resize_dma_pool: needed dma sectors = %d\n", new_dma_sectors); + EPRINTK("resize_dma_pool: needed dma sectors = %d\n", new_dma_sectors); #endif /* limit DMA memory to 32MB: */ @@ -343,7 +344,7 @@ } } if (out_of_space) { /* try scaling down new_dma_sectors request */ - printk("scsi::resize_dma_pool: WARNING, dma_sectors=%u, " + EPRINTK("scsi::resize_dma_pool: WARNING, dma_sectors=%u, " "wanted=%u, scaling\n", dma_sectors, new_dma_sectors); if (new_dma_sectors < (8 * SECTORS_PER_PAGE)) break; /* pretty well hopeless ... */ @@ -357,7 +358,7 @@ if (out_of_space) { spin_unlock_irqrestore(&allocator_request_lock, flags); scsi_need_isa_buffer = new_need_isa_buffer; /* some useful info */ - printk(" WARNING, not enough memory, pool not expanded\n"); + EPRINTK(" WARNING, not enough memory, pool not expanded\n"); return; } /* When we dick with the actual DMA list, we need to @@ -383,9 +384,9 @@ spin_unlock_irqrestore(&allocator_request_lock, flags); #ifdef DEBUG_INIT - printk("resize_dma_pool: dma free sectors = %d\n", scsi_dma_free_sectors); - printk("resize_dma_pool: dma sectors = %d\n", dma_sectors); - printk("resize_dma_pool: need isa buffers = %d\n", scsi_need_isa_buffer); + EPRINTK("resize_dma_pool: dma free sectors = %d\n", scsi_dma_free_sectors); + EPRINTK("resize_dma_pool: dma sectors = %d\n", dma_sectors); + EPRINTK("resize_dma_pool: need isa buffers = %d\n", scsi_need_isa_buffer); #endif } @@ -442,7 +443,7 @@ kfree((char *) dma_malloc_pages); } spin_unlock_irqrestore(&allocator_request_lock, flags); - printk("scsi::init_module: failed, out of memory\n"); + EPRINTK("scsi::init_module: failed, out of memory\n"); return 1; } --- linux-2.4.18-orig/drivers/scsi/scsi_error.c Mon Nov 18 14:13:29 2002 +++ linux-2.4.18/drivers/scsi/scsi_error.c Mon Nov 18 14:09:35 2002 @@ -34,6 +34,7 @@ #include "scsi.h" #include "hosts.h" #include "constants.h" +#include "scsi_evlog.h" /* * We must always allow SHUTDOWN_SIGS. Even if we are not a module, @@ -125,7 +126,7 @@ SCset->done_late = 0; - SCSI_LOG_ERROR_RECOVERY(5, printk("Adding timer for command %p at %d (%p)\n", SCset, timeout, complete)); + SCSI_LOG_ERROR_RECOVERY(5, EPRINTK("Adding timer for command %p at %d (%p)\n", SCset, timeout, complete)); add_timer(&SCset->eh_timeout); @@ -150,7 +151,7 @@ rtn = del_timer(&SCset->eh_timeout); - SCSI_LOG_ERROR_RECOVERY(5, printk("Clearing timer for command %p %d\n", SCset, rtn)); + SCSI_LOG_ERROR_RECOVERY(5, EPRINTK("Clearing timer for command %p %d\n", SCset, rtn)); SCset->eh_timeout.data = (unsigned long) NULL; SCset->eh_timeout.function = NULL; @@ -222,7 +223,7 @@ SCpnt->host->host_failed++; SCpnt->device->sdev_timeouts++; - SCSI_LOG_TIMEOUT(3, printk("Command timed out active=%d busy=%d failed=%d\n", + SCSI_LOG_TIMEOUT(3, EPRINTK("Command timed out active=%d busy=%d failed=%d\n", atomic_read(&SCpnt->host->host_active), SCpnt->host->host_busy, SCpnt->host->host_failed)); @@ -259,7 +260,7 @@ SCSI_SLEEP(&SDpnt->host->host_wait, SDpnt->host->in_recovery); - SCSI_LOG_ERROR_RECOVERY(5, printk("Open returning %d\n", SDpnt->online)); + SCSI_LOG_ERROR_RECOVERY(5, EPRINTK("Open returning %d\n", SDpnt->online)); return SDpnt->online; } @@ -282,12 +283,12 @@ void scsi_eh_times_out(Scsi_Cmnd * SCpnt) { SCpnt->eh_state = SCSI_STATE_TIMEOUT; - SCSI_LOG_ERROR_RECOVERY(5, printk("In scsi_eh_times_out %p\n", SCpnt)); + SCSI_LOG_ERROR_RECOVERY(5, EPRINTK("In scsi_eh_times_out %p\n", SCpnt)); if (SCpnt->host->eh_action != NULL) up(SCpnt->host->eh_action); else - printk("Missing scsi error handler thread\n"); + EPRINTK("Missing scsi error handler thread\n"); } @@ -327,7 +328,7 @@ SCpnt->owner = SCSI_OWNER_ERROR_HANDLER; SCpnt->eh_state = SUCCESS; - SCSI_LOG_ERROR_RECOVERY(5, printk("In eh_done %p result:%x\n", SCpnt, + SCSI_LOG_ERROR_RECOVERY(5, EPRINTK("In eh_done %p result:%x\n", SCpnt, SCpnt->result)); if (SCpnt->host->eh_action != NULL) @@ -436,7 +437,7 @@ ? &scsi_result0[0] : kmalloc(512, GFP_ATOMIC | GFP_DMA); if (scsi_result == NULL) { - printk("cannot allocate scsi_result in scsi_request_sense.\n"); + EPRINTK("cannot allocate scsi_result in scsi_request_sense.\n"); return FAILED; } /* @@ -536,7 +537,7 @@ * Hey, we are done. Let's look to see what happened. */ SCSI_LOG_ERROR_RECOVERY(3, - printk("scsi_test_unit_ready: SCpnt %p eh_state %x\n", + EPRINTK("scsi_test_unit_ready: SCpnt %p eh_state %x\n", SCpnt, SCpnt->eh_state)); return SCpnt->eh_state; } @@ -564,7 +565,7 @@ timer.expires = jiffies + timeout; timer.function = (void (*)(unsigned long)) scsi_sleep_done; - SCSI_LOG_ERROR_RECOVERY(5, printk("Sleeping for timer tics %d\n", timeout)); + SCSI_LOG_ERROR_RECOVERY(5, EPRINTK("Sleeping for timer tics %d\n", timeout)); add_timer(&timer); @@ -645,7 +646,7 @@ SCpnt->eh_state = FAILED; } - SCSI_LOG_ERROR_RECOVERY(5, printk("send_eh_cmnd: %p eh_state:%x\n", + SCSI_LOG_ERROR_RECOVERY(5, EPRINTK("send_eh_cmnd: %p eh_state:%x\n", SCpnt, SCpnt->eh_state)); } else { int temp; @@ -656,7 +657,7 @@ * level driver, we don't know how to wake it up. */ SCSI_LOG_ERROR_RECOVERY(5, - printk("send_eh_cmnd: cant queue, %p eh_state:%x\n", + EPRINTK("send_eh_cmnd: cant queue, %p eh_state:%x\n", SCpnt, SCpnt->eh_state)); spin_lock_irqsave(&io_request_lock, flags); temp = host->hostt->command(SCpnt); @@ -674,7 +675,7 @@ if (SCpnt->eh_state == SUCCESS) { int ret = scsi_eh_completed_normally(SCpnt); SCSI_LOG_ERROR_RECOVERY(3, - printk("scsi_send_eh_cmnd: scsi_eh_completed_normally %x\n", ret)); + EPRINTK("scsi_send_eh_cmnd: scsi_eh_completed_normally %x\n", ret)); switch (ret) { case SUCCESS: SCpnt->eh_state = SUCCESS; @@ -966,7 +967,7 @@ * up to the top level. */ if (SCpnt->device->online == FALSE) { - SCSI_LOG_ERROR_RECOVERY(5, printk("scsi_error.c: device offline - report as SUCCESS\n")); + SCSI_LOG_ERROR_RECOVERY(5, EPRINTK("scsi_error.c: device offline - report as SUCCESS\n")); return SUCCESS; } /* @@ -1271,7 +1272,7 @@ * requests for character device operations, and also for ioctls to queued * block devices. */ - SCSI_LOG_ERROR_RECOVERY(5, printk("scsi_error.c: Waking up host to restart\n")); + SCSI_LOG_ERROR_RECOVERY(5, EPRINTK("scsi_error.c: Waking up host to restart\n")); wake_up(&host->host_wait); @@ -1365,7 +1366,7 @@ * the command block will eventually be freed, and the other one is that * the command will be queued and will be finished along the way. */ - SCSI_LOG_ERROR_RECOVERY(1, printk("Error handler prematurely woken - commands still active (%p %x %d)\n", SCpnt, SCpnt->state, SCpnt->target)); + SCSI_LOG_ERROR_RECOVERY(1, EPRINTK("Error handler prematurely woken - commands still active (%p %x %d)\n", SCpnt, SCpnt->state, SCpnt->target)); /* * panic("SCSI Error handler woken too early\n"); @@ -1397,20 +1398,20 @@ * On second thought, this is probably a good idea. We *really* want to give * authors an incentive to automatically request this. */ - SCSI_LOG_ERROR_RECOVERY(3, printk("scsi_unjam_host: Checking to see if we need to request sense\n")); + SCSI_LOG_ERROR_RECOVERY(3, EPRINTK("scsi_unjam_host: Checking to see if we need to request sense\n")); for (SDpnt = host->host_queue; SDpnt; SDpnt = SDpnt->next) { for (SCpnt = SDpnt->device_queue; SCpnt; SCpnt = SCpnt->next) { if (SCpnt->state != SCSI_STATE_FAILED || scsi_sense_valid(SCpnt)) { continue; } - SCSI_LOG_ERROR_RECOVERY(2, printk("scsi_unjam_host: Requesting sense for %d\n", + SCSI_LOG_ERROR_RECOVERY(2, EPRINTK("scsi_unjam_host: Requesting sense for %d\n", SCpnt->target)); rtn = scsi_request_sense(SCpnt); if (rtn != SUCCESS) { continue; } - SCSI_LOG_ERROR_RECOVERY(3, printk("Sense requested for %p - result %x\n", + SCSI_LOG_ERROR_RECOVERY(3, EPRINTK("Sense requested for %p - result %x\n", SCpnt, SCpnt->result)); SCSI_LOG_ERROR_RECOVERY(3, print_sense("bh", SCpnt)); @@ -1459,13 +1460,13 @@ for (SCpnt = SDpnt->device_queue; SCpnt; SCpnt = SCpnt->next) { if (SCpnt->state == SCSI_STATE_FAILED) { - SCSI_LOG_ERROR_RECOVERY(5, printk("Command to ID %d failed\n", + SCSI_LOG_ERROR_RECOVERY(5, EPRINTK("Command to ID %d failed\n", SCpnt->target)); numfailed++; device_error++; } if (SCpnt->state == SCSI_STATE_TIMEOUT) { - SCSI_LOG_ERROR_RECOVERY(5, printk("Command to ID %d timedout\n", + SCSI_LOG_ERROR_RECOVERY(5, EPRINTK("Command to ID %d timedout\n", SCpnt->target)); timed_out++; device_error++; @@ -1476,7 +1477,7 @@ } } - SCSI_LOG_ERROR_RECOVERY(2, printk("Total of %d+%d commands on %d devices require eh work\n", + SCSI_LOG_ERROR_RECOVERY(2, EPRINTK("Total of %d+%d commands on %d devices require eh work\n", numfailed, timed_out, devices_failed)); if (host->host_failed == 0) { @@ -1491,7 +1492,7 @@ * host adapter is concerned, it isn't running. */ - SCSI_LOG_ERROR_RECOVERY(3, printk("scsi_unjam_host: Checking to see if we want to try abort\n")); + SCSI_LOG_ERROR_RECOVERY(3, EPRINTK("scsi_unjam_host: Checking to see if we want to try abort\n")); for (SDpnt = host->host_queue; SDpnt; SDpnt = SDpnt->next) { for (SCloop = SDpnt->device_queue; SCloop; SCloop = SCloop->next) { @@ -1531,7 +1532,7 @@ * Does this make sense - should we try BDR on each device individually? * Yes, definitely. */ - SCSI_LOG_ERROR_RECOVERY(3, printk("scsi_unjam_host: Checking to see if we want to try BDR\n")); + SCSI_LOG_ERROR_RECOVERY(3, EPRINTK("scsi_unjam_host: Checking to see if we want to try BDR\n")); for (SDpnt = host->host_queue; SDpnt; SDpnt = SDpnt->next) { for (SCloop = SDpnt->device_queue; SCloop; SCloop = SCloop->next) { @@ -1579,7 +1580,7 @@ * to try is a full bus reset. If someone has grabbed the bus and isn't * letting go, then perhaps this will help. */ - SCSI_LOG_ERROR_RECOVERY(3, printk("scsi_unjam_host: Try hard bus reset\n")); + SCSI_LOG_ERROR_RECOVERY(3, EPRINTK("scsi_unjam_host: Try hard bus reset\n")); /* * We really want to loop over the various channels, and do this on @@ -1664,7 +1665,7 @@ * FIXME(eric) - is this really the correct thing to do? */ if (rtn != SUCCESS) { - printk(KERN_INFO "scsi: device set offline - not ready or command retry failed after bus reset: host %d channel %d id %d lun %d\n", SDloop->host->host_no, SDloop->channel, SDloop->id, SDloop->lun); + EPRINTK(KERN_INFO "scsi: device set offline - not ready or command retry failed after bus reset: host %d channel %d id %d lun %d\n", SDloop->host->host_no, SDloop->channel, SDloop->id, SDloop->lun); SDloop->online = FALSE; SDloop->host->host_failed--; @@ -1714,7 +1715,7 @@ * through to the 'take device offline' case. */ SCSI_LOG_ERROR_RECOVERY(3, - printk("scsi_unjam_host: Unable to try hard host reset\n")); + EPRINTK("scsi_unjam_host: Unable to try hard host reset\n")); /* * Due to the spinlock, we will never get out of this @@ -1724,7 +1725,7 @@ goto next_device2; } - SCSI_LOG_ERROR_RECOVERY(3, printk("scsi_unjam_host: Try hard host reset\n")); + SCSI_LOG_ERROR_RECOVERY(3, EPRINTK("scsi_unjam_host: Try hard host reset\n")); /* * FIXME(eric) - we need to obtain a valid SCpnt to perform this call. @@ -1760,7 +1761,7 @@ } } if (rtn != SUCCESS) { - printk(KERN_INFO "scsi: device set offline - not ready or command retry failed after host reset: host %d channel %d id %d lun %d\n", SDloop->host->host_no, SDloop->channel, SDloop->id, SDloop->lun); + EPRINTK(KERN_INFO "scsi: device set offline - not ready or command retry failed after host reset: host %d channel %d id %d lun %d\n", SDloop->host->host_no, SDloop->channel, SDloop->id, SDloop->lun); SDloop->online = FALSE; SDloop->host->host_failed--; scsi_eh_finish_command(&SCdone, SCloop); @@ -1784,14 +1785,14 @@ * easier to simply take the devices offline that correspond to commands * that failed. */ - SCSI_LOG_ERROR_RECOVERY(1, printk("scsi_unjam_host: Take device offline\n")); + SCSI_LOG_ERROR_RECOVERY(1, EPRINTK("scsi_unjam_host: Take device offline\n")); for (SDpnt = host->host_queue; SDpnt; SDpnt = SDpnt->next) { for (SCloop = SDpnt->device_queue; SCloop; SCloop = SCloop->next) { if (SCloop->state == SCSI_STATE_FAILED || SCloop->state == SCSI_STATE_TIMEOUT) { SDloop = SCloop->device; if (SDloop->online == TRUE) { - printk(KERN_INFO "scsi: device set offline - command error recover failed: host %d channel %d id %d lun %d\n", SDloop->host->host_no, SDloop->channel, SDloop->id, SDloop->lun); + EPRINTK(KERN_INFO "scsi: device set offline - command error recover failed: host %d channel %d id %d lun %d\n", SDloop->host->host_no, SDloop->channel, SDloop->id, SDloop->lun); SDloop->online = FALSE; } @@ -1804,7 +1805,7 @@ if (SCloop->state == SCSI_STATE_TIMEOUT) { SCloop->result |= (DRIVER_TIMEOUT << 24); } - SCSI_LOG_ERROR_RECOVERY(3, printk("Finishing command for device %d %x\n", + SCSI_LOG_ERROR_RECOVERY(3, EPRINTK("Finishing command for device %d %x\n", SDloop->id, SCloop->result)); scsi_eh_finish_command(&SCdone, SCloop); @@ -1815,7 +1816,7 @@ if (host->host_failed != 0) { panic("scsi_unjam_host: Miscount of number of failed commands.\n"); } - SCSI_LOG_ERROR_RECOVERY(3, printk("scsi_unjam_host: Returning\n")); + SCSI_LOG_ERROR_RECOVERY(3, EPRINTK("scsi_unjam_host: Returning\n")); ourrtn = FALSE; @@ -1917,7 +1918,7 @@ /* * Wake up the thread that created us. */ - SCSI_LOG_ERROR_RECOVERY(3, printk("Wake up parent %d\n", host->eh_notify->count.counter)); + SCSI_LOG_ERROR_RECOVERY(3, EPRINTK("Wake up parent %d\n", host->eh_notify->count.counter)); up(host->eh_notify); @@ -1927,7 +1928,7 @@ * away and die. This typically happens if the user is * trying to unload a module. */ - SCSI_LOG_ERROR_RECOVERY(1, printk("Error handler sleeping\n")); + SCSI_LOG_ERROR_RECOVERY(1, EPRINTK("Error handler sleeping\n")); /* * Note - we always use down_interruptible with the semaphore @@ -1944,7 +1945,7 @@ break; } - SCSI_LOG_ERROR_RECOVERY(1, printk("Error handler waking up\n")); + SCSI_LOG_ERROR_RECOVERY(1, EPRINTK("Error handler waking up\n")); host->eh_active = 1; @@ -1972,7 +1973,7 @@ } - SCSI_LOG_ERROR_RECOVERY(1, printk("Error handler exiting\n")); + SCSI_LOG_ERROR_RECOVERY(1, EPRINTK("Error handler exiting\n")); /* * Make sure that nobody tries to wake us up again. --- /dev/null Fri Mar 23 23:37:44 2001 +++ linux-2.4.18/drivers/scsi/scsi_evlog.h Mon Nov 18 14:09:35 2002 @@ -0,0 +1,25 @@ +/* + * scsi_evlog.h + * Define the EPRINTK macro for scsi event log kernel messages. + */ + +#ifdef CONFIG_EVLOG +/* Use POSIX Event Log function instead of printk, if configured. */ +#include +#define LOG_AIC7XXX 1001 /* event ids */ +#define LOG_SCSIMOD 1011 +#define LOG_RAIDMD 1021 +static inline int +evl_xlate_ksev(const char *kstr) +{ + int n; + if (kstr == NULL) n = LOG_INFO; + else { n = kstr[1] - '0'; /* assumes "" prefix */ + if (n > 7) n = LOG_INFO; } + return (n); +} +#define EPRINTK(fmt, ...) (evl_xlate_ksev(fmt) >= LOG_INFO ? printk(fmt, ## __VA_ARGS__) : posix_log_printf(LOG_KERN, LOG_SCSIMOD, evl_xlate_ksev(fmt), 0, fmt, ## __VA_ARGS__)) +#else +#define EPRINTK printk +#endif /* CONFIG_EVLOG */ + --- linux-2.4.18-orig/drivers/scsi/scsi_ioctl.c Wed Aug 15 04:22:16 2001 +++ linux-2.4.18/drivers/scsi/scsi_ioctl.c Mon Nov 18 14:09:35 2002 @@ -22,6 +22,7 @@ #include #include "scsi.h" #include "hosts.h" +#include "scsi_evlog.h" #include #define NORMAL_RETRIES 5 @@ -98,16 +99,16 @@ Scsi_Device *SDpnt; - SCSI_LOG_IOCTL(1, printk("Trying ioctl with scsi command %d\n", cmd[0])); + SCSI_LOG_IOCTL(1, EPRINTK("Trying ioctl with scsi command %d\n", cmd[0])); if (NULL == (SRpnt = scsi_allocate_request(dev))) { - printk("SCSI internal ioctl failed, no memory\n"); + EPRINTK("SCSI internal ioctl failed, no memory\n"); return -ENOMEM; } SRpnt->sr_data_direction = SCSI_DATA_NONE; scsi_wait_req(SRpnt, cmd, NULL, 0, timeout, retries); - SCSI_LOG_IOCTL(2, printk("Ioctl returned 0x%x\n", SRpnt->sr_result)); + SCSI_LOG_IOCTL(2, EPRINTK("Ioctl returned 0x%x\n", SRpnt->sr_result)); if (driver_byte(SRpnt->sr_result) != 0) switch (SRpnt->sr_sense_buffer[2] & 0xf) { @@ -115,11 +116,11 @@ if (cmd[0] == ALLOW_MEDIUM_REMOVAL) dev->lockable = 0; else - printk("SCSI device (ioctl) reports ILLEGAL REQUEST.\n"); + EPRINTK("SCSI device (ioctl) reports ILLEGAL REQUEST.\n"); break; case NOT_READY: /* This happens if there is no disc in drive */ if (dev->removable && (cmd[0] != TEST_UNIT_READY)) { - printk(KERN_INFO "Device not ready. Make sure there is a disc in the drive.\n"); + EPRINTK(KERN_INFO "Device not ready. Make sure there is a disc in the drive.\n"); break; } case UNIT_ATTENTION: @@ -127,16 +128,16 @@ dev->changed = 1; SRpnt->sr_result = 0; /* This is no longer considered an error */ /* gag this error, VFS will log it anyway /axboe */ - /* printk(KERN_INFO "Disc change detected.\n"); */ + /* EPRINTK(KERN_INFO "Disc change detected.\n"); */ break; }; default: /* Fall through for non-removable media */ - printk("SCSI error: host %d id %d lun %d return code = %x\n", + EPRINTK("SCSI error: host %d id %d lun %d return code = %x\n", dev->host->host_no, dev->id, dev->lun, SRpnt->sr_result); - printk("\tSense class %x, sense error %x, extended sense %x\n", + EPRINTK("\tSense class %x, sense error %x, extended sense %x\n", sense_class(SRpnt->sr_sense_buffer[0]), sense_error(SRpnt->sr_sense_buffer[0]), SRpnt->sr_sense_buffer[2] & 0xf); @@ -145,7 +146,7 @@ result = SRpnt->sr_result; - SCSI_LOG_IOCTL(2, printk("IOCTL Releasing command\n")); + SCSI_LOG_IOCTL(2, EPRINTK("IOCTL Releasing command\n")); SDpnt = SRpnt->sr_device; scsi_release_request(SRpnt); SRpnt = NULL; @@ -348,16 +349,16 @@ #else { int i; - printk("scsi_ioctl : device %d. command = ", dev->id); + EPRINTK("scsi_ioctl : device %d. command = ", dev->id); for (i = 0; i < cmdlen; ++i) printk("%02x ", cmd[i]); printk("\nbuffer ="); for (i = 0; i < 20; ++i) printk("%02x ", buf[i]); printk("\n"); - printk("inlen = %d, outlen = %d, cmdlen = %d\n", + EPRINTK("inlen = %d, outlen = %d, cmdlen = %d\n", inlen, outlen, cmdlen); - printk("buffer = %d, cmd_in = %d\n", buffer, cmd_in); + EPRINTK("buffer = %d, cmd_in = %d\n", buffer, cmd_in); } return 0; #endif --- linux-2.4.18-orig/drivers/scsi/scsi_lib.c Mon Nov 18 14:13:29 2002 +++ linux-2.4.18/drivers/scsi/scsi_lib.c Mon Nov 18 14:09:35 2002 @@ -47,6 +47,7 @@ #include "scsi.h" #include "hosts.h" #include "constants.h" +#include "scsi_evlog.h" #include /* @@ -372,7 +373,7 @@ req = &SCpnt->request; req->errors = 0; if (!uptodate) { - printk(" I/O error: dev %s, sector %lu\n", + EPRINTK(" I/O error: dev %s, sector %lu\n", kdevname(req->rq_dev), req->sector); } do { @@ -392,7 +393,7 @@ req->current_nr_sectors = bh->b_size >> 9; if (req->nr_sectors < req->current_nr_sectors) { req->nr_sectors = req->current_nr_sectors; - printk("scsi_end_request: buffer-list destroyed\n"); + EPRINTK("scsi_end_request: buffer-list destroyed\n"); } } } @@ -616,10 +617,10 @@ * handle. */ if (good_sectors > 0) { - SCSI_LOG_HLCOMPLETE(1, printk("%ld sectors total, %d sectors done.\n", + SCSI_LOG_HLCOMPLETE(1, EPRINTK("%ld sectors total, %d sectors done.\n", SCpnt->request.nr_sectors, good_sectors)); - SCSI_LOG_HLCOMPLETE(1, printk("use_sg is %d\n ", SCpnt->use_sg)); + SCSI_LOG_HLCOMPLETE(1, EPRINTK("use_sg is %d\n ", SCpnt->use_sg)); SCpnt->request.errors = 0; /* @@ -717,14 +718,14 @@ } break; case NOT_READY: - printk(KERN_INFO "Device %s not ready.\n", + EPRINTK(KERN_INFO "Device %s not ready.\n", kdevname(SCpnt->request.rq_dev)); SCpnt = scsi_end_request(SCpnt, 0, this_count); return; break; case MEDIUM_ERROR: case VOLUME_OVERFLOW: - printk("scsi%d: ERROR on channel %d, id %d, lun %d, CDB: ", + EPRINTK("scsi%d: ERROR on channel %d, id %d, lun %d, CDB: ", SCpnt->host->host_no, (int) SCpnt->channel, (int) SCpnt->target, (int) SCpnt->lun); print_command(SCpnt->cmnd); @@ -748,7 +749,7 @@ struct Scsi_Device_Template *STpnt; STpnt = scsi_get_request_dev(&SCpnt->request); - printk("SCSI %s error : (scsi%d:%d:%d:%d), sense %x:%x:%x, return code = %x\n", + EPRINTK("SCSI %s error : (scsi%d:%d:%d:%d), sense %x:%x:%x, return code = %x\n", (STpnt ? STpnt->name : "device"), SCpnt->device->host->host_no, SCpnt->device->channel, @@ -882,7 +883,7 @@ if (sdtpnt->finish && sdtpnt->nr_dev) (*sdtpnt->finish) (); } - printk("scsi_rescan: %d new devices added\n",new_dev); + EPRINTK("scsi_rescan: %d new devices added\n",new_dev); } /*end scsi_rescan*/ #endif @@ -1266,7 +1267,7 @@ } if (SHpnt->init_done == 1 && SHpnt->need_scan == 0) { SHpnt->need_scan = 1; - printk("scsi_report_bus_reset: scsi%d, channel %d need_scan\n", + EPRINTK("scsi_report_bus_reset: scsi%d, channel %d need_scan\n", SHpnt->host_no,channel); } } --- linux-2.4.18-orig/drivers/scsi/scsi_merge.c Mon Nov 18 14:13:29 2002 +++ linux-2.4.18/drivers/scsi/scsi_merge.c Mon Nov 18 14:09:35 2002 @@ -61,6 +61,7 @@ #include "scsi.h" #include "hosts.h" #include "constants.h" +#include "scsi_evlog.h" #include /* @@ -87,12 +88,12 @@ * Dump the information that we have. We know we have an * inconsistency. */ - printk("nr_segments is %x\n", req->nr_segments); - printk("counted segments is %x\n", segments); - printk("Flags %d %d\n", use_clustering, dma_host); + EPRINTK("nr_segments is %x\n", req->nr_segments); + EPRINTK("counted segments is %x\n", segments); + EPRINTK("Flags %d %d\n", use_clustering, dma_host); for (bh = req->bh; bh->b_reqnext != NULL; bh = bh->b_reqnext) { - printk("Segment 0x%p, blocks %d, addr 0x%lx\n", + EPRINTK("Segment 0x%p, blocks %d, addr 0x%lx\n", bh, bh->b_size >> 9, virt_to_phys(bh->b_data - 1)); @@ -109,7 +110,7 @@ #define SANITY_CHECK(req, _CLUSTER, _DMA) \ if( req->nr_segments != __count_segments(req, _CLUSTER, _DMA, NULL) ) \ { \ - printk("Incorrect segment count at 0x%p", current_text_addr()); \ + EPRINTK("Incorrect segment count at 0x%p", current_text_addr()); \ dump_stats(req, _CLUSTER, _DMA, __count_segments(req, _CLUSTER, _DMA, NULL)); \ } #else @@ -130,15 +131,15 @@ * Now print out a bunch of stats. First, start with the request * size. */ - printk("dma_free_sectors:%d\n", scsi_dma_free_sectors); - printk("use_sg:%d\ti:%d\n", SCpnt->use_sg, i); - printk("request_bufflen:%d\n", SCpnt->request_bufflen); + EPRINTK("dma_free_sectors:%d\n", scsi_dma_free_sectors); + EPRINTK("use_sg:%d\ti:%d\n", SCpnt->use_sg, i); + EPRINTK("request_bufflen:%d\n", SCpnt->request_bufflen); /* * Now dump the scatter-gather table, up to the point of failure. */ for(jj=0; jj < SCpnt->use_sg; jj++) { - printk("[%d]\tlen:%d\taddr:%p\tbounce:%p\n", + EPRINTK("[%d]\tlen:%d\taddr:%p\tbounce:%p\n", jj, sgpnt[jj].length, sgpnt[jj].address, @@ -146,7 +147,7 @@ if (bbpnt && bbpnt[jj]) consumed += sgpnt[jj].length; } - printk("Total %d sectors consumed\n", consumed); + EPRINTK("Total %d sectors consumed\n", consumed); panic("DMA pool exhausted"); } @@ -879,7 +880,7 @@ * If we cannot allocate the scatter-gather table, then * simply write the first buffer all by itself. */ - printk("Warning - running *really* short on DMA buffers\n"); + EPRINTK("Warning - running *really* short on DMA buffers\n"); this_count = SCpnt->request.current_nr_sectors; goto single_segment; } @@ -948,7 +949,7 @@ * Verify that the count is correct. */ if (count != SCpnt->use_sg) { - printk("Incorrect number of segments after building list\n"); + EPRINTK("Incorrect number of segments after building list\n"); #ifdef CONFIG_SCSI_DEBUG_QUEUES dump_stats(req, use_clustering, dma_host, count); #endif @@ -990,7 +991,7 @@ * buffer, then queue just what we have done so far. */ if (sgpnt[i].address == NULL) { - printk("Warning - running low on DMA memory\n"); + EPRINTK("Warning - running low on DMA memory\n"); SCpnt->request_bufflen -= sgpnt[i].length; SCpnt->use_sg = i; if (i == 0) { @@ -1083,7 +1084,7 @@ + (this_count << 9) - 1 > ISA_DMA_THRESHOLD) { buff = (char *) scsi_malloc(this_count << 9); if (!buff) { - printk("Warning - running low on DMA memory\n"); + EPRINTK("Warning - running low on DMA memory\n"); this_count = SCpnt->request.current_nr_sectors; buff = (char *) scsi_malloc(this_count << 9); if (!buff) { --- linux-2.4.18-orig/drivers/scsi/scsi_obsolete.c Mon Nov 18 14:13:29 2002 +++ linux-2.4.18/drivers/scsi/scsi_obsolete.c Mon Nov 18 14:09:35 2002 @@ -67,6 +67,7 @@ #include "scsi.h" #include "hosts.h" #include "constants.h" +#include "scsi_evlog.h" #undef USE_STATIC_SCSI_MEMORY @@ -163,7 +164,7 @@ if (!scsi_abort(SCpnt, DID_TIME_OUT)) break; case IN_ABORT: - printk("SCSI host %d abort (pid %ld) timed out - resetting\n", + EPRINTK("SCSI host %d abort (pid %ld) timed out - resetting\n", SCpnt->host->host_no, SCpnt->pid); if (!scsi_reset(SCpnt, SCSI_RESET_ASYNCHRONOUS)) break; @@ -173,7 +174,7 @@ * you might conceivably want the machine up and running * esp if you have an ide disk. */ - printk("SCSI host %d channel %d reset (pid %ld) timed out - " + EPRINTK("SCSI host %d channel %d reset (pid %ld) timed out - " "trying harder\n", SCpnt->host->host_no, SCpnt->channel, SCpnt->pid); SCpnt->internal_timeout &= ~IN_RESET; @@ -187,7 +188,7 @@ * Let's try even harder and call for an HBA reset. * Maybe the HBA itself crashed and this will shake it loose. */ - printk("SCSI host %d reset (pid %ld) timed out - trying to shake it loose\n", + EPRINTK("SCSI host %d reset (pid %ld) timed out - trying to shake it loose\n", SCpnt->host->host_no, SCpnt->pid); SCpnt->internal_timeout &= ~(IN_RESET | IN_RESET2); SCpnt->internal_timeout |= IN_RESET3; @@ -196,9 +197,9 @@ break; default: - printk("SCSI host %d reset (pid %ld) timed out again -\n", + EPRINTK("SCSI host %d reset (pid %ld) timed out again -\n", SCpnt->host->host_no, SCpnt->pid); - printk("probably an unrecoverable SCSI bus or device hang.\n"); + EPRINTK("probably an unrecoverable SCSI bus or device hang.\n"); break; } @@ -261,9 +262,9 @@ SCpnt->flags &= ~ASKED_FOR_SENSE; #ifdef DEBUG_INIT - printk("scsi%d, channel%d : ", SCpnt->host->host_no, SCpnt->channel); + EPRINTK("scsi%d, channel%d : ", SCpnt->host->host_no, SCpnt->channel); print_sense("", SCpnt); - printk("\n"); + EPRINTK("\n"); #endif if (SCpnt->sense_buffer[2] & 0xe0) return SUGGEST_ABORT; @@ -342,7 +343,7 @@ #ifdef DEBUG_TIMEOUT if (result) - printk("Non-zero result in scsi_done %x %d:%d\n", + EPRINTK("Non-zero result in scsi_done %x %d:%d\n", result, SCpnt->target, SCpnt->lun); #endif @@ -360,7 +361,7 @@ #define PENDING 4 #ifdef DEBUG - printk("In scsi_done(host = %d, result = %06x)\n", host->host_no, result); + EPRINTK("In scsi_done(host = %d, result = %06x)\n", host->host_no, result); #endif if (SCpnt->flags & SYNC_RESET) { @@ -370,7 +371,7 @@ * must not do that any more. In order to prevent old drivers from * crashing, all scsi_done() calls during sync resets are ignored. */ - printk("scsi%d: device driver called scsi_done() " + EPRINTK("scsi%d: device driver called scsi_done() " "for a synchronous reset.\n", SCpnt->host->host_no); return; } @@ -391,7 +392,7 @@ #endif if (!(SCpnt->flags & WAS_RESET)) { - printk("scsi%d : channel %d target %d lun %d request sense" + EPRINTK("scsi%d : channel %d target %d lun %d request sense" " failed, performing reset.\n", SCpnt->host->host_no, SCpnt->channel, SCpnt->target, SCpnt->lun); @@ -409,7 +410,7 @@ case GOOD: if (SCpnt->flags & WAS_SENSE) { #ifdef DEBUG - printk("In scsi_done, GOOD status, COMMAND COMPLETE, " + EPRINTK("In scsi_done, GOOD status, COMMAND COMPLETE, " "parsing sense information.\n"); #endif SCpnt->flags &= ~WAS_SENSE; @@ -421,7 +422,7 @@ case SUGGEST_SENSE: case 0: #ifdef DEBUG - printk("NO SENSE. status = REDO\n"); + EPRINTK("NO SENSE. status = REDO\n"); #endif update_timeout(SCpnt, oldto); status = REDO; @@ -430,34 +431,34 @@ break; case SUGGEST_REMAP: #ifdef DEBUG - printk("SENSE SUGGEST REMAP - status = CMD_FINISHED\n"); + EPRINTK("SENSE SUGGEST REMAP - status = CMD_FINISHED\n"); #endif status = CMD_FINISHED; exit = DRIVER_SENSE | SUGGEST_ABORT; break; case SUGGEST_RETRY: #ifdef DEBUG - printk("SENSE SUGGEST RETRY - status = MAYREDO\n"); + EPRINTK("SENSE SUGGEST RETRY - status = MAYREDO\n"); #endif status = MAYREDO; exit = DRIVER_SENSE | SUGGEST_RETRY; break; case SUGGEST_ABORT: #ifdef DEBUG - printk("SENSE SUGGEST ABORT - status = CMD_FINISHED"); + EPRINTK("SENSE SUGGEST ABORT - status = CMD_FINISHED"); #endif status = CMD_FINISHED; exit = DRIVER_SENSE | SUGGEST_ABORT; break; default: - printk("Internal error %s %d \n", __FILE__, + EPRINTK("Internal error %s %d \n", __FILE__, __LINE__); } } /* end WAS_SENSE */ else { #ifdef DEBUG - printk("COMMAND COMPLETE message returned, " + EPRINTK("COMMAND COMPLETE message returned, " "status = CMD_FINISHED. \n"); #endif exit = DRIVER_OK; @@ -503,13 +504,13 @@ break; case RESERVATION_CONFLICT: - printk("scsi%d, channel %d : RESERVATION CONFLICT performing" + EPRINTK("scsi%d, channel %d : RESERVATION CONFLICT performing" " reset.\n", SCpnt->host->host_no, SCpnt->channel); scsi_reset(SCpnt, SCSI_RESET_SYNCHRONOUS); status = REDO; break; default: - printk("Internal error %s %d \n" + EPRINTK("Internal error %s %d \n" "status byte = %d \n", __FILE__, __LINE__, status_byte(result)); @@ -522,12 +523,12 @@ break; case DID_TIME_OUT: #ifdef DEBUG - printk("Host returned DID_TIME_OUT - "); + EPRINTK("Host returned DID_TIME_OUT - "); #endif if (SCpnt->flags & WAS_TIMEDOUT) { #ifdef DEBUG - printk("Aborting\n"); + EPRINTK("Aborting\n"); #endif /* Allow TEST_UNIT_READY and INQUIRY commands to timeout early @@ -539,7 +540,7 @@ exit = (DRIVER_TIMEOUT | SUGGEST_ABORT); } else { #ifdef DEBUG - printk("Retrying.\n"); + EPRINTK("Retrying.\n"); #endif SCpnt->flags |= WAS_TIMEDOUT; SCpnt->internal_timeout &= ~IN_ABORT; @@ -552,7 +553,7 @@ break; case DID_NO_CONNECT: #ifdef DEBUG - printk("Couldn't connect.\n"); + EPRINTK("Couldn't connect.\n"); #endif exit = (DRIVER_HARD | SUGGEST_ABORT); break; @@ -606,14 +607,14 @@ break; case MAYREDO: #ifdef DEBUG - printk("In MAYREDO, allowing %d retries, have %d\n", + EPRINTK("In MAYREDO, allowing %d retries, have %d\n", SCpnt->allowed, SCpnt->retries); #endif if ((++SCpnt->retries) < SCpnt->allowed) { if ((SCpnt->retries >= (SCpnt->allowed >> 1)) && !(SCpnt->host->resetting && time_before(jiffies, SCpnt->host->last_reset + MIN_RESET_PERIOD)) && !(SCpnt->flags & WAS_RESET)) { - printk("scsi%d channel %d : resetting for second half of retries.\n", + EPRINTK("scsi%d channel %d : resetting for second half of retries.\n", SCpnt->host->host_no, SCpnt->channel); scsi_reset(SCpnt, SCSI_RESET_SYNCHRONOUS); /* fall through to REDO */ @@ -658,7 +659,7 @@ if (status == CMD_FINISHED) { Scsi_Request *SRpnt; #ifdef DEBUG - printk("Calling done function - at address %p\n", SCpnt->done); + EPRINTK("Calling done function - at address %p\n", SCpnt->done); #endif host->host_busy--; /* Indicate that we are free */ device->device_busy--; /* Decrement device usage counter. */ @@ -737,7 +738,7 @@ /* OK, this command must have died when we did the * reset. The device itself must have lied. */ - printk("Stale command on %d %d:%d appears to have died when" + EPRINTK("Stale command on %d %d:%d appears to have died when" " the bus was reset\n", SCpnt->channel, SCpnt->target, SCpnt->lun); } @@ -746,7 +747,7 @@ update_timeout(SCpnt, oldto); return 0; } - printk("scsi : aborting command due to timeout : pid %lu, scsi%d," + EPRINTK("scsi : aborting command due to timeout : pid %lu, scsi%d," " channel %d, id %d, lun %d ", SCpnt->pid, SCpnt->host->host_no, (int) SCpnt->channel, (int) SCpnt->target, (int) SCpnt->lun); @@ -847,7 +848,7 @@ Scsi_Device *SDpnt; struct Scsi_Host *host = SCpnt->host; - printk("SCSI bus is being reset for host %d channel %d.\n", + EPRINTK("SCSI bus is being reset for host %d channel %d.\n", host->host_no, SCpnt->channel); #if 0 @@ -974,7 +975,7 @@ SCpnt->flags &= ~SYNC_RESET; #ifdef DEBUG - printk("scsi reset function returned %d\n", temp); + EPRINTK("scsi reset function returned %d\n", temp); #endif /* --- linux-2.4.18-orig/drivers/scsi/scsi_queue.c Fri Feb 9 14:30:23 2001 +++ linux-2.4.18/drivers/scsi/scsi_queue.c Mon Nov 18 14:09:35 2002 @@ -36,6 +36,7 @@ #include "scsi.h" #include "hosts.h" #include "constants.h" +#include "scsi_evlog.h" /* * TODO: @@ -81,7 +82,7 @@ struct Scsi_Host *host; unsigned long flags; - SCSI_LOG_MLQUEUE(1, printk("Inserting command %p into mlqueue\n", cmd)); + SCSI_LOG_MLQUEUE(1, EPRINTK("Inserting command %p into mlqueue\n", cmd)); /* * We are inserting the command into the ml queue. First, we --- linux-2.4.18-orig/drivers/scsi/scsi_scan.c Mon Nov 18 14:13:29 2002 +++ linux-2.4.18/drivers/scsi/scsi_scan.c Mon Nov 18 14:09:35 2002 @@ -18,6 +18,7 @@ #include "scsi.h" #include "hosts.h" #include "constants.h" +#include "scsi_evlog.h" #ifdef CONFIG_KMOD #include @@ -194,7 +195,7 @@ max_scsi_luns = tmp; return 1; } else { - printk("scsi_luns_setup : usage max_scsi_luns=n " + EPRINTK("scsi_luns_setup : usage max_scsi_luns=n " "(n should be between 1 and 2^32-1)\n"); return 0; } @@ -206,53 +207,62 @@ static void print_inquiry(unsigned char *data) { - int i; + int i, n; + char pbuf[100]; - printk(" Vendor: "); + strcpy(pbuf," Vendor: "); + n = strlen(pbuf); for (i = 8; i < 16; i++) { if (data[i] >= 0x20 && i < data[4] + 5) - printk("%c", data[i]); + pbuf[n++] = data[i]; else - printk(" "); + pbuf[n++] = ' '; } + pbuf[n] = 0; - printk(" Model: "); + strcat(pbuf," Model: "); + n = strlen(pbuf); for (i = 16; i < 32; i++) { if (data[i] >= 0x20 && i < data[4] + 5) - printk("%c", data[i]); + pbuf[n++] = data[i]; else - printk(" "); + pbuf[n++] = ' '; } + pbuf[n] = 0; - printk(" Rev: "); + strcat(pbuf," Rev: "); + n = strlen(pbuf); for (i = 32; i < 36; i++) { if (data[i] >= 0x20 && i < data[4] + 5) - printk("%c", data[i]); + pbuf[n++] = data[i]; else - printk(" "); + pbuf[n++] = ' '; } + pbuf[n] = 0; if ((data[0] & 0x1f) == 0) { /* if type == disk */ - printk(" Ser#: "); + strcat(pbuf," Ser#: "); + n = strlen(pbuf); for (i = 36; i < 44; i++) { if (data[i] >= 0x20 && i < data[4] + 5) - printk("%c", data[i]); - else - printk(" "); + pbuf[n++] = data[i]; + else + pbuf[n++] = ' '; } + pbuf[n] = 0; } - printk("\n"); + EPRINTK("%s\n",pbuf); i = data[0] & 0x1f; - printk(" Type: %s ", + sprintf(pbuf," Type: %s ", i < MAX_SCSI_DEVICE_CODE ? scsi_device_types[i] : "Unknown "); - printk(" ANSI SCSI revision: %02x", data[2] & 0x07); + n = strlen(pbuf); + sprintf(&pbuf[n]," ANSI SCSI revision: %02x", data[2] & 0x07); if ((data[2] & 0x07) == 1 && (data[3] & 0x0f) == 1) - printk(" CCS\n"); - else - printk("\n"); + strcat(pbuf," CCS"); + EPRINTK("%s\n",pbuf); } static int get_device_flags(unsigned char *response_data) @@ -346,7 +356,7 @@ } if (scsi_result == NULL) { - printk("Unable to obtain scsi_result buffer\n"); + EPRINTK("Unable to obtain scsi_result buffer\n"); goto leave; } /* @@ -423,7 +433,7 @@ if (oldSDpnt->attached) { scsi_build_commandblocks(oldSDpnt); if (0 == oldSDpnt->has_cmdblocks) { - printk("scan_scsis: DANGER, no command blocks\n"); + EPRINTK("scan_scsis: DANGER, no command blocks\n"); /* What to do now ?? */ } } @@ -545,7 +555,7 @@ int scsi_level; if (SDpnt == NULL) { - printk("scan_scsis_single: SDpnt = NULL\n"); + EPRINTK("scan_scsis_single: SDpnt = NULL\n"); return 0; } SDpnt->host = shpnt; @@ -569,7 +579,7 @@ SDpnt->starved = 0; if (NULL == (SRpnt = scsi_allocate_request(SDpnt))) { - printk("scan_scsis_single: no memory\n"); + EPRINTK("scan_scsis_single: no memory\n"); return 0; } @@ -700,7 +710,7 @@ SDpnt->writeable = 0; break; default: - printk("scsi: unknown type %d\n", type); + EPRINTK("scsi: unknown type %d\n", type); } SDpnt->device_blocked = FALSE; @@ -722,7 +732,7 @@ sprintf (devname, "host%d/bus%d/target%d/lun%d", SDpnt->host->host_no, SDpnt->channel, SDpnt->id, SDpnt->lun); - if (SDpnt->de) printk ("DEBUG: dir: \"%s\" already exists\n", devname); + if (SDpnt->de) EPRINTK ("DEBUG: dir: \"%s\" already exists\n", devname); else SDpnt->de = devfs_mk_dir (scsi_devfs_handle, devname, NULL); for (sdtpnt = scsi_devicelist; sdtpnt; @@ -779,7 +789,7 @@ * These devices need this "key" to unlock the devices so we can use it */ if ((bflags & BLIST_KEY) != 0) { - printk("Unlocked floptical drive.\n"); + EPRINTK("Unlocked floptical drive.\n"); SDpnt->lockable = 0; scsi_cmd[0] = MODE_SENSE; if (shpnt->max_lun <= 8) @@ -808,7 +818,7 @@ */ SDpnt = (Scsi_Device *) kmalloc(sizeof(Scsi_Device), GFP_ATOMIC); if (!SDpnt) { - printk("scsi: scan_scsis_single: Cannot malloc\n"); + EPRINTK("scsi: scan_scsis_single: Cannot malloc\n"); return 0; } memset(SDpnt, 0, sizeof(Scsi_Device)); --- linux-2.4.18-orig/drivers/scsi/sd.c Mon Feb 25 14:38:04 2002 +++ linux-2.4.18/drivers/scsi/sd.c Mon Nov 18 14:09:35 2002 @@ -57,6 +57,7 @@ #include "sd.h" #include #include "constants.h" +#include "scsi_evlog.h" #include /* must follow "hosts.h" */ #include @@ -335,7 +336,7 @@ */ if (dpnt->device->sector_size == 1024) { if ((block & 1) || (SCpnt->request.nr_sectors & 1)) { - printk("sd.c:Bad block number requested"); + EPRINTK("sd.c:Bad block number requested"); return 0; } else { block = block >> 1; @@ -344,7 +345,7 @@ } if (dpnt->device->sector_size == 2048) { if ((block & 3) || (SCpnt->request.nr_sectors & 3)) { - printk("sd.c:Bad block number requested"); + EPRINTK("sd.c:Bad block number requested"); return 0; } else { block = block >> 2; @@ -353,7 +354,7 @@ } if (dpnt->device->sector_size == 4096) { if ((block & 7) || (SCpnt->request.nr_sectors & 7)) { - printk("sd.c:Bad block number requested"); + EPRINTK("sd.c:Bad block number requested"); return 0; } else { block = block >> 3; @@ -376,7 +377,7 @@ panic("Unknown sd command %d\n", SCpnt->request.cmd); } - SCSI_LOG_HLQUEUE(2, printk("%s : %s %d/%ld 512 byte blocks.\n", + SCSI_LOG_HLQUEUE(2, EPRINTK("%s : %s %d/%ld 512 byte blocks.\n", nbuff, (SCpnt->request.cmd == WRITE) ? "writing" : "reading", this_count, SCpnt->request.nr_sectors)); @@ -681,7 +682,7 @@ SDev = rscsi_disks[target].device; if (target >= sd_template.dev_max || !SDev) { - printk("SCSI disk request error: invalid device.\n"); + EPRINTK("SCSI disk request error: invalid device.\n"); return 0; } if (!SDev->removable) @@ -765,13 +766,13 @@ SRpnt = scsi_allocate_request(rscsi_disks[i].device); if (!SRpnt) { - printk(KERN_WARNING "(sd_init_onedisk:) Request allocation failure.\n"); + EPRINTK(KERN_WARNING "(sd_init_onedisk:) Request allocation failure.\n"); return i; } buffer = (unsigned char *) scsi_malloc(512); if (!buffer) { - printk(KERN_WARNING "(sd_init_onedisk:) Memory allocation failure.\n"); + EPRINTK(KERN_WARNING "(sd_init_onedisk:) Memory allocation failure.\n"); scsi_release_request(SRpnt); return i; } @@ -825,7 +826,7 @@ SRpnt->sr_sense_buffer[2] == NOT_READY) { unsigned long time1; if (!spintime) { - printk("%s: Spinning up disk...", nbuff); + EPRINTK("%s: Spinning up disk...", nbuff); cmd[0] = START_STOP; cmd[1] = (rscsi_disks[i].device->scsi_level <= SCSI_2) ? ((rscsi_disks[i].device->lun << 5) & 0xe0) : 0; @@ -848,15 +849,15 @@ current->state = TASK_UNINTERRUPTIBLE; time1 = schedule_timeout(time1); } while(time1); - printk("."); + EPRINTK("."); } } while (the_result && spintime && time_after(spintime_value + 100 * HZ, jiffies)); if (spintime) { if (the_result) - printk("not responding...\n"); + EPRINTK("not responding...\n"); else - printk("ready\n"); + EPRINTK("ready\n"); } retries = 3; do { @@ -894,7 +895,7 @@ */ if (the_result) { - printk("%s : READ CAPACITY failed.\n" + EPRINTK("%s : READ CAPACITY failed.\n" "%s : status = %x, message = %02x, host = %d, driver = %02x \n", nbuff, nbuff, status_byte(the_result), @@ -905,9 +906,9 @@ if (driver_byte(the_result) & DRIVER_SENSE) print_req_sense("sd", SRpnt); else - printk("%s : sense not available. \n", nbuff); + EPRINTK("%s : sense not available. \n", nbuff); - printk("%s : block size assumed to be 512 bytes, disk size 1GB. \n", + EPRINTK("%s : block size assumed to be 512 bytes, disk size 1GB. \n", nbuff); rscsi_disks[i].capacity = 0x1fffff; sector_size = 512; @@ -934,7 +935,7 @@ if (sector_size == 0) { sector_size = 512; - printk("%s : sector size 0 reported, assuming 512.\n", + EPRINTK("%s : sector size 0 reported, assuming 512.\n", nbuff); } if (sector_size != 512 && @@ -942,7 +943,7 @@ sector_size != 2048 && sector_size != 4096 && sector_size != 256) { - printk("%s : unsupported sector size %d.\n", + EPRINTK("%s : unsupported sector size %d.\n", nbuff, sector_size); /* * The user might want to re-format the drive with @@ -979,7 +980,7 @@ sd_hardsizes[m] = hard_sector; } - printk("SCSI device %s: " + EPRINTK("SCSI device %s: " "%d %d-byte hdwr sectors (%d MB)\n", nbuff, rscsi_disks[i].capacity, hard_sector, (sz/2 - sz/1250 + 974)/1950); @@ -1035,10 +1036,10 @@ the_result = SRpnt->sr_result; if (the_result) { - printk("%s: test WP failed, assume Write Enabled\n", nbuff); + EPRINTK("%s: test WP failed, assume Write Enabled\n", nbuff); } else { rscsi_disks[i].write_prot = ((buffer[2] & 0x80) != 0); - printk("%s: Write Protect is %s\n", nbuff, + EPRINTK("%s: Write Protect is %s\n", nbuff, rscsi_disks[i].write_prot ? "on" : "off"); } @@ -1077,7 +1078,7 @@ if (!sd_registered) { for (i = 0; i < N_USED_SD_MAJORS; i++) { if (devfs_register_blkdev(SD_MAJOR(i), "sd", &sd_fops)) { - printk("Unable to get major %d for SCSI disk\n", SD_MAJOR(i)); + EPRINTK("Unable to get major %d for SCSI disk\n", SD_MAJOR(i)); sd_template.dev_noticed = 0; return 1; } @@ -1264,7 +1265,7 @@ break; if (i >= sd_template.dev_max) { - printk(KERN_WARNING "scsi_devices corrupt (sd)," + EPRINTK(KERN_WARNING "scsi_devices corrupt (sd)," " nr_dev %d dev_max %d\n", sd_template.nr_dev, sd_template.dev_max); SDp->attached--; @@ -1280,7 +1281,7 @@ if (SDp->removable) SD_GENDISK(i).flags[devnum] |= GENHD_FL_REMOVABLE; sd_devname(i, nbuff); - printk("Attached scsi %sdisk %s at scsi%d, channel %d, id %d, lun %d\n", + EPRINTK("Attached scsi %sdisk %s at scsi%d, channel %d, id %d, lun %d\n", SDp->removable ? "removable " : "", nbuff, SDp->host->host_no, SDp->channel, SDp->id, SDp->lun); return 0; @@ -1309,7 +1310,7 @@ target = DEVICE_NR(dev); if (DEVICE_BUSY || (ALLOW_REVALIDATE == 0 && USAGE > maxusage)) { - printk("Device busy for revalidation (usage=%d)\n", USAGE); + EPRINTK("Device busy for revalidation (usage=%d)\n", USAGE); return -EBUSY; } DEVICE_BUSY = 1;