From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43086) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XNI4K-0006V4-QJ for qemu-devel@nongnu.org; Fri, 29 Aug 2014 05:02:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XNI4B-0006Mf-P9 for qemu-devel@nongnu.org; Fri, 29 Aug 2014 05:02:04 -0400 Received: from e06smtp11.uk.ibm.com ([195.75.94.107]:54434) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XNI4B-0006MO-Hq for qemu-devel@nongnu.org; Fri, 29 Aug 2014 05:01:55 -0400 Received: from /spool/local by e06smtp11.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 29 Aug 2014 10:01:50 +0100 Received: from b06cxnps4076.portsmouth.uk.ibm.com (d06relay13.portsmouth.uk.ibm.com [9.149.109.198]) by d06dlp02.portsmouth.uk.ibm.com (Postfix) with ESMTP id 9F834219005F for ; Fri, 29 Aug 2014 10:01:28 +0100 (BST) Received: from d06av05.portsmouth.uk.ibm.com (d06av05.portsmouth.uk.ibm.com [9.149.37.229]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id s7T91l3047382602 for ; Fri, 29 Aug 2014 09:01:47 GMT Received: from d06av05.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av05.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id s7T91kHm023266 for ; Fri, 29 Aug 2014 03:01:46 -0600 From: Jens Freimann Date: Fri, 29 Aug 2014 11:01:37 +0200 Message-Id: <1409302902-57391-3-git-send-email-jfrei@linux.vnet.ibm.com> In-Reply-To: <1409302902-57391-1-git-send-email-jfrei@linux.vnet.ibm.com> References: <1409302902-57391-1-git-send-email-jfrei@linux.vnet.ibm.com> Subject: [Qemu-devel] [PATCH 2/7] pc-bios/s390-ccw: handle more ECKD DASD block sizes List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Christian Borntraeger , Alexander Graf , Cornelia Huck Cc: "Eugene (jno) Dvurechenski" , Jens Freimann , qemu-devel@nongnu.org From: "Eugene (jno) Dvurechenski" Using dasdfmt(8) to format a DASD allows to choose a block size. There are four supported values: 512, 1024, 2048, and 4096 bytes per block. Each block size leads to selection of new count of sectors per track. The head count remains always the same: 15. This empiric knowledge is used to detect ECKD DASD to IPL from. Signed-off-by: Eugene (jno) Dvurechenski Reviewed-by: David Hildenbrand Acked-by: Christian Borntraeger Signed-off-by: Jens Freimann --- pc-bios/s390-ccw/virtio.c | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/pc-bios/s390-ccw/virtio.c b/pc-bios/s390-ccw/virtio.c index 04977e4..6ed3dc9 100644 --- a/pc-bios/s390-ccw/virtio.c +++ b/pc-bios/s390-ccw/virtio.c @@ -299,14 +299,35 @@ bool virtio_disk_is_scsi(void) && (virtio_get_block_size() == 512); } +/* + * Other supported value pairs, if any, would need to be added here. + * Note: head count is always 15. + */ +static inline u8 virtio_eckd_sectors_for_block_size(int size) +{ + switch (size) { + case 512: + return 49; + case 1024: + return 33; + case 2048: + return 21; + case 4096: + return 12; + } + return 0; +} + bool virtio_disk_is_eckd(void) { + const int block_size = virtio_get_block_size(); + if (guessed_disk_nature) { - return (virtio_get_block_size() == 4096); + return (block_size == 4096); } return (blk_cfg.geometry.heads == 15) - && (blk_cfg.geometry.sectors == 12) - && (virtio_get_block_size() == 4096); + && (blk_cfg.geometry.sectors == + virtio_eckd_sectors_for_block_size(block_size)); } bool virtio_ipl_disk_is_valid(void) -- 1.8.5.5