diff options
author | Eugene (jno) Dvurechenski <jno@linux.vnet.ibm.com> | 2014-08-29 11:01:36 +0200 |
---|---|---|
committer | Christian Borntraeger <borntraeger@de.ibm.com> | 2014-09-01 09:23:02 +0200 |
commit | 92cb05574b7bd489be81f9c58497dc7dfe5d8859 (patch) | |
tree | 4bbca10d0e306d41bb576c8aa59062271c9d551a /pc-bios/s390-ccw/virtio.c | |
parent | 159855f098489160df9cb13ce1667a4d6dd76895 (diff) |
pc-bios/s390-ccw: support all virtio block size
The block size value may be given "as is" OR as a base value and
a shift count (exponent). So, we have to use calculation to get
the proper number in the code.
The main expression reads as
(blk_cfg.blk_size << blk_cfg.physical_block_exp)
E.g., various combinations between blk_size=1/physical_block_exp=12
and blk_size=4096/physical_block_exp=0 are valid for 4K blocks.
Signed-off-by: Eugene (jno) Dvurechenski <jno@linux.vnet.ibm.com>
Acked-by: Christian Borntraeger <borntraeger@de.ibm.com>
Reviewed-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
Signed-off-by: Jens Freimann <jfrei@linux.vnet.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Diffstat (limited to 'pc-bios/s390-ccw/virtio.c')
-rw-r--r-- | pc-bios/s390-ccw/virtio.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/pc-bios/s390-ccw/virtio.c b/pc-bios/s390-ccw/virtio.c index 31b23b086c..04977e4ab8 100644 --- a/pc-bios/s390-ccw/virtio.c +++ b/pc-bios/s390-ccw/virtio.c @@ -275,12 +275,14 @@ void virtio_assume_scsi(void) { guessed_disk_nature = true; blk_cfg.blk_size = 512; + blk_cfg.physical_block_exp = 0; } void virtio_assume_eckd(void) { guessed_disk_nature = true; blk_cfg.blk_size = 4096; + blk_cfg.physical_block_exp = 0; /* this must be here to calculate code segment position */ blk_cfg.geometry.heads = 15; @@ -290,31 +292,31 @@ void virtio_assume_eckd(void) bool virtio_disk_is_scsi(void) { if (guessed_disk_nature) { - return (blk_cfg.blk_size == 512); + return (virtio_get_block_size() == 512); } return (blk_cfg.geometry.heads == 255) && (blk_cfg.geometry.sectors == 63) - && (blk_cfg.blk_size == 512); + && (virtio_get_block_size() == 512); } bool virtio_disk_is_eckd(void) { if (guessed_disk_nature) { - return (blk_cfg.blk_size == 4096); + return (virtio_get_block_size() == 4096); } return (blk_cfg.geometry.heads == 15) && (blk_cfg.geometry.sectors == 12) - && (blk_cfg.blk_size == 4096); + && (virtio_get_block_size() == 4096); } bool virtio_ipl_disk_is_valid(void) { - return blk_cfg.blk_size && (virtio_disk_is_scsi() || virtio_disk_is_eckd()); + return virtio_disk_is_scsi() || virtio_disk_is_eckd(); } int virtio_get_block_size(void) { - return blk_cfg.blk_size; + return blk_cfg.blk_size << blk_cfg.physical_block_exp; } uint16_t virtio_get_cylinders(void) |