xref: /linux/drivers/s390/cio/device_id.c (revision 045236ab190636c989ae8198eca37cfbafc1430b)
11da177e4SLinus Torvalds /*
21da177e4SLinus Torvalds  * drivers/s390/cio/device_id.c
31da177e4SLinus Torvalds  *
41da177e4SLinus Torvalds  *    Copyright (C) 2002 IBM Deutschland Entwicklung GmbH,
51da177e4SLinus Torvalds  *			 IBM Corporation
64ce3b30cSCornelia Huck  *    Author(s): Cornelia Huck (cornelia.huck@de.ibm.com)
71da177e4SLinus Torvalds  *		 Martin Schwidefsky (schwidefsky@de.ibm.com)
81da177e4SLinus Torvalds  *
91da177e4SLinus Torvalds  * Sense ID functions.
101da177e4SLinus Torvalds  */
111da177e4SLinus Torvalds 
121da177e4SLinus Torvalds #include <linux/module.h>
131da177e4SLinus Torvalds #include <linux/init.h>
14*045236abSAhmed S. Darwish #include <linux/kernel.h>
151da177e4SLinus Torvalds 
161da177e4SLinus Torvalds #include <asm/ccwdev.h>
171da177e4SLinus Torvalds #include <asm/delay.h>
181da177e4SLinus Torvalds #include <asm/cio.h>
191da177e4SLinus Torvalds #include <asm/lowcore.h>
201da177e4SLinus Torvalds 
211da177e4SLinus Torvalds #include "cio.h"
221da177e4SLinus Torvalds #include "cio_debug.h"
231da177e4SLinus Torvalds #include "css.h"
241da177e4SLinus Torvalds #include "device.h"
251da177e4SLinus Torvalds #include "ioasm.h"
261da177e4SLinus Torvalds 
271da177e4SLinus Torvalds /*
281da177e4SLinus Torvalds  * diag210 is used under VM to get information about a virtual device
291da177e4SLinus Torvalds  */
30347a8dc3SMartin Schwidefsky #ifdef CONFIG_64BIT
311da177e4SLinus Torvalds int
321da177e4SLinus Torvalds diag210(struct diag210 * addr)
331da177e4SLinus Torvalds {
341da177e4SLinus Torvalds 	/*
351da177e4SLinus Torvalds 	 * diag 210 needs its data below the 2GB border, so we
361da177e4SLinus Torvalds 	 * use a static data area to be sure
371da177e4SLinus Torvalds 	 */
381da177e4SLinus Torvalds 	static struct diag210 diag210_tmp;
391da177e4SLinus Torvalds 	static DEFINE_SPINLOCK(diag210_lock);
401da177e4SLinus Torvalds 	unsigned long flags;
411da177e4SLinus Torvalds 	int ccode;
421da177e4SLinus Torvalds 
431da177e4SLinus Torvalds 	spin_lock_irqsave(&diag210_lock, flags);
441da177e4SLinus Torvalds 	diag210_tmp = *addr;
451da177e4SLinus Torvalds 
461da177e4SLinus Torvalds 	asm volatile(
471da177e4SLinus Torvalds 		"	lhi	%0,-1\n"
481da177e4SLinus Torvalds 		"	sam31\n"
491da177e4SLinus Torvalds 		"	diag	%1,0,0x210\n"
501da177e4SLinus Torvalds 		"0:	ipm	%0\n"
511da177e4SLinus Torvalds 		"	srl	%0,28\n"
521da177e4SLinus Torvalds 		"1:	sam64\n"
5394c12cc7SMartin Schwidefsky 		EX_TABLE(0b,1b)
541da177e4SLinus Torvalds 		: "=&d" (ccode) : "a" (__pa(&diag210_tmp)) : "cc", "memory");
551da177e4SLinus Torvalds 
561da177e4SLinus Torvalds 	*addr = diag210_tmp;
571da177e4SLinus Torvalds 	spin_unlock_irqrestore(&diag210_lock, flags);
581da177e4SLinus Torvalds 
591da177e4SLinus Torvalds 	return ccode;
601da177e4SLinus Torvalds }
611da177e4SLinus Torvalds #else
621da177e4SLinus Torvalds int
631da177e4SLinus Torvalds diag210(struct diag210 * addr)
641da177e4SLinus Torvalds {
651da177e4SLinus Torvalds 	int ccode;
661da177e4SLinus Torvalds 
671da177e4SLinus Torvalds 	asm volatile(
681da177e4SLinus Torvalds 		"	lhi	%0,-1\n"
691da177e4SLinus Torvalds 		"	diag	%1,0,0x210\n"
701da177e4SLinus Torvalds 		"0:	ipm	%0\n"
711da177e4SLinus Torvalds 		"	srl	%0,28\n"
721da177e4SLinus Torvalds 		"1:\n"
7394c12cc7SMartin Schwidefsky 		EX_TABLE(0b,1b)
741da177e4SLinus Torvalds 		: "=&d" (ccode) : "a" (__pa(addr)) : "cc", "memory");
751da177e4SLinus Torvalds 
761da177e4SLinus Torvalds 	return ccode;
771da177e4SLinus Torvalds }
781da177e4SLinus Torvalds #endif
791da177e4SLinus Torvalds 
801da177e4SLinus Torvalds /*
811da177e4SLinus Torvalds  * Input :
821da177e4SLinus Torvalds  *   devno - device number
831da177e4SLinus Torvalds  *   ps	   - pointer to sense ID data area
841da177e4SLinus Torvalds  * Output : none
851da177e4SLinus Torvalds  */
861da177e4SLinus Torvalds static void
871da177e4SLinus Torvalds VM_virtual_device_info (__u16 devno, struct senseid *ps)
881da177e4SLinus Torvalds {
891da177e4SLinus Torvalds 	static struct {
901da177e4SLinus Torvalds 		int vrdcvcla, vrdcvtyp, cu_type;
911da177e4SLinus Torvalds 	} vm_devices[] = {
921da177e4SLinus Torvalds 		{ 0x08, 0x01, 0x3480 },
931da177e4SLinus Torvalds 		{ 0x08, 0x02, 0x3430 },
941da177e4SLinus Torvalds 		{ 0x08, 0x10, 0x3420 },
951da177e4SLinus Torvalds 		{ 0x08, 0x42, 0x3424 },
961da177e4SLinus Torvalds 		{ 0x08, 0x44, 0x9348 },
971da177e4SLinus Torvalds 		{ 0x08, 0x81, 0x3490 },
981da177e4SLinus Torvalds 		{ 0x08, 0x82, 0x3422 },
991da177e4SLinus Torvalds 		{ 0x10, 0x41, 0x1403 },
1001da177e4SLinus Torvalds 		{ 0x10, 0x42, 0x3211 },
1011da177e4SLinus Torvalds 		{ 0x10, 0x43, 0x3203 },
1021da177e4SLinus Torvalds 		{ 0x10, 0x45, 0x3800 },
1031da177e4SLinus Torvalds 		{ 0x10, 0x47, 0x3262 },
1041da177e4SLinus Torvalds 		{ 0x10, 0x48, 0x3820 },
1051da177e4SLinus Torvalds 		{ 0x10, 0x49, 0x3800 },
1061da177e4SLinus Torvalds 		{ 0x10, 0x4a, 0x4245 },
1071da177e4SLinus Torvalds 		{ 0x10, 0x4b, 0x4248 },
1081da177e4SLinus Torvalds 		{ 0x10, 0x4d, 0x3800 },
1091da177e4SLinus Torvalds 		{ 0x10, 0x4e, 0x3820 },
1101da177e4SLinus Torvalds 		{ 0x10, 0x4f, 0x3820 },
1111da177e4SLinus Torvalds 		{ 0x10, 0x82, 0x2540 },
1121da177e4SLinus Torvalds 		{ 0x10, 0x84, 0x3525 },
1131da177e4SLinus Torvalds 		{ 0x20, 0x81, 0x2501 },
1141da177e4SLinus Torvalds 		{ 0x20, 0x82, 0x2540 },
1151da177e4SLinus Torvalds 		{ 0x20, 0x84, 0x3505 },
1161da177e4SLinus Torvalds 		{ 0x40, 0x01, 0x3278 },
1171da177e4SLinus Torvalds 		{ 0x40, 0x04, 0x3277 },
1181da177e4SLinus Torvalds 		{ 0x40, 0x80, 0x2250 },
1191da177e4SLinus Torvalds 		{ 0x40, 0xc0, 0x5080 },
1201da177e4SLinus Torvalds 		{ 0x80, 0x00, 0x3215 },
1211da177e4SLinus Torvalds 	};
1221da177e4SLinus Torvalds 	struct diag210 diag_data;
1231da177e4SLinus Torvalds 	int ccode, i;
1241da177e4SLinus Torvalds 
1251da177e4SLinus Torvalds 	CIO_TRACE_EVENT (4, "VMvdinf");
1261da177e4SLinus Torvalds 
1271da177e4SLinus Torvalds 	diag_data = (struct diag210) {
1281da177e4SLinus Torvalds 		.vrdcdvno = devno,
1291da177e4SLinus Torvalds 		.vrdclen = sizeof (diag_data),
1301da177e4SLinus Torvalds 	};
1311da177e4SLinus Torvalds 
1321da177e4SLinus Torvalds 	ccode = diag210 (&diag_data);
1331da177e4SLinus Torvalds 	ps->reserved = 0xff;
1341da177e4SLinus Torvalds 
1351da177e4SLinus Torvalds 	/* Special case for bloody osa devices. */
1361da177e4SLinus Torvalds 	if (diag_data.vrdcvcla == 0x02 &&
1371da177e4SLinus Torvalds 	    diag_data.vrdcvtyp == 0x20) {
1381da177e4SLinus Torvalds 		ps->cu_type = 0x3088;
1391da177e4SLinus Torvalds 		ps->cu_model = 0x60;
1401da177e4SLinus Torvalds 		return;
1411da177e4SLinus Torvalds 	}
142*045236abSAhmed S. Darwish 	for (i = 0; i < ARRAY_SIZE(vm_devices); i++)
1431da177e4SLinus Torvalds 		if (diag_data.vrdcvcla == vm_devices[i].vrdcvcla &&
1441da177e4SLinus Torvalds 		    diag_data.vrdcvtyp == vm_devices[i].vrdcvtyp) {
1451da177e4SLinus Torvalds 			ps->cu_type = vm_devices[i].cu_type;
1461da177e4SLinus Torvalds 			return;
1471da177e4SLinus Torvalds 		}
1481da177e4SLinus Torvalds 	CIO_MSG_EVENT(0, "DIAG X'210' for device %04X returned (cc = %d):"
1491da177e4SLinus Torvalds 		      "vdev class : %02X, vdev type : %04X \n ...  "
1501da177e4SLinus Torvalds 		      "rdev class : %02X, rdev type : %04X, "
1511da177e4SLinus Torvalds 		      "rdev model: %02X\n",
1521da177e4SLinus Torvalds 		      devno, ccode,
1531da177e4SLinus Torvalds 		      diag_data.vrdcvcla, diag_data.vrdcvtyp,
1541da177e4SLinus Torvalds 		      diag_data.vrdcrccl, diag_data.vrdccrty,
1551da177e4SLinus Torvalds 		      diag_data.vrdccrmd);
1561da177e4SLinus Torvalds }
1571da177e4SLinus Torvalds 
1581da177e4SLinus Torvalds /*
1591da177e4SLinus Torvalds  * Start Sense ID helper function.
1601da177e4SLinus Torvalds  * Try to obtain the 'control unit'/'device type' information
1611da177e4SLinus Torvalds  *  associated with the subchannel.
1621da177e4SLinus Torvalds  */
1631da177e4SLinus Torvalds static int
1641da177e4SLinus Torvalds __ccw_device_sense_id_start(struct ccw_device *cdev)
1651da177e4SLinus Torvalds {
1661da177e4SLinus Torvalds 	struct subchannel *sch;
1671da177e4SLinus Torvalds 	struct ccw1 *ccw;
1681da177e4SLinus Torvalds 	int ret;
1691da177e4SLinus Torvalds 
1701da177e4SLinus Torvalds 	sch = to_subchannel(cdev->dev.parent);
1711da177e4SLinus Torvalds 	/* Setup sense channel program. */
1721da177e4SLinus Torvalds 	ccw = cdev->private->iccws;
1731da177e4SLinus Torvalds 	if (sch->schib.pmcw.pim != 0x80) {
1741da177e4SLinus Torvalds 		/* more than one path installed. */
1751da177e4SLinus Torvalds 		ccw->cmd_code = CCW_CMD_SUSPEND_RECONN;
1761da177e4SLinus Torvalds 		ccw->cda = 0;
1771da177e4SLinus Torvalds 		ccw->count = 0;
1781da177e4SLinus Torvalds 		ccw->flags = CCW_FLAG_SLI | CCW_FLAG_CC;
1791da177e4SLinus Torvalds 		ccw++;
1801da177e4SLinus Torvalds 	}
1811da177e4SLinus Torvalds 	ccw->cmd_code = CCW_CMD_SENSE_ID;
1821da177e4SLinus Torvalds 	ccw->cda = (__u32) __pa (&cdev->private->senseid);
1831da177e4SLinus Torvalds 	ccw->count = sizeof (struct senseid);
1841da177e4SLinus Torvalds 	ccw->flags = CCW_FLAG_SLI;
1851da177e4SLinus Torvalds 
1861da177e4SLinus Torvalds 	/* Reset device status. */
1871da177e4SLinus Torvalds 	memset(&cdev->private->irb, 0, sizeof(struct irb));
1881da177e4SLinus Torvalds 
1891da177e4SLinus Torvalds 	/* Try on every path. */
1901da177e4SLinus Torvalds 	ret = -ENODEV;
1911da177e4SLinus Torvalds 	while (cdev->private->imask != 0) {
1921da177e4SLinus Torvalds 		if ((sch->opm & cdev->private->imask) != 0 &&
1931da177e4SLinus Torvalds 		    cdev->private->iretry > 0) {
1941da177e4SLinus Torvalds 			cdev->private->iretry--;
195d23861ffSCornelia Huck 			/* Reset internal retry indication. */
196d23861ffSCornelia Huck 			cdev->private->flags.intretry = 0;
1971da177e4SLinus Torvalds 			ret = cio_start (sch, cdev->private->iccws,
1981da177e4SLinus Torvalds 					 cdev->private->imask);
1991da177e4SLinus Torvalds 			/* ret is 0, -EBUSY, -EACCES or -ENODEV */
2001da177e4SLinus Torvalds 			if (ret != -EACCES)
2011da177e4SLinus Torvalds 				return ret;
2021da177e4SLinus Torvalds 		}
2031da177e4SLinus Torvalds 		cdev->private->imask >>= 1;
2041da177e4SLinus Torvalds 		cdev->private->iretry = 5;
2051da177e4SLinus Torvalds 	}
2061da177e4SLinus Torvalds 	return ret;
2071da177e4SLinus Torvalds }
2081da177e4SLinus Torvalds 
2091da177e4SLinus Torvalds void
2101da177e4SLinus Torvalds ccw_device_sense_id_start(struct ccw_device *cdev)
2111da177e4SLinus Torvalds {
2121da177e4SLinus Torvalds 	int ret;
2131da177e4SLinus Torvalds 
2141da177e4SLinus Torvalds 	memset (&cdev->private->senseid, 0, sizeof (struct senseid));
2151da177e4SLinus Torvalds 	cdev->private->senseid.cu_type = 0xFFFF;
2161da177e4SLinus Torvalds 	cdev->private->imask = 0x80;
2171da177e4SLinus Torvalds 	cdev->private->iretry = 5;
2181da177e4SLinus Torvalds 	ret = __ccw_device_sense_id_start(cdev);
2191da177e4SLinus Torvalds 	if (ret && ret != -EBUSY)
2201da177e4SLinus Torvalds 		ccw_device_sense_id_done(cdev, ret);
2211da177e4SLinus Torvalds }
2221da177e4SLinus Torvalds 
2231da177e4SLinus Torvalds /*
2241da177e4SLinus Torvalds  * Called from interrupt context to check if a valid answer
2251da177e4SLinus Torvalds  * to Sense ID was received.
2261da177e4SLinus Torvalds  */
2271da177e4SLinus Torvalds static int
2281da177e4SLinus Torvalds ccw_device_check_sense_id(struct ccw_device *cdev)
2291da177e4SLinus Torvalds {
2301da177e4SLinus Torvalds 	struct subchannel *sch;
2311da177e4SLinus Torvalds 	struct irb *irb;
2321da177e4SLinus Torvalds 
2331da177e4SLinus Torvalds 	sch = to_subchannel(cdev->dev.parent);
2341da177e4SLinus Torvalds 	irb = &cdev->private->irb;
2351da177e4SLinus Torvalds 	/* Did we get a proper answer ? */
2361da177e4SLinus Torvalds 	if (cdev->private->senseid.cu_type != 0xFFFF &&
2371da177e4SLinus Torvalds 	    cdev->private->senseid.reserved == 0xFF) {
2381da177e4SLinus Torvalds 		if (irb->scsw.count < sizeof (struct senseid) - 8)
2391da177e4SLinus Torvalds 			cdev->private->flags.esid = 1;
2401da177e4SLinus Torvalds 		return 0; /* Success */
2411da177e4SLinus Torvalds 	}
2421da177e4SLinus Torvalds 	/* Check the error cases. */
243d23861ffSCornelia Huck 	if (irb->scsw.fctl & (SCSW_FCTL_HALT_FUNC | SCSW_FCTL_CLEAR_FUNC)) {
244d23861ffSCornelia Huck 		/* Retry Sense ID if requested. */
245d23861ffSCornelia Huck 		if (cdev->private->flags.intretry) {
246d23861ffSCornelia Huck 			cdev->private->flags.intretry = 0;
247d23861ffSCornelia Huck 			return -EAGAIN;
248d23861ffSCornelia Huck 		}
2491da177e4SLinus Torvalds 		return -ETIME;
250d23861ffSCornelia Huck 	}
2511da177e4SLinus Torvalds 	if (irb->esw.esw0.erw.cons && (irb->ecw[0] & SNS0_CMD_REJECT)) {
2521da177e4SLinus Torvalds 		/*
2531da177e4SLinus Torvalds 		 * if the device doesn't support the SenseID
2541da177e4SLinus Torvalds 		 *  command further retries wouldn't help ...
2551da177e4SLinus Torvalds 		 * NB: We don't check here for intervention required like we
2561da177e4SLinus Torvalds 		 *     did before, because tape devices with no tape inserted
2571da177e4SLinus Torvalds 		 *     may present this status *in conjunction with* the
2581da177e4SLinus Torvalds 		 *     sense id information. So, for intervention required,
2591da177e4SLinus Torvalds 		 *     we use the "whack it until it talks" strategy...
2601da177e4SLinus Torvalds 		 */
261fb6958a5SCornelia Huck 		CIO_MSG_EVENT(2, "SenseID : device %04x on Subchannel "
262fb6958a5SCornelia Huck 			      "0.%x.%04x reports cmd reject\n",
26378964268SCornelia Huck 			      cdev->private->dev_id.devno, sch->schid.ssid,
264fb6958a5SCornelia Huck 			      sch->schid.sch_no);
2651da177e4SLinus Torvalds 		return -EOPNOTSUPP;
2661da177e4SLinus Torvalds 	}
2671da177e4SLinus Torvalds 	if (irb->esw.esw0.erw.cons) {
268fb6958a5SCornelia Huck 		CIO_MSG_EVENT(2, "SenseID : UC on dev 0.%x.%04x, "
2691da177e4SLinus Torvalds 			      "lpum %02X, cnt %02d, sns :"
2701da177e4SLinus Torvalds 			      " %02X%02X%02X%02X %02X%02X%02X%02X ...\n",
27178964268SCornelia Huck 			      cdev->private->dev_id.ssid,
27278964268SCornelia Huck 			      cdev->private->dev_id.devno,
2731da177e4SLinus Torvalds 			      irb->esw.esw0.sublog.lpum,
2741da177e4SLinus Torvalds 			      irb->esw.esw0.erw.scnt,
2751da177e4SLinus Torvalds 			      irb->ecw[0], irb->ecw[1],
2761da177e4SLinus Torvalds 			      irb->ecw[2], irb->ecw[3],
2771da177e4SLinus Torvalds 			      irb->ecw[4], irb->ecw[5],
2781da177e4SLinus Torvalds 			      irb->ecw[6], irb->ecw[7]);
2791da177e4SLinus Torvalds 		return -EAGAIN;
2801da177e4SLinus Torvalds 	}
2811da177e4SLinus Torvalds 	if (irb->scsw.cc == 3) {
2821da177e4SLinus Torvalds 		if ((sch->orb.lpm &
2831da177e4SLinus Torvalds 		     sch->schib.pmcw.pim & sch->schib.pmcw.pam) != 0)
284fb6958a5SCornelia Huck 			CIO_MSG_EVENT(2, "SenseID : path %02X for device %04x "
285fb6958a5SCornelia Huck 				      "on subchannel 0.%x.%04x is "
286fb6958a5SCornelia Huck 				      "'not operational'\n", sch->orb.lpm,
28778964268SCornelia Huck 				      cdev->private->dev_id.devno,
28878964268SCornelia Huck 				      sch->schid.ssid, sch->schid.sch_no);
2891da177e4SLinus Torvalds 		return -EACCES;
2901da177e4SLinus Torvalds 	}
2911da177e4SLinus Torvalds 	/* Hmm, whatever happened, try again. */
2921da177e4SLinus Torvalds 	CIO_MSG_EVENT(2, "SenseID : start_IO() for device %04x on "
293fb6958a5SCornelia Huck 		      "subchannel 0.%x.%04x returns status %02X%02X\n",
29478964268SCornelia Huck 		      cdev->private->dev_id.devno, sch->schid.ssid,
29578964268SCornelia Huck 		      sch->schid.sch_no,
2961da177e4SLinus Torvalds 		      irb->scsw.dstat, irb->scsw.cstat);
2971da177e4SLinus Torvalds 	return -EAGAIN;
2981da177e4SLinus Torvalds }
2991da177e4SLinus Torvalds 
3001da177e4SLinus Torvalds /*
3011da177e4SLinus Torvalds  * Got interrupt for Sense ID.
3021da177e4SLinus Torvalds  */
3031da177e4SLinus Torvalds void
3041da177e4SLinus Torvalds ccw_device_sense_id_irq(struct ccw_device *cdev, enum dev_event dev_event)
3051da177e4SLinus Torvalds {
3061da177e4SLinus Torvalds 	struct subchannel *sch;
3071da177e4SLinus Torvalds 	struct irb *irb;
3081da177e4SLinus Torvalds 	int ret;
3091da177e4SLinus Torvalds 
3101da177e4SLinus Torvalds 	sch = to_subchannel(cdev->dev.parent);
3111da177e4SLinus Torvalds 	irb = (struct irb *) __LC_IRB;
3121da177e4SLinus Torvalds 	/* Retry sense id, if needed. */
3131da177e4SLinus Torvalds 	if (irb->scsw.stctl ==
3141da177e4SLinus Torvalds 	    (SCSW_STCTL_STATUS_PEND | SCSW_STCTL_ALERT_STATUS)) {
3151da177e4SLinus Torvalds 		if ((irb->scsw.cc == 1) || !irb->scsw.actl) {
3161da177e4SLinus Torvalds 			ret = __ccw_device_sense_id_start(cdev);
3171da177e4SLinus Torvalds 			if (ret && ret != -EBUSY)
3181da177e4SLinus Torvalds 				ccw_device_sense_id_done(cdev, ret);
3191da177e4SLinus Torvalds 		}
3201da177e4SLinus Torvalds 		return;
3211da177e4SLinus Torvalds 	}
3221da177e4SLinus Torvalds 	if (ccw_device_accumulate_and_sense(cdev, irb) != 0)
3231da177e4SLinus Torvalds 		return;
3241da177e4SLinus Torvalds 	ret = ccw_device_check_sense_id(cdev);
3251da177e4SLinus Torvalds 	memset(&cdev->private->irb, 0, sizeof(struct irb));
3261da177e4SLinus Torvalds 	switch (ret) {
3271da177e4SLinus Torvalds 	/* 0, -ETIME, -EOPNOTSUPP, -EAGAIN or -EACCES */
3281da177e4SLinus Torvalds 	case 0:			/* Sense id succeeded. */
3291da177e4SLinus Torvalds 	case -ETIME:		/* Sense id stopped by timeout. */
3301da177e4SLinus Torvalds 		ccw_device_sense_id_done(cdev, ret);
3311da177e4SLinus Torvalds 		break;
3321da177e4SLinus Torvalds 	case -EACCES:		/* channel is not operational. */
3331da177e4SLinus Torvalds 		sch->lpm &= ~cdev->private->imask;
3341da177e4SLinus Torvalds 		cdev->private->imask >>= 1;
3351da177e4SLinus Torvalds 		cdev->private->iretry = 5;
3361da177e4SLinus Torvalds 		/* fall through. */
3371da177e4SLinus Torvalds 	case -EAGAIN:		/* try again. */
3381da177e4SLinus Torvalds 		ret = __ccw_device_sense_id_start(cdev);
3391da177e4SLinus Torvalds 		if (ret == 0 || ret == -EBUSY)
3401da177e4SLinus Torvalds 			break;
3411da177e4SLinus Torvalds 		/* fall through. */
3421da177e4SLinus Torvalds 	default:		/* Sense ID failed. Try asking VM. */
3431da177e4SLinus Torvalds 		if (MACHINE_IS_VM) {
34478964268SCornelia Huck 			VM_virtual_device_info (cdev->private->dev_id.devno,
3451da177e4SLinus Torvalds 						&cdev->private->senseid);
3461da177e4SLinus Torvalds 			if (cdev->private->senseid.cu_type != 0xFFFF) {
3471da177e4SLinus Torvalds 				/* Got the device information from VM. */
3481da177e4SLinus Torvalds 				ccw_device_sense_id_done(cdev, 0);
3491da177e4SLinus Torvalds 				return;
3501da177e4SLinus Torvalds 			}
3511da177e4SLinus Torvalds 		}
3521da177e4SLinus Torvalds 		/*
3531da177e4SLinus Torvalds 		 * If we can't couldn't identify the device type we
3541da177e4SLinus Torvalds 		 *  consider the device "not operational".
3551da177e4SLinus Torvalds 		 */
3561da177e4SLinus Torvalds 		ccw_device_sense_id_done(cdev, -ENODEV);
3571da177e4SLinus Torvalds 		break;
3581da177e4SLinus Torvalds 	}
3591da177e4SLinus Torvalds }
3601da177e4SLinus Torvalds 
3611da177e4SLinus Torvalds EXPORT_SYMBOL(diag210);
362