Commit 20f9cb26 authored by Horst Hummel's avatar Horst Hummel Committed by Linus Torvalds

[PATCH] s390: dasd driver debug log

dasd driver changes:
 - Fix debug feature usage. The sprinf event/exception functions write a
   pointer to a format string (%s) to the log. These strings must be valid
   at the time the DBF-log is read.
 - Some coding style reformatting.
Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent f172f421
......@@ -7,7 +7,7 @@
* Bugreports.to..: <Linux390@de.ibm.com>
* (C) IBM Corporation, IBM Deutschland Entwicklung GmbH, 1999-2001
*
* $Revision: 1.151 $
* $Revision: 1.154 $
*/
#include <linux/config.h>
......@@ -179,7 +179,7 @@ dasd_state_known_to_basic(struct dasd_device * device)
device->debug_area = debug_register(device->cdev->dev.bus_id, 0, 2,
8 * sizeof (long));
debug_register_view(device->debug_area, &debug_sprintf_view);
debug_set_level(device->debug_area, DBF_ERR);
debug_set_level(device->debug_area, DBF_DEBUG);
DBF_DEV_EVENT(DBF_EMERG, device, "%s", "debug area created");
device->state = DASD_STATE_BASIC;
......@@ -520,10 +520,6 @@ dasd_kmalloc_request(char *magic, int cplength, int datasize,
if ( magic == NULL || datasize > PAGE_SIZE ||
(cplength*sizeof(struct ccw1)) > PAGE_SIZE)
BUG();
debug_text_event ( dasd_debug_area, 1, "ALLC");
debug_text_event ( dasd_debug_area, 1, magic);
debug_int_event ( dasd_debug_area, 1, cplength);
debug_int_event ( dasd_debug_area, 1, datasize);
cqr = kmalloc(sizeof(struct dasd_ccw_req), GFP_ATOMIC);
if (cqr == NULL)
......@@ -570,10 +566,6 @@ dasd_smalloc_request(char *magic, int cplength, int datasize,
if ( magic == NULL || datasize > PAGE_SIZE ||
(cplength*sizeof(struct ccw1)) > PAGE_SIZE)
BUG();
debug_text_event ( dasd_debug_area, 1, "ALLC");
debug_text_event ( dasd_debug_area, 1, magic);
debug_int_event ( dasd_debug_area, 1, cplength);
debug_int_event ( dasd_debug_area, 1, datasize);
size = (sizeof(struct dasd_ccw_req) + 7L) & -8L;
if (cplength > 0)
......@@ -623,8 +615,6 @@ dasd_kfree_request(struct dasd_ccw_req * cqr, struct dasd_device * device)
clear_normalized_cda(ccw);
} while (ccw++->flags & (CCW_FLAG_CC | CCW_FLAG_DC));
#endif
debug_text_event ( dasd_debug_area, 1, "FREE");
debug_int_event ( dasd_debug_area, 1, (long) cqr);
if (cqr->cpaddr != NULL)
kfree(cqr->cpaddr);
if (cqr->data != NULL)
......@@ -638,8 +628,6 @@ dasd_sfree_request(struct dasd_ccw_req * cqr, struct dasd_device * device)
{
unsigned long flags;
debug_text_event(dasd_debug_area, 1, "FREE");
debug_int_event(dasd_debug_area, 1, (long) cqr);
spin_lock_irqsave(&device->mem_lock, flags);
dasd_free_chunk(&device->ccw_chunks, cqr);
spin_unlock_irqrestore(&device->mem_lock, flags);
......@@ -696,6 +684,9 @@ dasd_term_IO(struct dasd_ccw_req * cqr)
} else
cqr->status = DASD_CQR_FAILED;
cqr->stopclk = get_clock();
DBF_DEV_EVENT(DBF_DEBUG, device,
"terminate cqr %p successful",
cqr);
break;
case -ENODEV:
DBF_DEV_EVENT(DBF_ERR, device, "%s",
......@@ -754,6 +745,8 @@ dasd_start_IO(struct dasd_ccw_req * cqr)
switch (rc) {
case 0:
cqr->status = DASD_CQR_IN_IO;
DBF_DEV_EVENT(DBF_DEBUG, device, "%s",
"start_IO: request %p started successful");
break;
case -EBUSY:
DBF_DEV_EVENT(DBF_ERR, device, "%s",
......@@ -964,8 +957,8 @@ dasd_int_handler(struct ccw_device *cdev, unsigned long intparm,
cdev->dev.bus_id, cqr->status);
return;
}
DBF_DEV_EVENT(DBF_DEBUG, device, "Int: CS/DS 0x%04x",
((irb->scsw.cstat << 8) | irb->scsw.dstat));
DBF_DEV_EVENT(DBF_DEBUG, device, "Int: CS/DS 0x%04x for cqr %p",
((irb->scsw.cstat << 8) | irb->scsw.dstat), cqr);
/* Find out the appropriate era_action. */
if (irb->scsw.fctl & SCSW_FCTL_HALT_FUNC)
......@@ -1080,7 +1073,8 @@ __dasd_process_ccw_queue(struct dasd_device * device,
cqr->stopclk = get_clock();
} else {
if (cqr->irb.esw.esw0.erw.cons) {
erp_fn = device->discipline->erp_action(cqr);
erp_fn = device->discipline->
erp_action(cqr);
erp_fn(cqr);
} else
dasd_default_erp_action(cqr);
......@@ -1153,10 +1147,9 @@ __dasd_process_blk_queue(struct dasd_device * device)
req = elv_next_request(queue);
if (test_bit(DASD_FLAG_RO, &device->flags) &&
rq_data_dir(req) == WRITE) {
DBF_EVENT(DBF_ERR,
"(%s) Rejecting write request %p",
device->cdev->dev.bus_id,
req);
DBF_DEV_EVENT(DBF_ERR, device,
"Rejecting write request %p",
req);
blkdev_dequeue_request(req);
dasd_end_request(req, 0);
continue;
......@@ -1170,10 +1163,10 @@ __dasd_process_blk_queue(struct dasd_device * device)
if (IS_ERR(cqr)) {
if (PTR_ERR(cqr) == -ENOMEM)
break; /* terminate request queue loop */
DBF_EVENT(DBF_ERR,
"(%s) CCW creation failed on request %p",
device->cdev->dev.bus_id,
req);
DBF_DEV_EVENT(DBF_ERR, device,
"CCW creation failed (rc=%ld) "
"on request %p",
PTR_ERR(cqr), req);
blkdev_dequeue_request(req);
dasd_end_request(req, 0);
continue;
......@@ -1678,9 +1671,8 @@ dasd_open(struct inode *inp, struct file *filp)
}
if (dasd_probeonly) {
MESSAGE(KERN_INFO,
"No access to device %s due to probeonly mode",
disk->disk_name);
DEV_MESSAGE(KERN_INFO, device, "%s",
"No access to device due to probeonly mode");
rc = -EPERM;
goto out;
}
......@@ -1970,8 +1962,8 @@ dasd_init(void)
rc = -ENOMEM;
goto failed;
}
debug_register_view(dasd_debug_area, &debug_hex_ascii_view);
debug_set_level(dasd_debug_area, DBF_ERR);
debug_register_view(dasd_debug_area, &debug_sprintf_view);
debug_set_level(dasd_debug_area, DBF_DEBUG);
DBF_EVENT(DBF_EMERG, "%s", "debug area created");
......
......@@ -5,7 +5,7 @@
* Bugreports.to..: <Linux390@de.ibm.com>
* (C) IBM Corporation, IBM Deutschland Entwicklung GmbH, 2000, 2001
*
* $Revision: 1.34 $
* $Revision: 1.36 $
*/
#include <linux/timer.h>
......@@ -20,9 +20,9 @@
struct DCTL_data {
unsigned char subcommand; /* e.g Inhibit Write, Enable Write,... */
unsigned char modifier; /* Subcommand modifier */
unsigned short res; /* reserved */
unsigned char subcommand; /* e.g Inhibit Write, Enable Write,... */
unsigned char modifier; /* Subcommand modifier */
unsigned short res; /* reserved */
} __attribute__ ((packed));
/*
......@@ -422,7 +422,8 @@ dasd_3990_erp_action_1(struct dasd_ccw_req * erp)
* Setup ERP to do the ERP action 4 (see Reference manual).
* Set the current request to PENDING to block the CQR queue for that device
* until the state change interrupt appears.
* Use a timer (20 seconds) to retry the cqr if the interrupt is still missing.
* Use a timer (20 seconds) to retry the cqr if the interrupt is still
* missing.
*
* PARAMETER
* sense sense data of the actual error
......@@ -443,9 +444,8 @@ dasd_3990_erp_action_4(struct dasd_ccw_req * erp, char *sense)
/* interrupt (this enables easier enqueing of the cqr) */
if (erp->function != dasd_3990_erp_action_4) {
DEV_MESSAGE(KERN_INFO, device,
"dasd_3990_erp_action_4: first time retry"
"%s", " ");
DEV_MESSAGE(KERN_INFO, device, "%s",
"dasd_3990_erp_action_4: first time retry");
erp->retries = 256;
erp->function = dasd_3990_erp_action_4;
......@@ -826,7 +826,7 @@ dasd_3990_handle_env_data(struct dasd_ccw_req * erp, char *sense)
}
break;
case 0x50: /* Format 5 - Data Check with displacement information */
case 0x50: /* Format 5 - Data Check with displacement information */
switch (msg_no) {
case 0x00:
DEV_MESSAGE(KERN_WARNING, device, "%s",
......@@ -871,7 +871,7 @@ dasd_3990_handle_env_data(struct dasd_ccw_req * erp, char *sense)
}
break;
case 0x60: /* Format 6 - Usage Statistics/Overrun Errors */
case 0x60: /* Format 6 - Usage Statistics/Overrun Errors */
switch (msg_no) {
case 0x00:
DEV_MESSAGE(KERN_WARNING, device, "%s",
......@@ -911,7 +911,7 @@ dasd_3990_handle_env_data(struct dasd_ccw_req * erp, char *sense)
}
break;
case 0x70: /* Format 7 - Device Connection Control Checks */
case 0x70: /* Format 7 - Device Connection Control Checks */
switch (msg_no) {
case 0x00:
DEV_MESSAGE(KERN_WARNING, device, "%s",
......@@ -988,7 +988,7 @@ dasd_3990_handle_env_data(struct dasd_ccw_req * erp, char *sense)
}
break;
case 0x80: /* Format 8 - Additional Device Equipment Checks */
case 0x80: /* Format 8 - Additional Device Equipment Checks */
switch (msg_no) {
case 0x00: /* No Message */
case 0x01:
......@@ -1041,7 +1041,7 @@ dasd_3990_handle_env_data(struct dasd_ccw_req * erp, char *sense)
}
break;
case 0x90: /* Format 9 - Device Read, Write, and Seek Checks */
case 0x90: /* Format 9 - Device Read, Write, and Seek Checks */
switch (msg_no) {
case 0x00:
break; /* No Message */
......@@ -2159,7 +2159,7 @@ dasd_3990_erp_inspect_32(struct dasd_ccw_req * erp, char *sense)
erp = dasd_3990_erp_int_req(erp);
break;
case 0x0F: /* length mismatch during update write command */
case 0x0F: /* length mismatch during update write command */
DEV_MESSAGE(KERN_ERR, device, "%s",
"update write command error - should not "
"happen;\n"
......@@ -2170,7 +2170,7 @@ dasd_3990_erp_inspect_32(struct dasd_ccw_req * erp, char *sense)
erp = dasd_3990_erp_cleanup(erp, DASD_CQR_FAILED);
break;
case 0x10: /* logging required for other channel program */
case 0x10: /* logging required for other channel program */
erp = dasd_3990_erp_action_10_32(erp, sense);
break;
......@@ -2197,8 +2197,8 @@ dasd_3990_erp_inspect_32(struct dasd_ccw_req * erp, char *sense)
/* not possible to handle this situation in Linux */
panic
("Invalid data - No way to inform appliction about "
"the possibly incorret data");
("Invalid data - No way to inform application "
"about the possibly incorrect data");
break;
case 0x1D: /* state-change pending */
......@@ -2263,11 +2263,10 @@ dasd_3990_erp_inspect(struct dasd_ccw_req * erp)
/* inspect the 32 byte sense data */
erp_new = dasd_3990_erp_inspect_32(erp, sense);
} /* end distinguish between 24 and 32 byte sense data */
} /* end distinguish between 24 and 32 byte sense data */
return erp_new;
} /* END dasd_3990_erp_inspect */
}
/*
* DASD_3990_ERP_ADD_ERP
......@@ -2520,7 +2519,8 @@ dasd_3990_erp_further_erp(struct dasd_ccw_req *erp)
erp = dasd_3990_erp_compound(erp, sense);
} else {
/* no retry left and no additional special handling necessary */
/* No retry left and no additional special handling */
/*necessary */
DEV_MESSAGE(KERN_ERR, device,
"no retries left for erp %p - "
"set status to FAILED", erp);
......
......@@ -11,7 +11,7 @@
* functions may not be called from interrupt context. In particular
* dasd_get_device is a no-no from interrupt context.
*
* $Revision: 1.35 $
* $Revision: 1.37 $
*/
#include <linux/config.h>
......@@ -70,7 +70,6 @@ int dasd_autodetect = 0; /* is true, when autodetection is active */
* strings when running as a module.
*/
static char *dasd[256];
/*
* Single spinlock to protect devmap structures and lists.
*/
......@@ -485,7 +484,8 @@ dasd_devmap_from_cdev(struct ccw_device *cdev)
devmap = dasd_find_busid(cdev->dev.bus_id);
if (IS_ERR(devmap))
devmap = dasd_add_busid(cdev->dev.bus_id, DASD_FEATURE_DEFAULT);
devmap = dasd_add_busid(cdev->dev.bus_id,
DASD_FEATURE_DEFAULT);
return devmap;
}
......
......@@ -6,7 +6,7 @@
* Bugreports.to..: <Linux390@de.ibm.com>
* (C) IBM Corporation, IBM Deutschland Entwicklung GmbH, 1999,2000
*
* $Revision: 1.40 $
* $Revision: 1.42 $
*/
#include <linux/config.h>
......@@ -138,7 +138,7 @@ dasd_start_diag(struct dasd_ccw_req * cqr)
rc = dia250(&private->iob, RW_BIO);
if (rc > 8) {
MESSAGE(KERN_WARNING, "dia250 returned CC %d", rc);
DEV_MESSAGE(KERN_WARNING, device, "dia250 returned CC %d", rc);
cqr->status = DASD_CQR_ERROR;
} else if (rc == 0) {
cqr->status = DASD_CQR_DONE;
......@@ -201,8 +201,9 @@ dasd_ext_handler(struct pt_regs *regs, __u16 code)
if (dasd_start_diag(next) == 0)
expires = next->expires;
else
MESSAGE(KERN_WARNING, "%s",
"Interrupt fastpath failed!");
DEV_MESSAGE(KERN_WARNING, device, "%s",
"Interrupt fastpath "
"failed!");
}
}
} else
......@@ -231,7 +232,7 @@ dasd_diag_check_device(struct dasd_device *device)
if (private == NULL) {
private = kmalloc(sizeof(struct dasd_diag_private),GFP_KERNEL);
if (private == NULL) {
MESSAGE(KERN_WARNING, "%s",
DEV_MESSAGE(KERN_WARNING, device, "%s",
"memory allocation failed for private data");
return -ENOMEM;
}
......@@ -258,11 +259,11 @@ dasd_diag_check_device(struct dasd_device *device)
return -ENOTSUPP;
}
DBF_EVENT(DBF_INFO,
"%04X: %04X on real %04X/%02X",
rdc_data->dev_nr,
rdc_data->vdev_type,
rdc_data->rdev_type, rdc_data->rdev_model);
DBF_DEV_EVENT(DBF_INFO, device,
"%04X: %04X on real %04X/%02X",
rdc_data->dev_nr,
rdc_data->vdev_type,
rdc_data->rdev_type, rdc_data->rdev_model);
/* terminate all outstanding operations */
mdsk_term_io(device);
......@@ -270,8 +271,8 @@ dasd_diag_check_device(struct dasd_device *device)
/* figure out blocksize of device */
label = (long *) get_zeroed_page(GFP_KERNEL);
if (label == NULL) {
MESSAGE(KERN_WARNING, "%s",
"No memory to allocate initialization request");
DEV_MESSAGE(KERN_WARNING, device, "%s",
"No memory to allocate initialization request");
return -ENOMEM;
}
/* try all sizes - needed for ECKD devices */
......@@ -451,20 +452,8 @@ static void
dasd_diag_dump_sense(struct dasd_device *device, struct dasd_ccw_req * req,
struct irb *stat)
{
char *page;
page = (char *) get_zeroed_page(GFP_KERNEL);
if (page == NULL) {
MESSAGE(KERN_ERR, "%s", "No memory to dump sense data");
return;
}
sprintf(page, KERN_WARNING PRINTK_HEADER
"device %s: I/O status report:\n",
device->cdev->dev.bus_id);
MESSAGE(KERN_ERR, "Sense data:\n%s", page);
free_page((unsigned long) page);
DEV_MESSAGE(KERN_ERR, device, "%s",
"dump sense not available for DIAG data");
}
/*
......@@ -500,9 +489,10 @@ static int __init
dasd_diag_init(void)
{
if (!MACHINE_IS_VM) {
MESSAGE(KERN_INFO,
"Machine is not VM: %s discipline not initializing",
dasd_diag_discipline.name);
MESSAGE_LOG(KERN_INFO,
"Machine is not VM: %s "
"discipline not initializing",
dasd_diag_discipline.name);
return -EINVAL;
}
ASCEBC(dasd_diag_discipline.ebcname, 4);
......@@ -517,9 +507,10 @@ static void __exit
dasd_diag_cleanup(void)
{
if (!MACHINE_IS_VM) {
MESSAGE(KERN_INFO,
"Machine is not VM: %s discipline not initializing",
dasd_diag_discipline.name);
MESSAGE_LOG(KERN_INFO,
"Machine is not VM: %s "
"discipline not cleaned",
dasd_diag_discipline.name);
return;
}
unregister_external_interrupt(0x2603, dasd_ext_handler);
......
......@@ -7,7 +7,7 @@
* Bugreports.to..: <Linux390@de.ibm.com>
* (C) IBM Corporation, IBM Deutschland Entwicklung GmbH, 1999,2000
*
* $Revision: 1.66 $
* $Revision: 1.68 $
*/
#include <linux/config.h>
......@@ -37,9 +37,12 @@
#define ECKD_C0(i) (i->home_bytes)
#define ECKD_F(i) (i->formula)
#define ECKD_F1(i) (ECKD_F(i)==0x01?(i->factors.f_0x01.f1):(i->factors.f_0x02.f1))
#define ECKD_F2(i) (ECKD_F(i)==0x01?(i->factors.f_0x01.f2):(i->factors.f_0x02.f2))
#define ECKD_F3(i) (ECKD_F(i)==0x01?(i->factors.f_0x01.f3):(i->factors.f_0x02.f3))
#define ECKD_F1(i) (ECKD_F(i)==0x01?(i->factors.f_0x01.f1):\
(i->factors.f_0x02.f1))
#define ECKD_F2(i) (ECKD_F(i)==0x01?(i->factors.f_0x01.f2):\
(i->factors.f_0x02.f2))
#define ECKD_F3(i) (ECKD_F(i)==0x01?(i->factors.f_0x01.f3):\
(i->factors.f_0x02.f3))
#define ECKD_F4(i) (ECKD_F(i)==0x02?(i->factors.f_0x02.f4):0)
#define ECKD_F5(i) (ECKD_F(i)==0x02?(i->factors.f_0x02.f5):0)
#define ECKD_F6(i) (i->factor6)
......@@ -151,7 +154,6 @@ bytes_per_record(struct dasd_eckd_characteristics *rdc, int kl, int dl)
bpr = fl1 + fl2;
break;
default:
MESSAGE(KERN_ERR, "unknown formula%d", rdc->formula);
bpr = 0;
break;
}
......@@ -209,8 +211,8 @@ check_XRC (struct ccw1 *de_ccw,
/* switch on System Time Stamp - needed for XRC Support */
if (private->rdc_data.facilities.XRC_supported) {
data->ga_extended |= 0x08; /* switch on 'Time Stamp Valid' */
data->ga_extended |= 0x02; /* switch on 'Extended Parameter' */
data->ga_extended |= 0x08; /* switch on 'Time Stamp Valid' */
data->ga_extended |= 0x02; /* switch on 'Extended Parameter' */
data->ep_sys_time = get_clock ();
......@@ -272,7 +274,7 @@ define_extent(struct ccw1 * ccw, struct DE_eckd_data * data, int trk,
check_XRC (ccw, data, device);
break;
default:
MESSAGE(KERN_ERR, "unknown opcode 0x%x", cmd);
DEV_MESSAGE(KERN_ERR, device, "unknown opcode 0x%x", cmd);
break;
}
......@@ -318,7 +320,7 @@ locate_record(struct ccw1 *ccw, struct LO_eckd_data *data, int trk,
private = (struct dasd_eckd_private *) device->private;
DBF_EVENT(DBF_INFO,
DBF_DEV_EVENT(DBF_INFO, device,
"Locate: trk %d, rec %d, no_rec %d, cmd %d, reclen %d",
trk, rec_on_trk, no_rec, cmd, reclen);
......@@ -400,7 +402,7 @@ locate_record(struct ccw1 *ccw, struct LO_eckd_data *data, int trk,
data->operation.operation = 0x0b;
break;
default:
MESSAGE(KERN_ERR, "unknown opcode 0x%x", cmd);
DEV_MESSAGE(KERN_ERR, device, "unknown opcode 0x%x", cmd);
}
data->seek_addr.cyl = data->search_arg.cyl =
trk / private->rdc_data.trk_per_cyl;
......@@ -458,8 +460,9 @@ dasd_eckd_check_characteristics(struct dasd_device *device)
private = kmalloc(sizeof(struct dasd_eckd_private),
GFP_KERNEL | GFP_DMA);
if (private == NULL) {
MESSAGE(KERN_WARNING, "%s",
"memory allocation failed for private data");
DEV_MESSAGE(KERN_WARNING, device, "%s",
"memory allocation failed for private "
"data");
return -ENOMEM;
}
device->private = (void *) private;
......@@ -474,8 +477,9 @@ dasd_eckd_check_characteristics(struct dasd_device *device)
rdc_data = (void *) &(private->rdc_data);
rc = read_dev_chars(device->cdev, &rdc_data, 64);
if (rc) {
MESSAGE(KERN_WARNING,
"Read device characteristics returned error %d", rc);
DEV_MESSAGE(KERN_WARNING, device,
"Read device characteristics returned error %d",
rc);
return rc;
}
......@@ -492,19 +496,20 @@ dasd_eckd_check_characteristics(struct dasd_device *device)
/* Read Configuration Data */
rc = read_conf_data(device->cdev, &conf_data, &conf_len);
if (rc && rc != -EOPNOTSUPP) { /* -EOPNOTSUPP is ok */
MESSAGE(KERN_WARNING,
"Read configuration data returned error %d", rc);
DEV_MESSAGE(KERN_WARNING, device,
"Read configuration data returned error %d", rc);
return rc;
}
if (conf_data == NULL) {
MESSAGE(KERN_WARNING, "%s", "No configuration data retrieved");
DEV_MESSAGE(KERN_WARNING, device, "%s",
"No configuration data retrieved");
return 0; /* no errror */
}
if (conf_len != sizeof (struct dasd_eckd_confdata)) {
MESSAGE(KERN_WARNING,
"sizes of configuration data mismatch"
"%d (read) vs %ld (expected)",
conf_len, sizeof (struct dasd_eckd_confdata));
DEV_MESSAGE(KERN_WARNING, device,
"sizes of configuration data mismatch"
"%d (read) vs %ld (expected)",
conf_len, sizeof (struct dasd_eckd_confdata));
kfree(conf_data); /* allocated by read_conf_data() */
return 0; /* no errror */
......@@ -746,8 +751,9 @@ dasd_eckd_format_device(struct dasd_device * device,
return ERR_PTR(-EINVAL);
}
if (dasd_check_blocksize(fdata->blksize) != 0) {
MESSAGE(KERN_WARNING, "Invalid blocksize %d...terminating!",
fdata->blksize);
DEV_MESSAGE(KERN_WARNING, device,
"Invalid blocksize %d...terminating!",
fdata->blksize);
return ERR_PTR(-EINVAL);
}
......@@ -783,7 +789,8 @@ dasd_eckd_format_device(struct dasd_device * device,
sizeof(struct eckd_count);
break;
default:
MESSAGE(KERN_WARNING, "Invalid flags 0x%x.", fdata->intensity);
DEV_MESSAGE(KERN_WARNING, device, "Invalid flags 0x%x.",
fdata->intensity);
return ERR_PTR(-EINVAL);
}
/* Allocate the format ccw request. */
......@@ -918,8 +925,8 @@ dasd_eckd_examine_error(struct dasd_ccw_req * cqr, struct irb * irb)
return dasd_9343_erp_examine(cqr, irb);
case 0x3880:
default:
MESSAGE(KERN_WARNING, "%s",
"default (unknown CU type) - RECOVERABLE return");
DEV_MESSAGE(KERN_WARNING, device, "%s",
"default (unknown CU type) - RECOVERABLE return");
return dasd_era_recover;
}
}
......@@ -937,7 +944,6 @@ dasd_eckd_erp_action(struct dasd_ccw_req * cqr)
case 0x1750:
return dasd_3990_erp_action;
case 0x9343:
/* Return dasd_9343_erp_action; */
case 0x3880:
default:
return dasd_default_erp_action;
......@@ -995,7 +1001,8 @@ dasd_eckd_build_cp(struct dasd_device * device, struct request *req)
return ERR_PTR(-EINVAL);
count += bv->bv_len >> (device->s2b_shift + 9);
#if defined(CONFIG_ARCH_S390X)
if (idal_is_needed (page_address(bv->bv_page), bv->bv_len))
if (idal_is_needed (page_address(bv->bv_page),
bv->bv_len))
cidaw += bv->bv_len >> (device->s2b_shift + 9);
#endif
}
......@@ -1193,8 +1200,8 @@ dasd_eckd_release(struct block_device *bdev, int no, long args)
cqr = dasd_smalloc_request(dasd_eckd_discipline.name,
1, 32, device);
if (IS_ERR(cqr)) {
MESSAGE(KERN_WARNING, "%s",
"Could not allocate initialization request");
DEV_MESSAGE(KERN_WARNING, device, "%s",
"Could not allocate initialization request");
return PTR_ERR(cqr);
}
cqr->cpaddr->cmd_code = DASD_ECKD_CCW_RELEASE;
......@@ -1237,8 +1244,8 @@ dasd_eckd_reserve(struct block_device *bdev, int no, long args)
cqr = dasd_smalloc_request(dasd_eckd_discipline.name,
1, 32, device);
if (IS_ERR(cqr)) {
MESSAGE(KERN_WARNING, "%s",
"Could not allocate initialization request");
DEV_MESSAGE(KERN_WARNING, device, "%s",
"Could not allocate initialization request");
return PTR_ERR(cqr);
}
cqr->cpaddr->cmd_code = DASD_ECKD_CCW_RESERVE;
......@@ -1280,8 +1287,8 @@ dasd_eckd_steal_lock(struct block_device *bdev, int no, long args)
cqr = dasd_smalloc_request(dasd_eckd_discipline.name,
1, 32, device);
if (IS_ERR(cqr)) {
MESSAGE(KERN_WARNING, "%s",
"Could not allocate initialization request");
DEV_MESSAGE(KERN_WARNING, device, "%s",
"Could not allocate initialization request");
return PTR_ERR(cqr);
}
cqr->cpaddr->cmd_code = DASD_ECKD_CCW_SLCK;
......@@ -1324,8 +1331,8 @@ dasd_eckd_performance(struct block_device *bdev, int no, long args)
sizeof (struct dasd_rssd_perf_stats_t)),
device);
if (IS_ERR(cqr)) {
MESSAGE(KERN_WARNING, "%s",
"Could not allocate initialization request");
DEV_MESSAGE(KERN_WARNING, device, "%s",
"Could not allocate initialization request");
return PTR_ERR(cqr);
}
cqr->device = device;
......@@ -1422,58 +1429,47 @@ dasd_eckd_set_attrib(struct block_device *bdev, int no, long args)
sizeof (struct attrib_data_t))) {
return -EFAULT;
}
private = (struct dasd_eckd_private *) device->private;
private->attrib = attrib;
DBF_DEV_EVENT(DBF_ERR, device,
"cache operation mode set to "
"%x (%i cylinder prestage)",
private->attrib.operation, private->attrib.nr_cyl);
DEV_MESSAGE(KERN_INFO, device,
"cache operation mode set to %x (%i cylinder prestage)",
private->attrib.operation, private->attrib.nr_cyl);
return 0;
}
/*
* Print sense data and related channel program.
* Parts are printed because printk buffer is only 1024 bytes.
*/
static void
dasd_eckd_dump_sense(struct dasd_device *device, struct dasd_ccw_req * req,
struct irb *irb)
{
char *page;
struct ccw1 *act;
int len, sl, sct;
struct ccw1 *act, *end, *last;
int len, sl, sct, count;
page = (char *) get_zeroed_page(GFP_ATOMIC);
if (page == NULL) {
MESSAGE(KERN_ERR, "%s", "No memory to dump sense data");
DEV_MESSAGE(KERN_ERR, device, " %s",
"No memory to dump sense data");
return;
}
len = sprintf(page, KERN_ERR PRINTK_HEADER
"device %s: I/O status report:\n",
" I/O status report for device %s:\n",
device->cdev->dev.bus_id);
len += sprintf(page + len, KERN_ERR PRINTK_HEADER
"in req: %p CS: 0x%02X DS: 0x%02X\n", req,
" in req: %p CS: 0x%02X DS: 0x%02X\n", req,
irb->scsw.cstat, irb->scsw.dstat);
len += sprintf(page + len, KERN_ERR PRINTK_HEADER
"Failing CCW: %p\n",
" device %s: Failing CCW: %p\n",
device->cdev->dev.bus_id,
(void *) (addr_t) irb->scsw.cpa);
act = req->cpaddr;
do {
DBF_EVENT(DBF_INFO,
"CCW %p: %08X %08X",
act, ((int *) act)[0], ((int *) act)[1]);
DBF_EVENT(DBF_INFO,
"DAT: %08X %08X %08X %08X",
((int *) (addr_t) act->cda)[0],
((int *) (addr_t) act->cda)[1],
((int *) (addr_t) act->cda)[2],
((int *) (addr_t) act->cda)[3]);
} while (act++->flags & (CCW_FLAG_CC | CCW_FLAG_DC));
if (irb->esw.esw0.erw.cons) {
for (sl = 0; sl < 4; sl++) {
len += sprintf(page + len, KERN_ERR PRINTK_HEADER
"Sense(hex) %2d-%2d:",
" Sense(hex) %2d-%2d:",
(8 * sl), ((8 * sl) + 7));
for (sct = 0; sct < 8; sct++) {
......@@ -1486,23 +1482,86 @@ dasd_eckd_dump_sense(struct dasd_device *device, struct dasd_ccw_req * req,
if (irb->ecw[27] & DASD_SENSE_BIT_0) {
/* 24 Byte Sense Data */
len += sprintf(page + len, KERN_ERR PRINTK_HEADER
"24 Byte: %x MSG %x, %s MSGb to SYSOP\n",
" 24 Byte: %x MSG %x, "
"%s MSGb to SYSOP\n",
irb->ecw[7] >> 4, irb->ecw[7] & 0x0f,
irb->ecw[1] & 0x10 ? "" : "no");
} else {
/* 32 Byte Sense Data */
len += sprintf(page + len, KERN_ERR PRINTK_HEADER
"32 Byte: Format: %x "
" 32 Byte: Format: %x "
"Exception class %x\n",
irb->ecw[6] & 0x0f, irb->ecw[22] >> 4);
}
} else {
len += sprintf(page + len, KERN_ERR PRINTK_HEADER
"SORRY - NO VALID SENSE AVAILABLE\n");
" SORRY - NO VALID SENSE AVAILABLE\n");
}
MESSAGE_LOG(KERN_ERR, "%s",
page + sizeof(KERN_ERR PRINTK_HEADER));
MESSAGE(KERN_ERR, "Sense data:\n%s", page);
/* dump the Channel Program */
/* print first CCWs (maximum 8) */
act = req->cpaddr;
for (last = act; last->flags & (CCW_FLAG_CC | CCW_FLAG_DC); last++);
end = min(act + 8, last);
len = sprintf(page, KERN_ERR PRINTK_HEADER
" Related CP in req: %p\n", req);
while (act <= end) {
len += sprintf(page + len, KERN_ERR PRINTK_HEADER
" CCW %p: %08X %08X DAT:",
act, ((int *) act)[0], ((int *) act)[1]);
for (count = 0; count < 32 && count < act->count;
count += sizeof(int))
len += sprintf(page + len, " %08X",
((int *) (addr_t) act->cda)
[(count>>2)]);
len += sprintf(page + len, "\n");
act++;
}
MESSAGE_LOG(KERN_ERR, "%s",
page + sizeof(KERN_ERR PRINTK_HEADER));
/* print failing CCW area */
len = 0;
if (act < ((struct ccw1 *)(addr_t) irb->scsw.cpa) - 2) {
act = ((struct ccw1 *)(addr_t) irb->scsw.cpa) - 2;
len += sprintf(page + len, KERN_ERR PRINTK_HEADER "......\n");
}
end = min((struct ccw1 *)(addr_t) irb->scsw.cpa + 2, last);
while (act <= end) {
len += sprintf(page + len, KERN_ERR PRINTK_HEADER
" CCW %p: %08X %08X DAT:",
act, ((int *) act)[0], ((int *) act)[1]);
for (count = 0; count < 32 && count < act->count;
count += sizeof(int))
len += sprintf(page + len, " %08X",
((int *) (addr_t) act->cda)
[(count>>2)]);
len += sprintf(page + len, "\n");
act++;
}
/* print last CCWs */
if (act < last - 2) {
act = last - 2;
len += sprintf(page + len, KERN_ERR PRINTK_HEADER "......\n");
}
while (act <= last) {
len += sprintf(page + len, KERN_ERR PRINTK_HEADER
" CCW %p: %08X %08X DAT:",
act, ((int *) act)[0], ((int *) act)[1]);
for (count = 0; count < 32 && count < act->count;
count += sizeof(int))
len += sprintf(page + len, " %08X",
((int *) (addr_t) act->cda)
[(count>>2)]);
len += sprintf(page + len, "\n");
act++;
}
if (len > 0)
MESSAGE_LOG(KERN_ERR, "%s",
page + sizeof(KERN_ERR PRINTK_HEADER));
free_page((unsigned long) page);
}
......
......@@ -5,15 +5,15 @@
* Bugreports.to..: <Linux390@de.ibm.com>
* (C) IBM Corporation, IBM Deutschland Entwicklung GmbH, 1999,2000
*
* $Revision: 1.8 $
* $Revision: 1.9 $
*/
#ifndef DASD_ECKD_H
#define DASD_ECKD_H
/*******************************************************************************
/*****************************************************************************
* SECTION: CCW Definitions
******************************************************************************/
****************************************************************************/
#define DASD_ECKD_CCW_WRITE 0x05
#define DASD_ECKD_CCW_READ 0x06
#define DASD_ECKD_CCW_WRITE_HOME_ADDRESS 0x09
......@@ -45,9 +45,9 @@
*/
#define PSF_ORDER_PRSSD 0x18
/*******************************************************************************
/*****************************************************************************
* SECTION: Type Definitions
******************************************************************************/
****************************************************************************/
struct eckd_count {
__u16 cyl;
......@@ -112,7 +112,7 @@ struct DE_eckd_data {
__u8 ga_extended; /* Global Attributes Extended */
struct ch_t beg_ext;
struct ch_t end_ext;
unsigned long long ep_sys_time; /* Extended Parameter - System Time Stamp */
unsigned long long ep_sys_time; /* Ext Parameter - System Time Stamp */
__u8 ep_format; /* Extended Parameter format byte */
__u8 ep_prio; /* Extended Parameter priority I/O byte */
__u8 ep_reserved[6]; /* Extended Parameter Reserved */
......
......@@ -7,7 +7,7 @@
* Bugreports.to..: <Linux390@de.ibm.com>
* (C) IBM Corporation, IBM Deutschland Entwicklung GmbH, 1999-2001
*
* $Revision: 1.12 $
* $Revision: 1.13 $
*/
#include <linux/config.h>
......@@ -36,10 +36,6 @@ dasd_alloc_erp_request(char *magic, int cplength, int datasize,
if ( magic == NULL || datasize > PAGE_SIZE ||
(cplength*sizeof(struct ccw1)) > PAGE_SIZE)
BUG();
debug_text_event ( dasd_debug_area, 1, "ALLC");
debug_text_event ( dasd_debug_area, 1, magic);
debug_int_event ( dasd_debug_area, 1, cplength);
debug_int_event ( dasd_debug_area, 1, datasize);
size = (sizeof(struct dasd_ccw_req) + 7L) & -8L;
if (cplength > 0)
......@@ -77,8 +73,6 @@ dasd_free_erp_request(struct dasd_ccw_req * cqr, struct dasd_device * device)
{
unsigned long flags;
debug_text_event(dasd_debug_area, 1, "FREE");
debug_int_event(dasd_debug_area, 1, (long) cqr);
spin_lock_irqsave(&device->mem_lock, flags);
dasd_free_chunk(&device->erp_chunks, cqr);
spin_unlock_irqrestore(&device->mem_lock, flags);
......@@ -105,7 +99,6 @@ dasd_default_erp_action(struct dasd_ccw_req * cqr)
} else {
DEV_MESSAGE (KERN_WARNING, device, "%s",
"default ERP called (NO retry left)");
cqr->status = DASD_CQR_FAILED;
cqr->stopclk = get_clock ();
}
......
......@@ -4,7 +4,7 @@
* Bugreports.to..: <Linux390@de.ibm.com>
* (C) IBM Corporation, IBM Deutschland Entwicklung GmbH, 1999,2000
*
* $Revision: 1.37 $
* $Revision: 1.39 $
*/
#include <linux/config.h>
......@@ -134,8 +134,9 @@ dasd_fba_check_characteristics(struct dasd_device *device)
if (private == NULL) {
private = kmalloc(sizeof(struct dasd_fba_private), GFP_KERNEL);
if (private == NULL) {
MESSAGE(KERN_WARNING, "%s",
"memory allocation failed for private data");
DEV_MESSAGE(KERN_WARNING, device, "%s",
"memory allocation failed for private "
"data");
return -ENOMEM;
}
device->private = (void *) private;
......@@ -144,8 +145,9 @@ dasd_fba_check_characteristics(struct dasd_device *device)
rdc_data = (void *) &(private->rdc_data);
rc = read_dev_chars(device->cdev, &rdc_data, 32);
if (rc) {
MESSAGE(KERN_WARNING,
"Read device characteristics returned error %d", rc);
DEV_MESSAGE(KERN_WARNING, device,
"Read device characteristics returned error %d",
rc);
return rc;
}
......@@ -227,8 +229,8 @@ dasd_fba_erp_postaction(struct dasd_ccw_req * cqr)
if (cqr->function == dasd_default_erp_action)
return dasd_default_erp_postaction;
MESSAGE(KERN_WARNING, "unknown ERP action %p", cqr->function);
DEV_MESSAGE(KERN_WARNING, cqr->device, "unknown ERP action %p",
cqr->function);
return NULL;
}
......@@ -270,7 +272,8 @@ dasd_fba_build_cp(struct dasd_device * device, struct request *req)
return ERR_PTR(-EINVAL);
count += bv->bv_len >> (device->s2b_shift + 9);
#if defined(CONFIG_ARCH_S390X)
if (idal_is_needed (page_address(bv->bv_page), bv->bv_len))
if (idal_is_needed (page_address(bv->bv_page),
bv->bv_len))
cidaw += bv->bv_len / blksize;
#endif
}
......@@ -423,18 +426,107 @@ dasd_fba_dump_sense(struct dasd_device *device, struct dasd_ccw_req * req,
struct irb *irb)
{
char *page;
struct ccw1 *act, *end, *last;
int len, sl, sct, count;
page = (char *) get_zeroed_page(GFP_KERNEL);
page = (char *) get_zeroed_page(GFP_ATOMIC);
if (page == NULL) {
MESSAGE(KERN_ERR, "%s", "No memory to dump sense data");
DEV_MESSAGE(KERN_ERR, device, " %s",
"No memory to dump sense data");
return;
}
sprintf(page, KERN_WARNING PRINTK_HEADER
"device %s: I/O status report:\n",
device->cdev->dev.bus_id);
len = sprintf(page, KERN_ERR PRINTK_HEADER
" I/O status report for device %s:\n",
device->cdev->dev.bus_id);
len += sprintf(page + len, KERN_ERR PRINTK_HEADER
" in req: %p CS: 0x%02X DS: 0x%02X\n", req,
irb->scsw.cstat, irb->scsw.dstat);
len += sprintf(page + len, KERN_ERR PRINTK_HEADER
" device %s: Failing CCW: %p\n",
device->cdev->dev.bus_id,
(void *) (addr_t) irb->scsw.cpa);
if (irb->esw.esw0.erw.cons) {
for (sl = 0; sl < 4; sl++) {
len += sprintf(page + len, KERN_ERR PRINTK_HEADER
" Sense(hex) %2d-%2d:",
(8 * sl), ((8 * sl) + 7));
for (sct = 0; sct < 8; sct++) {
len += sprintf(page + len, " %02x",
irb->ecw[8 * sl + sct]);
}
len += sprintf(page + len, "\n");
}
} else {
len += sprintf(page + len, KERN_ERR PRINTK_HEADER
" SORRY - NO VALID SENSE AVAILABLE\n");
}
MESSAGE_LOG(KERN_ERR, "%s",
page + sizeof(KERN_ERR PRINTK_HEADER));
/* dump the Channel Program */
/* print first CCWs (maximum 8) */
act = req->cpaddr;
for (last = act; last->flags & (CCW_FLAG_CC | CCW_FLAG_DC); last++);
end = min(act + 8, last);
len = sprintf(page, KERN_ERR PRINTK_HEADER
" Related CP in req: %p\n", req);
while (act <= end) {
len += sprintf(page + len, KERN_ERR PRINTK_HEADER
" CCW %p: %08X %08X DAT:",
act, ((int *) act)[0], ((int *) act)[1]);
for (count = 0; count < 32 && count < act->count;
count += sizeof(int))
len += sprintf(page + len, " %08X",
((int *) (addr_t) act->cda)
[(count>>2)]);
len += sprintf(page + len, "\n");
act++;
}
MESSAGE_LOG(KERN_ERR, "%s",
page + sizeof(KERN_ERR PRINTK_HEADER));
MESSAGE(KERN_ERR, "Sense data:\n%s", page);
/* print failing CCW area */
len = 0;
if (act < ((struct ccw1 *)(addr_t) irb->scsw.cpa) - 2) {
act = ((struct ccw1 *)(addr_t) irb->scsw.cpa) - 2;
len += sprintf(page + len, KERN_ERR PRINTK_HEADER "......\n");
}
end = min((struct ccw1 *)(addr_t) irb->scsw.cpa + 2, last);
while (act <= end) {
len += sprintf(page + len, KERN_ERR PRINTK_HEADER
" CCW %p: %08X %08X DAT:",
act, ((int *) act)[0], ((int *) act)[1]);
for (count = 0; count < 32 && count < act->count;
count += sizeof(int))
len += sprintf(page + len, " %08X",
((int *) (addr_t) act->cda)
[(count>>2)]);
len += sprintf(page + len, "\n");
act++;
}
/* print last CCWs */
if (act < last - 2) {
act = last - 2;
len += sprintf(page + len, KERN_ERR PRINTK_HEADER "......\n");
}
while (act <= last) {
len += sprintf(page + len, KERN_ERR PRINTK_HEADER
" CCW %p: %08X %08X DAT:",
act, ((int *) act)[0], ((int *) act)[1]);
for (count = 0; count < 32 && count < act->count;
count += sizeof(int))
len += sprintf(page + len, " %08X",
((int *) (addr_t) act->cda)
[(count>>2)]);
len += sprintf(page + len, "\n");
act++;
}
if (len > 0)
MESSAGE_LOG(KERN_ERR, "%s",
page + sizeof(KERN_ERR PRINTK_HEADER));
free_page((unsigned long) page);
}
......
......@@ -6,7 +6,7 @@
* Bugreports.to..: <Linux390@de.ibm.com>
* (C) IBM Corporation, IBM Deutschland Entwicklung GmbH, 1999,2000
*
* $Revision: 1.61 $
* $Revision: 1.63 $
*/
#ifndef DASD_INT_H
......@@ -150,6 +150,18 @@ do { \
DBF_EVENT(DBF_ALERT, d_string, d_args); \
} while(0)
/* messages to be written via klogd only */
#define DEV_MESSAGE_LOG(d_loglevel,d_device,d_string,d_args...)\
do { \
printk(d_loglevel PRINTK_HEADER " %s: " d_string "\n", \
d_device->cdev->dev.bus_id, d_args); \
} while(0)
#define MESSAGE_LOG(d_loglevel,d_string,d_args...)\
do { \
printk(d_loglevel PRINTK_HEADER " " d_string "\n", d_args); \
} while(0)
struct dasd_ccw_req {
unsigned int magic; /* Eye catcher */
struct list_head list; /* list_head for request queueing. */
......@@ -520,7 +532,8 @@ void dasd_proc_exit(void);
/* externals in dasd_erp.c */
struct dasd_ccw_req *dasd_default_erp_action(struct dasd_ccw_req *);
struct dasd_ccw_req *dasd_default_erp_postaction(struct dasd_ccw_req *);
struct dasd_ccw_req *dasd_alloc_erp_request(char *, int, int, struct dasd_device *);
struct dasd_ccw_req *dasd_alloc_erp_request(char *, int, int,
struct dasd_device *);
void dasd_free_erp_request(struct dasd_ccw_req *, struct dasd_device *);
void dasd_log_sense(struct dasd_ccw_req *, struct irb *);
void dasd_log_ccw(struct dasd_ccw_req *, int, __u32);
......
......@@ -257,8 +257,9 @@ dasd_format(struct dasd_device * device, struct format_data_t * fdata)
fdata->stop_unit, fdata->blksize, fdata->intensity);
/* Since dasdfmt keeps the device open after it was disabled,
* there still exists an inode for this device. We must update i_blkbits,
* otherwise we might get errors when enabling the device later.
* there still exists an inode for this device.
* We must update i_blkbits, otherwise we might get errors when
* enabling the device later.
*/
if (fdata->start_unit == 0) {
struct block_device *bdev = bdget_disk(device->gdp, 0);
......
......@@ -9,7 +9,7 @@
*
* /proc interface for the dasd driver.
*
* $Revision: 1.29 $
* $Revision: 1.30 $
*/
#include <linux/config.h>
......@@ -250,7 +250,7 @@ dasd_statistics_write(struct file *file, const char __user *user_buf,
buffer = dasd_get_user_string(user_buf, user_len);
if (IS_ERR(buffer))
return PTR_ERR(buffer);
MESSAGE(KERN_INFO, "/proc/dasd/statictics: '%s'", buffer);
MESSAGE_LOG(KERN_INFO, "/proc/dasd/statictics: '%s'", buffer);
/* check for valid verbs */
for (str = buffer; isspace(*str); str++);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment