[ipxe-devel] [PATCH 1/1] [efi] remove special handling of block devices
Vishvananda Ishaya Abrams
vish.ishaya at oracle.com
Tue Dec 13 02:16:24 UTC 2016
Uefi iscsi sanboot does not require a block size of 2048, and changing
the block size breaks windows installations which expose an iso9660
filesystem in addition to a GPT.
Therefore, remove the block remapping code and just keep the default
block size in uefi mode.
---
src/interface/efi/efi_block.c | 87 +------------------------------------------
1 file changed, 2 insertions(+), 85 deletions(-)
diff --git a/src/interface/efi/efi_block.c b/src/interface/efi/efi_block.c
index 0609029..3dc0348 100644
--- a/src/interface/efi/efi_block.c
+++ b/src/interface/efi/efi_block.c
@@ -626,76 +626,12 @@ efi_block_path ( struct uri *uri, EFI_DEVICE_PATH_PROTOCOL *parent ) {
}
/**
- * Configure EFI block device as a CD-ROM, if applicable
- *
- * @v block Block device
- * @v scratch Scratch data area
- * @ret rc Return status code
- *
- * The EDK2 code will ignore CD-ROM devices with a block size other
- * than 2048. While we could require the user to configure the block
- * size appropriately, this is non-trivial and would impose a
- * substantial learning effort on the user. Instead, we perform
- * essentially the same auto-detection as under a BIOS SAN boot; if
- * the ISO9660 primary volume descriptor is present then we force a
- * block size of 2048 and map read/write requests appropriately.
- */
-static int efi_block_parse_iso9660 ( struct efi_block *block, void *scratch ) {
- static const struct iso9660_primary_descriptor_fixed primary_check = {
- .type = ISO9660_TYPE_PRIMARY,
- .id = ISO9660_ID,
- };
- struct iso9660_primary_descriptor *primary = scratch;
- struct efi_block_command_context context;
- unsigned int blksize;
- unsigned int blksize_shift;
- int rc;
-
- /* Calculate required blocksize shift for potential CD-ROM access */
- blksize = block->capacity.blksize;
- blksize_shift = 0;
- while ( blksize < ISO9660_BLKSIZE ) {
- blksize <<= 1;
- blksize_shift++;
- }
- if ( blksize > ISO9660_BLKSIZE ) {
- /* Cannot be a CD-ROM */
- return 0;
- }
-
- /* Read primary volume descriptor */
- memset ( &context, 0, sizeof ( context ) );
- context.lba = ( ISO9660_PRIMARY_LBA << blksize_shift );
- context.data = primary;
- context.len = ISO9660_BLKSIZE;
- context.block_rw = block_read;
- if ( ( rc = efi_block_command ( block, efi_block_cmd_rw,
- &context ) ) != 0 ) {
- DBGC ( block, "EFIBLK %#02x could not read ISO9660 primary "
- "volume descriptor: %s\n",
- block->drive, strerror ( rc ) );
- return rc;
- }
-
- /* Do nothing unless this is an ISO image */
- if ( memcmp ( primary, &primary_check, sizeof ( primary_check ) ) != 0 )
- return 0;
- DBGC ( block, "EFIBLK %#02x contains an ISO9660 filesystem; treating "
- "as CD-ROM\n", block->drive );
- block->blksize_shift = blksize_shift;
-
- return 0;
-}
-
-/**
* Determing EFI block device capacity and block size
*
* @v block Block device
* @ret rc Return status code
*/
static int efi_block_capacity ( struct efi_block *block ) {
- size_t scratch_len;
- void *scratch;
int rc;
/* Read read block capacity */
@@ -704,32 +640,13 @@ static int efi_block_capacity ( struct efi_block *block ) {
goto err_read_capacity;
block->blksize_shift = 0;
- /* Allocate scratch area */
- scratch_len = ( block->capacity.blksize );
- if ( scratch_len < ISO9660_BLKSIZE )
- scratch_len = ISO9660_BLKSIZE;
- scratch = malloc ( scratch_len );
- if ( ! scratch ) {
- rc = -ENOMEM;
- goto err_alloc;
- }
-
- /* Configure as a CD-ROM, if applicable */
- if ( ( rc = efi_block_parse_iso9660 ( block, scratch ) ) != 0 )
- goto err_parse_iso9660;
-
/* Update media descriptor */
- block->media.BlockSize =
- ( block->capacity.blksize << block->blksize_shift );
- block->media.LastBlock =
- ( ( block->capacity.blocks >> block->blksize_shift ) - 1 );
+ block->media.BlockSize = block->capacity.blksize;
+ block->media.LastBlock = block->capacity.blocks - 1 ;
/* Success */
rc = 0;
- err_parse_iso9660:
- free ( scratch );
- err_alloc:
err_read_capacity:
return rc;
}
--
2.5.0
More information about the ipxe-devel
mailing list