version 1.9, 2020/10/18 18:05:48 |
version 1.10, 2020/11/28 15:24:05 |
Line 127 efi_block_find_partitions_cd9660(struct |
|
Line 127 efi_block_find_partitions_cd9660(struct |
|
EFI_LBA lba; |
EFI_LBA lba; |
UINT32 sz; |
UINT32 sz; |
|
|
|
if (bdev->bio->Media->BlockSize != DEV_BSIZE && |
|
bdev->bio->Media->BlockSize != ISO_DEFAULT_BLOCK_SIZE) { |
|
return ENXIO; |
|
} |
|
|
sz = __MAX(sizeof(*vd), bdev->bio->Media->BlockSize); |
sz = __MAX(sizeof(*vd), bdev->bio->Media->BlockSize); |
sz = roundup(sz, bdev->bio->Media->BlockSize); |
sz = roundup(sz, bdev->bio->Media->BlockSize); |
if ((buf = efi_block_allocate_device_buffer(bdev, sz, &buf_start)) == NULL) |
if ((buf = efi_block_allocate_device_buffer(bdev, sz, &buf_start)) == NULL) { |
return ENOMEM; |
return ENOMEM; |
|
} |
|
|
for (lba = 16;; lba++) { |
for (lba = 16;; lba++) { |
status = uefi_call_wrapper(bdev->bio->ReadBlocks, 5, bdev->bio, bdev->media_id, |
status = uefi_call_wrapper(bdev->bio->ReadBlocks, 5, |
lba, sz, buf_start); |
bdev->bio, |
if (EFI_ERROR(status)) |
bdev->media_id, |
|
lba * ISO_DEFAULT_BLOCK_SIZE / bdev->bio->Media->BlockSize, |
|
sz, |
|
buf_start); |
|
if (EFI_ERROR(status)) { |
goto io_error; |
goto io_error; |
|
} |
|
|
vd = (struct iso_primary_descriptor *)buf_start; |
vd = (struct iso_primary_descriptor *)buf_start; |
if (memcmp(vd->id, ISO_STANDARD_ID, sizeof vd->id) != 0) |
if (memcmp(vd->id, ISO_STANDARD_ID, sizeof vd->id) != 0) { |
goto io_error; |
goto io_error; |
if (isonum_711(vd->type) == ISO_VD_END) |
} |
|
if (isonum_711(vd->type) == ISO_VD_END) { |
goto io_error; |
goto io_error; |
if (isonum_711(vd->type) == ISO_VD_PRIMARY) |
} |
|
if (isonum_711(vd->type) == ISO_VD_PRIMARY) { |
break; |
break; |
|
} |
} |
} |
|
|
if (isonum_723(vd->logical_block_size) != ISO_DEFAULT_BLOCK_SIZE) |
if (isonum_723(vd->logical_block_size) != ISO_DEFAULT_BLOCK_SIZE) { |
goto io_error; |
goto io_error; |
|
} |
|
|
bpart = alloc(sizeof(*bpart)); |
bpart = alloc(sizeof(*bpart)); |
bpart->index = 0; |
bpart->index = 0; |
Line 593 efi_block_strategy(void *devdata, int rw |
|
Line 608 efi_block_strategy(void *devdata, int rw |
|
dblk += le64toh(bpart->gpt.ent.ent_lba_start); |
dblk += le64toh(bpart->gpt.ent.ent_lba_start); |
break; |
break; |
case EFI_BLOCK_PART_CD9660: |
case EFI_BLOCK_PART_CD9660: |
|
dblk *= ISO_DEFAULT_BLOCK_SIZE / bpart->bdev->bio->Media->BlockSize; |
break; |
break; |
default: |
default: |
return EINVAL; |
return EINVAL; |
Line 603 efi_block_strategy(void *devdata, int rw |
|
Line 619 efi_block_strategy(void *devdata, int rw |
|
allocated_buf = NULL; |
allocated_buf = NULL; |
aligned_buf = buf; |
aligned_buf = buf; |
} else if ((allocated_buf = efi_block_allocate_device_buffer(bpart->bdev, |
} else if ((allocated_buf = efi_block_allocate_device_buffer(bpart->bdev, |
size, &aligned_buf)) == NULL) |
size, &aligned_buf)) == NULL) { |
return ENOMEM; |
return ENOMEM; |
|
} |
|
|
status = uefi_call_wrapper(bpart->bdev->bio->ReadBlocks, 5, |
status = uefi_call_wrapper(bpart->bdev->bio->ReadBlocks, 5, |
bpart->bdev->bio, bpart->bdev->media_id, dblk, size, aligned_buf); |
bpart->bdev->bio, bpart->bdev->media_id, dblk, size, aligned_buf); |