/* In command mode and transport mode we need to look for sense data in different places. The sense data itself is allways an array of 32 bytes, so we can unify the sense data access for both modes.  */
char* dasd_get_sense(struct irb *irb)
/* In command mode and transport mode we need to look for sense data in different places. The sense data itself is allways an array of 32 bytes, so we can unify the sense data access for both modes.  */
char* dasd_get_sense(struct irb *irb)
{
	struct tsb *tsb = NULL;
	char *sense = NULL;
	if (scsw_is_tm(&irb->scsw) && (irb->scsw.tm.fcxs == 0x01)) {
		if (irb->scsw.tm.tcw)
			tsb = tcw_get_tsb((struct tcw *)(unsigned long)
					  irb->scsw.tm.tcw);
		if (tsb && tsb->length == 64 && tsb->flags)
			switch (tsb->flags & 0x07) {
			case 1:
				sense = tsb->tsa.iostat.sense;
				break;
			case 2:
				sense = tsb->tsa.ddpc.sense;
				break;
			default:
				break;
			}
	} else if (irb->esw.esw0.erw.cons) {
		sense = irb->ecw;
	}
	return sense;
}