diff options
author | Eugene (jno) Dvurechenski <jno@linux.vnet.ibm.com> | 2014-05-19 20:10:27 +0200 |
---|---|---|
committer | Cornelia Huck <cornelia.huck@de.ibm.com> | 2014-06-27 12:10:03 +0200 |
commit | 91a03f9b6953cca0e8c05402e141a576b01063e2 (patch) | |
tree | a09959f4ebd8b7cb7db193cda86e4150bfce6507 /pc-bios/s390-ccw/bootmap.c | |
parent | 26f2bbd6b1c6ef6eb3f84a2ddb0be92f4d93049a (diff) |
pc-bios/s390-ccw: handle different sector sizes
Use the virtio device's configuration to figure out the disk geometry
and use a sector size based upon the layout.
[CH: s/SECTOR_SIZE/MAX_SECTOR_SIZE/g]
Acked-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Eugene (jno) Dvurechenski <jno@linux.vnet.ibm.com>
Signed-off-by: Jens Freimann <jfrei@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Diffstat (limited to 'pc-bios/s390-ccw/bootmap.c')
-rw-r--r-- | pc-bios/s390-ccw/bootmap.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/pc-bios/s390-ccw/bootmap.c b/pc-bios/s390-ccw/bootmap.c index c216030861..fa2ca26e31 100644 --- a/pc-bios/s390-ccw/bootmap.c +++ b/pc-bios/s390-ccw/bootmap.c @@ -10,6 +10,7 @@ #include "s390-ccw.h" #include "bootmap.h" +#include "virtio.h" /* #define DEBUG_FALLBACK */ @@ -22,7 +23,8 @@ #endif /* Scratch space */ -static uint8_t sec[SECTOR_SIZE] __attribute__((__aligned__(SECTOR_SIZE))); +static uint8_t sec[MAX_SECTOR_SIZE] +__attribute__((__aligned__(MAX_SECTOR_SIZE))); typedef struct ResetInfo { uint32_t ipl_mask; @@ -99,7 +101,7 @@ static inline bool unused_space(const void *p, unsigned int size) static int zipl_load_segment(ComponentEntry *entry) { - const int max_entries = (SECTOR_SIZE / sizeof(ScsiBlockPtr)); + const int max_entries = (MAX_SECTOR_SIZE / sizeof(ScsiBlockPtr)); ScsiBlockPtr *bprs = (void *)sec; const int bprs_size = sizeof(sec); uint64_t blockno; @@ -163,7 +165,7 @@ static int zipl_run(ScsiBlockPtr *pte) { ComponentHeader *header; ComponentEntry *entry; - uint8_t tmp_sec[SECTOR_SIZE]; + uint8_t tmp_sec[MAX_SECTOR_SIZE]; virtio_read(pte->blockno, tmp_sec); header = (ComponentHeader *)tmp_sec; @@ -187,7 +189,7 @@ static int zipl_run(ScsiBlockPtr *pte) entry++; - if ((uint8_t *)(&entry[1]) > (tmp_sec + SECTOR_SIZE)) { + if ((uint8_t *)(&entry[1]) > (tmp_sec + MAX_SECTOR_SIZE)) { goto fail; } } @@ -238,7 +240,7 @@ int zipl_load(void) goto fail; } - ns_end = sec + SECTOR_SIZE; + ns_end = sec + virtio_get_block_size(); for (ns = (sec + pte_len); (ns + pte_len) < ns_end; ns++) { prog_table_entry = (ScsiBlockPtr *)ns; if (!prog_table_entry->blockno) { |