From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:40355) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UVi02-0007Uf-D2 for qemu-devel@nongnu.org; Fri, 26 Apr 2013 08:43:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UVhzz-0003tV-JE for qemu-devel@nongnu.org; Fri, 26 Apr 2013 08:43:38 -0400 Received: from e06smtp14.uk.ibm.com ([195.75.94.110]:49535) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UVhXs-0002rw-Ft for qemu-devel@nongnu.org; Fri, 26 Apr 2013 08:14:32 -0400 Received: from /spool/local by e06smtp14.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 26 Apr 2013 13:09:15 +0100 Received: from b06cxnps4074.portsmouth.uk.ibm.com (d06relay11.portsmouth.uk.ibm.com [9.149.109.196]) by d06dlp03.portsmouth.uk.ibm.com (Postfix) with ESMTP id 5B4DB1B08070 for ; Fri, 26 Apr 2013 13:14:29 +0100 (BST) Received: from d06av01.portsmouth.uk.ibm.com (d06av01.portsmouth.uk.ibm.com [9.149.37.212]) by b06cxnps4074.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id r3QCCro555771222 for ; Fri, 26 Apr 2013 12:12:53 GMT Received: from d06av01.portsmouth.uk.ibm.com (loopback [127.0.0.1]) by d06av01.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id r3QCD2Uq000581 for ; Fri, 26 Apr 2013 06:13:03 -0600 From: Dominik Dingel Date: Fri, 26 Apr 2013 14:12:52 +0200 Message-Id: <1366978377-16823-6-git-send-email-dingel@linux.vnet.ibm.com> In-Reply-To: <1366978377-16823-1-git-send-email-dingel@linux.vnet.ibm.com> References: <1366978377-16823-1-git-send-email-dingel@linux.vnet.ibm.com> Subject: [Qemu-devel] [PATCH 05/10] s390-ccw.img: Detect devices with stsch. List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Cornelia Huck , Christian Borntraeger , Alexander Graf From: Cornelia Huck stsch is the canonical way to detect devices. As a bonus, we can abort the loop if we get cc 3, and we need to check only the valid devices (dnv set). Signed-off-by: Cornelia Huck diff --git a/pc-bios/s390-ccw/main.c b/pc-bios/s390-ccw/main.c index 67f4987..fd40fa5 100644 --- a/pc-bios/s390-ccw/main.c +++ b/pc-bios/s390-ccw/main.c @@ -22,7 +22,7 @@ void virtio_panic(const char *string) static void virtio_setup(void) { - struct irb irb; + struct schib schib; int i; int r; bool found = false; @@ -31,8 +31,11 @@ static void virtio_setup(void) for (i = 0; i < 0x10000; i++) { blk_schid.sch_no = i; - r = tsch(blk_schid, &irb); - if (r != 3) { + r = stsch_err(blk_schid, &schib); + if (r == 3) { + break; + } + if (schib.pmcw.dnv) { if (virtio_is_blk(blk_schid)) { found = true; break; -- 1.7.9.5