/* Read boot record volume descriptor */
if ( ( rc = sandev_read ( sandev, ELTORITO_LBA, 1,
virt_to_user ( boot ) ) ) != 0 ) {
- DBGC ( sandev, "INT13 drive %02x could not read El Torito boot "
- "record volume descriptor: %s\n",
+ DBGC ( sandev->drive, "INT13 drive %02x could not read El "
+ "Torito boot record volume descriptor: %s\n",
sandev->drive, strerror ( rc ) );
return rc;
}
/* Check for an El Torito boot catalog */
if ( memcmp ( boot, &boot_check, sizeof ( boot_check ) ) == 0 ) {
int13->boot_catalog = boot->sector;
- DBGC ( sandev, "INT13 drive %02x has an El Torito boot catalog "
- "at LBA %08x\n", sandev->drive, int13->boot_catalog );
+ DBGC ( sandev->drive, "INT13 drive %02x has an El Torito boot "
+ "catalog at LBA %08x\n", sandev->drive,
+ int13->boot_catalog );
} else {
- DBGC ( sandev, "INT13 drive %02x has no El Torito boot "
+ DBGC ( sandev->drive, "INT13 drive %02x has no El Torito boot "
"catalog\n", sandev->drive );
}
/* Read partition table */
if ( ( rc = sandev_read ( sandev, 0, 1, virt_to_user ( mbr ) ) ) != 0 ) {
- DBGC ( sandev, "INT13 drive %02x could not read "
+ DBGC ( sandev->drive, "INT13 drive %02x could not read "
"partition table to guess geometry: %s\n",
sandev->drive, strerror ( rc ) );
return rc;
}
- DBGC2 ( sandev, "INT13 drive %02x has MBR:\n", sandev->drive );
- DBGC2_HDA ( sandev, 0, mbr, sizeof ( *mbr ) );
- DBGC ( sandev, "INT13 drive %02x has signature %08x\n",
+ DBGC2 ( sandev->drive, "INT13 drive %02x has MBR:\n", sandev->drive );
+ DBGC2_HDA ( sandev->drive, 0, mbr, sizeof ( *mbr ) );
+ DBGC ( sandev->drive, "INT13 drive %02x has signature %08x\n",
sandev->drive, mbr->signature );
/* Scan through partition table and modify guesses for
if ( ( start_cylinder == 0 ) && ( start_head != 0 ) ) {
*sectors = ( ( partition->start + 1 - start_sector ) /
start_head );
- DBGC ( sandev, "INT13 drive %02x guessing C/H/S "
- "xx/xx/%d based on partition %d\n",
+ DBGC ( sandev->drive, "INT13 drive %02x guessing "
+ "C/H/S xx/xx/%d based on partition %d\n",
sandev->drive, *sectors, ( i + 1 ) );
}
end_sector = PART_SECTOR ( partition->chs_end );
if ( ( end_head + 1 ) > *heads ) {
*heads = ( end_head + 1 );
- DBGC ( sandev, "INT13 drive %02x guessing C/H/S "
- "xx/%d/xx based on partition %d\n",
+ DBGC ( sandev->drive, "INT13 drive %02x guessing "
+ "C/H/S xx/%d/xx based on partition %d\n",
sandev->drive, *heads, ( i + 1 ) );
}
if ( end_sector > *sectors ) {
*sectors = end_sector;
- DBGC ( sandev, "INT13 drive %02x guessing C/H/S "
- "xx/xx/%d based on partition %d\n",
+ DBGC ( sandev->drive, "INT13 drive %02x guessing "
+ "C/H/S xx/xx/%d based on partition %d\n",
sandev->drive, *sectors, ( i + 1 ) );
}
}
*heads = INT13_FDD_HEADS ( geometry );
*sectors = INT13_FDD_SECTORS ( geometry );
if ( ( cylinders * (*heads) * (*sectors) ) == blocks ) {
- DBGC ( sandev, "INT13 drive %02x guessing C/H/S "
- "%d/%d/%d based on size %dK\n", sandev->drive,
- cylinders, *heads, *sectors, ( blocks / 2 ) );
+ DBGC ( sandev->drive, "INT13 drive %02x guessing "
+ "C/H/S %d/%d/%d based on size %dK\n",
+ sandev->drive, cylinders, *heads, *sectors,
+ ( blocks / 2 ) );
return 0;
}
}
*/
*heads = 2;
*sectors = 18;
- DBGC ( sandev, "INT13 drive %02x guessing C/H/S xx/%d/%d based on size "
- "%dK\n", sandev->drive, *heads, *sectors, ( blocks / 2 ) );
+ DBGC ( sandev->drive, "INT13 drive %02x guessing C/H/S xx/%d/%d "
+ "based on size %dK\n", sandev->drive, *heads, *sectors,
+ ( blocks / 2 ) );
return 0;
}
required = ( ( max_drive & 0x7f ) + 1 );
if ( *counter < required ) {
*counter = required;
- DBGC ( sandev, "INT13 drive %02x added to drive count: "
- "%d HDDs, %d FDDs\n",
+ DBGC ( sandev->drive, "INT13 drive %02x added to "
+ "drive count: %d HDDs, %d FDDs\n",
sandev->drive, num_drives, num_fdds );
}
}
struct i386_all_regs *ix86 __unused ) {
int rc;
- DBGC2 ( sandev, "Reset drive\n" );
+ DBGC2 ( sandev->drive, "Reset drive\n" );
/* Reset SAN device */
if ( ( rc = sandev_reset ( sandev ) ) != 0 )
struct i386_all_regs *ix86 __unused ) {
struct int13_data *int13 = sandev->priv;
- DBGC2 ( sandev, "Get status of last operation\n" );
+ DBGC2 ( sandev->drive, "Get status of last operation\n" );
return int13->last_status;
}
/* Validate blocksize */
if ( sandev_blksize ( sandev ) != INT13_BLKSIZE ) {
- DBGC ( sandev, "\nINT 13 drive %02x invalid blocksize (%zd) "
- "for non-extended read/write\n",
+ DBGC ( sandev->drive, "\nINT 13 drive %02x invalid blocksize "
+ "(%zd) for non-extended read/write\n",
sandev->drive, sandev_blksize ( sandev ) );
return -INT13_STATUS_INVALID;
}
if ( ( cylinder >= int13->cylinders ) ||
( head >= int13->heads ) ||
( sector < 1 ) || ( sector > int13->sectors_per_track ) ) {
- DBGC ( sandev, "C/H/S %d/%d/%d out of range for geometry "
- "%d/%d/%d\n", cylinder, head, sector, int13->cylinders,
- int13->heads, int13->sectors_per_track );
+ DBGC ( sandev->drive, "C/H/S %d/%d/%d out of range for "
+ "geometry %d/%d/%d\n", cylinder, head, sector,
+ int13->cylinders, int13->heads,
+ int13->sectors_per_track );
return -INT13_STATUS_INVALID;
}
lba = ( ( ( ( cylinder * int13->heads ) + head )
count = ix86->regs.al;
buffer = real_to_user ( ix86->segs.es, ix86->regs.bx );
- DBGC2 ( sandev, "C/H/S %d/%d/%d = LBA %08lx <-> %04x:%04x (count %d)\n",
- cylinder, head, sector, lba, ix86->segs.es, ix86->regs.bx,
- count );
+ DBGC2 ( sandev->drive, "C/H/S %d/%d/%d = LBA %08lx <-> %04x:%04x "
+ "(count %d)\n", cylinder, head, sector, lba, ix86->segs.es,
+ ix86->regs.bx, count );
/* Read from / write to block device */
if ( ( rc = sandev_rw ( sandev, lba, count, buffer ) ) != 0 ){
- DBGC ( sandev, "INT13 drive %02x I/O failed: %s\n",
+ DBGC ( sandev->drive, "INT13 drive %02x I/O failed: %s\n",
sandev->drive, strerror ( rc ) );
return -INT13_STATUS_READ_ERROR;
}
static int int13_read_sectors ( struct san_device *sandev,
struct i386_all_regs *ix86 ) {
- DBGC2 ( sandev, "Read: " );
+ DBGC2 ( sandev->drive, "Read: " );
return int13_rw_sectors ( sandev, ix86, sandev_read );
}
static int int13_write_sectors ( struct san_device *sandev,
struct i386_all_regs *ix86 ) {
- DBGC2 ( sandev, "Write: " );
+ DBGC2 ( sandev->drive, "Write: " );
return int13_rw_sectors ( sandev, ix86, sandev_write );
}
unsigned int max_head = int13->heads - 1;
unsigned int max_sector = int13->sectors_per_track; /* sic */
- DBGC2 ( sandev, "Get drive parameters\n" );
+ DBGC2 ( sandev->drive, "Get drive parameters\n" );
/* Validate blocksize */
if ( sandev_blksize ( sandev ) != INT13_BLKSIZE ) {
- DBGC ( sandev, "\nINT 13 drive %02x invalid blocksize (%zd) "
- "for non-extended parameters\n",
+ DBGC ( sandev->drive, "\nINT 13 drive %02x invalid blocksize "
+ "(%zd) for non-extended parameters\n",
sandev->drive, sandev_blksize ( sandev ) );
return -INT13_STATUS_INVALID;
}
struct i386_all_regs *ix86 ) {
uint32_t blocks;
- DBGC2 ( sandev, "Get disk type\n" );
+ DBGC2 ( sandev->drive, "Get disk type\n" );
if ( int13_is_fdd ( sandev ) ) {
return INT13_DISK_TYPE_FDD;
struct i386_all_regs *ix86 ) {
if ( ( ix86->regs.bx == 0x55aa ) && ! int13_is_fdd ( sandev ) ) {
- DBGC2 ( sandev, "INT13 extensions installation check\n" );
+ DBGC2 ( sandev->drive, "INT13 extensions check\n" );
ix86->regs.bx = 0xaa55;
ix86->regs.cx = ( INT13_EXTENSION_LINEAR |
INT13_EXTENSION_EDD |
get_real ( bufsize, ix86->segs.ds,
( ix86->regs.si + offsetof ( typeof ( addr ), bufsize ) ) );
if ( bufsize < offsetof ( typeof ( addr ), buffer_phys ) ) {
- DBGC2 ( sandev, "<invalid buffer size %#02x\n>\n", bufsize );
+ DBGC2 ( sandev->drive, "<invalid buffer size %#02x\n>\n",
+ bufsize );
return -INT13_STATUS_INVALID;
}
memset ( &addr, 0, sizeof ( addr ) );
copy_from_real ( &addr, ix86->segs.ds, ix86->regs.si, bufsize );
lba = addr.lba;
- DBGC2 ( sandev, "LBA %08llx <-> ", ( ( unsigned long long ) lba ) );
+ DBGC2 ( sandev->drive, "LBA %08llx <-> ",
+ ( ( unsigned long long ) lba ) );
if ( ( addr.count == 0xff ) ||
( ( addr.buffer.segment == 0xffff ) &&
( addr.buffer.offset == 0xffff ) ) ) {
buffer = phys_to_user ( addr.buffer_phys );
- DBGC2 ( sandev, "%08llx",
+ DBGC2 ( sandev->drive, "%08llx",
( ( unsigned long long ) addr.buffer_phys ) );
} else {
buffer = real_to_user ( addr.buffer.segment,
addr.buffer.offset );
- DBGC2 ( sandev, "%04x:%04x", addr.buffer.segment,
+ DBGC2 ( sandev->drive, "%04x:%04x", addr.buffer.segment,
addr.buffer.offset );
}
if ( addr.count <= 0x7f ) {
} else if ( addr.count == 0xff ) {
count = addr.long_count;
} else {
- DBGC2 ( sandev, " <invalid count %#02x>\n", addr.count );
+ DBGC2 ( sandev->drive, " <invalid count %#02x>\n", addr.count );
return -INT13_STATUS_INVALID;
}
- DBGC2 ( sandev, " (count %ld)\n", count );
+ DBGC2 ( sandev->drive, " (count %ld)\n", count );
/* Read from / write to block device */
if ( ( rc = sandev_rw ( sandev, lba, count, buffer ) ) != 0 ) {
- DBGC ( sandev, "INT13 drive %02x extended I/O failed: %s\n",
- sandev->drive, strerror ( rc ) );
+ DBGC ( sandev->drive, "INT13 drive %02x extended I/O failed: "
+ "%s\n", sandev->drive, strerror ( rc ) );
/* Record that no blocks were transferred successfully */
addr.count = 0;
put_real ( addr.count, ix86->segs.ds,
static int int13_extended_read ( struct san_device *sandev,
struct i386_all_regs *ix86 ) {
- DBGC2 ( sandev, "Extended read: " );
+ DBGC2 ( sandev->drive, "Extended read: " );
return int13_extended_rw ( sandev, ix86, sandev_read );
}
static int int13_extended_write ( struct san_device *sandev,
struct i386_all_regs *ix86 ) {
- DBGC2 ( sandev, "Extended write: " );
+ DBGC2 ( sandev->drive, "Extended write: " );
return int13_extended_rw ( sandev, ix86, sandev_write );
}
sizeof ( addr ));
lba = addr.lba;
count = addr.count;
- DBGC2 ( sandev, "Verify: LBA %08llx (count %ld)\n",
+ DBGC2 ( sandev->drive, "Verify: LBA %08llx (count %ld)\n",
( ( unsigned long long ) lba ), count );
}
sizeof ( addr ));
lba = addr.lba;
count = addr.count;
- DBGC2 ( sandev, "Seek: LBA %08llx (count %ld)\n",
+ DBGC2 ( sandev->drive, "Seek: LBA %08llx (count %ld)\n",
( ( unsigned long long ) lba ), count );
}
/* Get underlying hardware device */
device = identify_device ( &sanpath->block );
if ( ! device ) {
- DBGC ( sandev, "INT13 drive %02x cannot identify hardware "
- "device\n", sandev->drive );
+ DBGC ( sandev->drive, "INT13 drive %02x cannot identify "
+ "hardware device\n", sandev->drive );
return -ENODEV;
}
dpi->interface_path.pci.channel = 0xff; /* unused */
break;
default:
- DBGC ( sandev, "INT13 drive %02x unrecognised bus type %d\n",
- sandev->drive, desc->bus_type );
+ DBGC ( sandev->drive, "INT13 drive %02x unrecognised bus "
+ "type %d\n", sandev->drive, desc->bus_type );
return -ENOTSUP;
}
/* Get EDD block device description */
if ( ( rc = edd_describe ( &sanpath->block, &dpi->interface_type,
&dpi->device_path ) ) != 0 ) {
- DBGC ( sandev, "INT13 drive %02x cannot identify block device: "
- "%s\n", sandev->drive, strerror ( rc ) );
+ DBGC ( sandev->drive, "INT13 drive %02x cannot identify "
+ "block device: %s\n", sandev->drive, strerror ( rc ) );
return rc;
}
get_real ( bufsize, ix86->segs.ds,
( ix86->regs.si + offsetof ( typeof ( params ), bufsize )));
- DBGC2 ( sandev, "Get extended drive parameters to %04x:%04x+%02x\n",
- ix86->segs.ds, ix86->regs.si, bufsize );
+ DBGC2 ( sandev->drive, "Get extended drive parameters to "
+ "%04x:%04x+%02x\n", ix86->segs.ds, ix86->regs.si, bufsize );
/* Build drive parameters */
memset ( ¶ms, 0, sizeof ( params ) );
params.sector_size = sandev_blksize ( sandev );
memset ( ¶ms.dpte, 0xff, sizeof ( params.dpte ) );
if ( ( rc = int13_device_path_info ( sandev, ¶ms.dpi ) ) != 0 ) {
- DBGC ( sandev, "INT13 drive %02x could not provide device "
- "path information: %s\n",
+ DBGC ( sandev->drive, "INT13 drive %02x could not provide "
+ "device path information: %s\n",
sandev->drive, strerror ( rc ) );
len = offsetof ( typeof ( params ), dpi );
}
params.bufsize = offsetof ( typeof ( params ), dpi );
}
- DBGC ( sandev, "INT 13 drive %02x described using extended "
+ DBGC ( sandev->drive, "INT 13 drive %02x described using extended "
"parameters:\n", sandev->drive );
address.segment = ix86->segs.ds;
address.offset = ix86->regs.si;
- DBGC_HDA ( sandev, address, ¶ms, len );
+ DBGC_HDA ( sandev->drive, address, ¶ms, len );
/* Return drive parameters */
if ( len > bufsize )
struct i386_all_regs *ix86 ) {
struct int13_cdrom_specification specification;
- DBGC2 ( sandev, "Get CD-ROM emulation status to %04x:%04x%s\n",
+ DBGC2 ( sandev->drive, "Get CD-ROM emulation status to %04x:%04x%s\n",
ix86->segs.ds, ix86->regs.si,
( ix86->regs.al ? "" : " and terminate" ) );
/* Fail if we are not a CD-ROM */
if ( ! sandev->is_cdrom ) {
- DBGC ( sandev, "INT13 drive %02x is not a CD-ROM\n",
+ DBGC ( sandev->drive, "INT13 drive %02x is not a CD-ROM\n",
sandev->drive );
return -INT13_STATUS_INVALID;
}
/* Read parameters from command packet */
copy_from_real ( &command, ix86->segs.ds, ix86->regs.si,
sizeof ( command ) );
- DBGC2 ( sandev, "Read CD-ROM boot catalog to %08x\n", command.buffer );
+ DBGC2 ( sandev->drive, "Read CD-ROM boot catalog to %08x\n",
+ command.buffer );
/* Fail if we have no boot catalog */
if ( ! int13->boot_catalog ) {
- DBGC ( sandev, "INT13 drive %02x has no boot catalog\n",
+ DBGC ( sandev->drive, "INT13 drive %02x has no boot catalog\n",
sandev->drive );
return -INT13_STATUS_INVALID;
}
/* Read from boot catalog */
if ( ( rc = sandev_read ( sandev, start, command.count,
phys_to_user ( command.buffer ) ) ) != 0 ) {
- DBGC ( sandev, "INT13 drive %02x could not read boot catalog: "
- "%s\n", sandev->drive, strerror ( rc ) );
+ DBGC ( sandev->drive, "INT13 drive %02x could not read boot "
+ "catalog: %s\n", sandev->drive, strerror ( rc ) );
return -INT13_STATUS_READ_ERROR;
}
if ( bios_drive != sandev->drive ) {
/* Remap any accesses to this drive's natural number */
if ( bios_drive == int13->natural_drive ) {
- DBGC2 ( sandev, "INT13,%02x (%02x) remapped to "
- "(%02x)\n", ix86->regs.ah,
+ DBGC2 ( sandev->drive, "INT13,%02x (%02x) "
+ "remapped to (%02x)\n", ix86->regs.ah,
bios_drive, sandev->drive );
ix86->regs.dl = sandev->drive;
return;
}
}
- DBGC2 ( sandev, "INT13,%02x (%02x): ",
+ DBGC2 ( sandev->drive, "INT13,%02x (%02x): ",
ix86->regs.ah, bios_drive );
switch ( command ) {
status = int13_cdrom_read_boot_catalog ( sandev, ix86 );
break;
default:
- DBGC2 ( sandev, "*** Unrecognised INT13 ***\n" );
+ DBGC2 ( sandev->drive, "*** Unrecognised INT13 ***\n" );
status = -INT13_STATUS_INVALID;
break;
}
/* Negative status indicates an error */
if ( status < 0 ) {
status = -status;
- DBGC ( sandev, "INT13,%02x (%02x) failed with status "
- "%02x\n", ix86->regs.ah, sandev->drive, status );
+ DBGC ( sandev->drive, "INT13,%02x (%02x) failed with "
+ "status %02x\n", ix86->regs.ah, sandev->drive,
+ status );
} else {
ix86->flags &= ~CF;
}
/* Register SAN device */
if ( ( rc = register_sandev ( sandev, drive, flags ) ) != 0 ) {
- DBGC ( sandev, "INT13 drive %02x could not register: %s\n",
+ DBGC ( drive, "INT13 drive %02x could not register: %s\n",
drive, strerror ( rc ) );
goto err_register;
}
( ( rc = int13_guess_geometry ( sandev, scratch ) ) != 0 ) )
goto err_guess_geometry;
- DBGC ( sandev, "INT13 drive %02x (naturally %02x) registered with "
- "C/H/S geometry %d/%d/%d\n",
- sandev->drive, int13->natural_drive, int13->cylinders,
- int13->heads, int13->sectors_per_track );
+ DBGC ( drive, "INT13 drive %02x (naturally %02x) registered with "
+ "C/H/S geometry %d/%d/%d\n", drive, int13->natural_drive,
+ int13->cylinders, int13->heads, int13->sectors_per_track );
/* Hook INT 13 vector if not already hooked */
if ( need_hook ) {
/* Find drive */
sandev = sandev_find ( drive );
if ( ! sandev ) {
- DBG ( "INT13 cannot find drive %02x\n", drive );
+ DBGC ( drive, "INT13 drive %02x is not a SAN drive\n", drive );
return;
}
* to do so reliably.
*/
- DBGC ( sandev, "INT13 drive %02x unregistered\n", sandev->drive );
+ DBGC ( drive, "INT13 drive %02x unregistered\n", drive );
/* Unhook INT 13 vector if no more drives */
if ( ! have_sandevs() ) {
: "a" ( 0x0201 ), "b" ( *address ),
"c" ( 1 ), "d" ( drive ) );
if ( status ) {
- DBG ( "INT13 drive %02x could not read MBR (status %04x)\n",
- drive, status );
+ DBGC ( drive, "INT13 drive %02x could not read MBR (status "
+ "%04x)\n", drive, status );
return -EIO;
}
( address->offset +
offsetof ( struct master_boot_record, magic ) ) );
if ( magic != INT13_MBR_MAGIC ) {
- DBG ( "INT13 drive %02x does not contain a valid MBR\n",
- drive );
+ DBGC ( drive, "INT13 drive %02x does not contain a valid MBR\n",
+ drive );
return -ENOEXEC;
}
: "a" ( 0x4d00 ), "d" ( drive ),
"S" ( __from_data16 ( &eltorito_cmd ) ) );
if ( status ) {
- DBG ( "INT13 drive %02x could not read El Torito boot catalog "
- "(status %04x)\n", drive, status );
+ DBGC ( drive, "INT13 drive %02x could not read El Torito boot "
+ "catalog (status %04x)\n", drive, status );
return -EIO;
}
copy_from_user ( &catalog, phys_to_user ( eltorito_cmd.buffer ), 0,
/* Sanity checks */
if ( catalog.valid.platform_id != ELTORITO_PLATFORM_X86 ) {
- DBG ( "INT13 drive %02x El Torito specifies unknown platform "
- "%02x\n", drive, catalog.valid.platform_id );
+ DBGC ( drive, "INT13 drive %02x El Torito specifies unknown "
+ "platform %02x\n", drive, catalog.valid.platform_id );
return -ENOEXEC;
}
if ( catalog.boot.indicator != ELTORITO_BOOTABLE ) {
- DBG ( "INT13 drive %02x El Torito is not bootable\n", drive );
+ DBGC ( drive, "INT13 drive %02x El Torito is not bootable\n",
+ drive );
return -ENOEXEC;
}
if ( catalog.boot.media_type != ELTORITO_NO_EMULATION ) {
- DBG ( "INT13 drive %02x El Torito requires emulation "
+ DBGC ( drive, "INT13 drive %02x El Torito requires emulation "
"type %02x\n", drive, catalog.boot.media_type );
return -ENOTSUP;
}
- DBG ( "INT13 drive %02x El Torito boot image at LBA %08x (count %d)\n",
- drive, catalog.boot.start, catalog.boot.length );
+ DBGC ( drive, "INT13 drive %02x El Torito boot image at LBA %08x "
+ "(count %d)\n", drive, catalog.boot.start, catalog.boot.length );
address->segment = ( catalog.boot.load_segment ?
catalog.boot.load_segment : 0x7c0 );
address->offset = 0;
- DBG ( "INT13 drive %02x El Torito boot image loads at %04x:%04x\n",
- drive, address->segment, address->offset );
+ DBGC ( drive, "INT13 drive %02x El Torito boot image loads at "
+ "%04x:%04x\n", drive, address->segment, address->offset );
/* Use INT 13, 42 to read the boot image */
eltorito_address.bufsize =
: "a" ( 0x4200 ), "d" ( drive ),
"S" ( __from_data16 ( &eltorito_address ) ) );
if ( status ) {
- DBG ( "INT13 drive %02x could not read El Torito boot image "
- "(status %04x)\n", drive, status );
+ DBGC ( drive, "INT13 drive %02x could not read El Torito boot "
+ "image (status %04x)\n", drive, status );
return -EIO;
}
/* Jump to boot sector */
if ( ( rc = call_bootsector ( address.segment, address.offset,
drive ) ) != 0 ) {
- DBG ( "INT13 drive %02x boot returned: %s\n",
- drive, strerror ( rc ) );
+ DBGC ( drive, "INT13 drive %02x boot returned: %s\n",
+ drive, strerror ( rc ) );
return rc;
}
/* Open interface */
if ( ( rc = xfer_open_uri ( &sanpath->block, sanpath->uri ) ) != 0 ) {
- DBGC ( sandev, "SAN %#02x.%d could not (re)open URI: "
+ DBGC ( sandev->drive, "SAN %#02x.%d could not (re)open URI: "
"%s\n", sandev->drive, sanpath->index, strerror ( rc ) );
return rc;
}
/* Any closure is an error from our point of view */
if ( rc == 0 )
rc = -ENOTCONN;
- DBGC ( sandev, "SAN %#02x.%d closed: %s\n",
+ DBGC ( sandev->drive, "SAN %#02x.%d closed: %s\n",
sandev->drive, sanpath->index, strerror ( rc ) );
/* Close path */
/* Mark as active path or close as applicable */
if ( ! sandev->active ) {
- DBGC ( sandev, "SAN %#02x.%d is active\n",
+ DBGC ( sandev->drive, "SAN %#02x.%d is active\n",
sandev->drive, sanpath->index );
sandev->active = sanpath;
} else {
- DBGC ( sandev, "SAN %#02x.%d is available\n",
+ DBGC ( sandev->drive, "SAN %#02x.%d is available\n",
sandev->drive, sanpath->index );
sanpath_close ( sanpath, 0 );
}
rc = sanpath->path_rc;
break;
}
- DBGC ( sandev, "SAN %#02x never became available: %s\n",
- sandev->drive, strerror ( rc ) );
+ DBGC ( sandev->drive, "SAN %#02x never became "
+ "available: %s\n", sandev->drive,
+ strerror ( rc ) );
goto err_none;
}
}
if ( ( rc = params->rw.block_rw ( &sanpath->block, &sandev->command,
params->rw.lba, params->rw.count,
params->rw.buffer, len ) ) != 0 ) {
- DBGC ( sandev, "SAN %#02x.%d could not initiate read/write: "
- "%s\n", sandev->drive, sanpath->index, strerror ( rc ) );
+ DBGC ( sandev->drive, "SAN %#02x.%d could not initiate "
+ "read/write: %s\n", sandev->drive, sanpath->index,
+ strerror ( rc ) );
return rc;
}
/* Initiate read capacity command */
if ( ( rc = block_read_capacity ( &sanpath->block,
&sandev->command ) ) != 0 ) {
- DBGC ( sandev, "SAN %#02x.%d could not initiate read capacity: "
- "%s\n", sandev->drive, sanpath->index, strerror ( rc ) );
+ DBGC ( sandev->drive, "SAN %#02x.%d could not initiate read "
+ "capacity: %s\n", sandev->drive, sanpath->index,
+ strerror ( rc ) );
return rc;
}
int sandev_reset ( struct san_device *sandev ) {
int rc;
- DBGC ( sandev, "SAN %#02x reset\n", sandev->drive );
+ DBGC ( sandev->drive, "SAN %#02x reset\n", sandev->drive );
/* Close and reopen underlying block device */
if ( ( rc = sandev_reopen ( sandev ) ) != 0 )
if ( ! desc )
continue;
if ( ( rc = desc->model->complete ( desc ) ) != 0 ) {
- DBGC ( sandev, "SAN %#02x.%d could not be "
- "described: %s\n", sandev->drive,
+ DBGC ( sandev->drive, "SAN %#02x.%d could not "
+ "be described: %s\n", sandev->drive,
sanpath->index, strerror ( rc ) );
return rc;
}
/* Read primary volume descriptor */
if ( ( rc = sandev_read ( sandev, lba, count,
virt_to_user ( scratch ) ) ) != 0 ) {
- DBGC ( sandev, "SAN %#02x could not read ISO9660 primary"
- "volume descriptor: %s\n",
+ DBGC ( sandev->drive, "SAN %#02x could not read ISO9660 "
+ "primary volume descriptor: %s\n",
sandev->drive, strerror ( rc ) );
goto err_rw;
}
/* Configure as CD-ROM if applicable */
if ( memcmp ( &scratch->primary.fixed, &primary_check,
sizeof ( primary_check ) ) == 0 ) {
- DBGC ( sandev, "SAN %#02x contains an ISO9660 filesystem; "
- "treating as CD-ROM\n", sandev->drive );
+ DBGC ( sandev->drive, "SAN %#02x contains an ISO9660 "
+ "filesystem; treating as CD-ROM\n", sandev->drive );
sandev->blksize_shift = blksize_shift;
sandev->is_cdrom = 1;
}
/* Check that drive number is not in use */
if ( sandev_find ( drive ) != NULL ) {
- DBGC ( sandev, "SAN %#02x is already in use\n", drive );
+ DBGC ( sandev->drive, "SAN %#02x is already in use\n", drive );
rc = -EADDRINUSE;
goto err_in_use;
}
/* Add to list of SAN devices */
list_add_tail ( &sandev->list, &san_devices );
- DBGC ( sandev, "SAN %#02x registered\n", sandev->drive );
+ DBGC ( sandev->drive, "SAN %#02x registered\n", sandev->drive );
return 0;
/* Remove ACPI descriptors */
sandev_undescribe ( sandev );
- DBGC ( sandev, "SAN %#02x unregistered\n", sandev->drive );
+ DBGC ( sandev->drive, "SAN %#02x unregistered\n", sandev->drive );
}
/** The "san-drive" setting */
/* Sanity check */
count = ( len / block->media.BlockSize );
if ( ( count * block->media.BlockSize ) != len ) {
- DBGC ( sandev, "EFIBLK %#02x impossible length %#zx\n",
+ DBGC ( sandev->drive, "EFIBLK %#02x impossible length %#zx\n",
sandev->drive, len );
return -EINVAL;
}
/* Read from / write to block device */
if ( ( rc = sandev_rw ( sandev, lba, count,
virt_to_user ( data ) ) ) != 0 ) {
- DBGC ( sandev, "EFIBLK %#02x I/O failed: %s\n",
+ DBGC ( sandev->drive, "EFIBLK %#02x I/O failed: %s\n",
sandev->drive, strerror ( rc ) );
return rc;
}
struct san_device *sandev = block->sandev;
int rc;
- DBGC2 ( sandev, "EFIBLK %#02x reset\n", sandev->drive );
+ DBGC2 ( sandev->drive, "EFIBLK %#02x reset\n", sandev->drive );
efi_snp_claim();
rc = sandev_reset ( sandev );
efi_snp_release();
struct san_device *sandev = block->sandev;
int rc;
- DBGC2 ( sandev, "EFIBLK %#02x read LBA %#08llx to %p+%#08zx\n",
+ DBGC2 ( sandev->drive, "EFIBLK %#02x read LBA %#08llx to %p+%#08zx\n",
sandev->drive, lba, data, ( ( size_t ) len ) );
efi_snp_claim();
rc = efi_block_rw ( sandev, lba, data, len, sandev_read );
struct san_device *sandev = block->sandev;
int rc;
- DBGC2 ( sandev, "EFIBLK %#02x write LBA %#08llx from %p+%#08zx\n",
- sandev->drive, lba, data, ( ( size_t ) len ) );
+ DBGC2 ( sandev->drive, "EFIBLK %#02x write LBA %#08llx from "
+ "%p+%#08zx\n", sandev->drive, lba, data, ( ( size_t ) len ) );
efi_snp_claim();
rc = efi_block_rw ( sandev, lba, data, len, sandev_write );
efi_snp_release();
container_of ( block_io, struct efi_block_data, block_io );
struct san_device *sandev = block->sandev;
- DBGC2 ( sandev, "EFIBLK %#02x flush\n", sandev->drive );
+ DBGC2 ( sandev->drive, "EFIBLK %#02x flush\n", sandev->drive );
/* Nothing to do */
return 0;
if ( ( efirc = bs->ConnectController ( block->handle, NULL,
NULL, TRUE ) ) != 0 ) {
rc = -EEFI ( efirc );
- DBGC ( sandev, "EFIBLK %#02x could not connect drivers: %s\n",
- sandev->drive, strerror ( rc ) );
+ DBGC ( sandev->drive, "EFIBLK %#02x could not connect "
+ "drivers: %s\n", sandev->drive, strerror ( rc ) );
/* May not be an error; may already be connected */
}
- DBGC2 ( sandev, "EFIBLK %#02x supports protocols:\n", sandev->drive );
- DBGC2_EFI_PROTOCOLS ( sandev, block->handle );
+ DBGC2 ( sandev->drive, "EFIBLK %#02x supports protocols:\n",
+ sandev->drive );
+ DBGC2_EFI_PROTOCOLS ( sandev->drive, block->handle );
}
/**
/* Sanity check */
if ( ! count ) {
- DBG ( "EFIBLK has no URIs\n" );
+ DBGC ( drive, "EFIBLK %#02x has no URIs\n", drive );
rc = -ENOTTY;
goto err_no_uris;
}
/* Register SAN device */
if ( ( rc = register_sandev ( sandev, drive, flags ) ) != 0 ) {
- DBGC ( sandev, "EFIBLK %#02x could not register: %s\n",
+ DBGC ( drive, "EFIBLK %#02x could not register: %s\n",
drive, strerror ( rc ) );
goto err_register;
}
/* Construct device path */
if ( ! sandev->active ) {
rc = -ENODEV;
- DBGC ( sandev, "EFIBLK %#02x not active after registration\n",
+ DBGC ( drive, "EFIBLK %#02x not active after registration\n",
drive );
goto err_active;
}
block->path = efi_describe ( &sandev->active->block );
if ( ! block->path ) {
rc = -ENODEV;
- DBGC ( sandev, "EFIBLK %#02x has no device path\n", drive );
+ DBGC ( drive, "EFIBLK %#02x has no device path\n", drive );
goto err_describe;
}
- DBGC ( sandev, "EFIBLK %#02x has device path %s\n",
+ DBGC ( drive, "EFIBLK %#02x has device path %s\n",
drive, efi_devpath_text ( block->path ) );
/* Install protocols */
&efi_device_path_protocol_guid, block->path,
NULL ) ) != 0 ) {
rc = -EEFI ( efirc );
- DBGC ( sandev, "EFIBLK %#02x could not install protocols: %s\n",
- sandev->drive, strerror ( rc ) );
+ DBGC ( drive, "EFIBLK %#02x could not install protocols: %s\n",
+ drive, strerror ( rc ) );
goto err_install;
}
&efi_block_io_protocol_guid, &block->block_io,
&efi_device_path_protocol_guid, block->path,
NULL ) ) != 0 ) {
- DBGC ( sandev, "EFIBLK %#02x could not uninstall protocols: "
- "%s\n", sandev->drive, strerror ( -EEFI ( efirc ) ) );
+ DBGC ( drive, "EFIBLK %#02x could not uninstall protocols: "
+ "%s\n", drive, strerror ( -EEFI ( efirc ) ) );
leak = 1;
}
efi_nullify_block ( &block->block_io );
sandev_put ( sandev );
err_alloc:
err_no_uris:
- if ( leak ) {
- DBGC ( sandev, "EFIBLK %#02x nullified and leaked\n",
- sandev->drive );
- }
+ if ( leak )
+ DBGC ( drive, "EFIBLK %#02x nullified and leaked\n", drive );
return rc;
}
/* Find SAN device */
sandev = sandev_find ( drive );
if ( ! sandev ) {
- DBG ( "EFIBLK cannot find drive %#02x\n", drive );
+ DBGC ( drive, "EFIBLK %#02x is not a SAN drive\n", drive );
return;
}
block = sandev->priv;
&efi_block_io_protocol_guid, &block->block_io,
&efi_device_path_protocol_guid, block->path,
NULL ) ) != 0 ) ) {
- DBGC ( sandev, "EFIBLK %#02x could not uninstall protocols: "
- "%s\n", sandev->drive, strerror ( -EEFI ( efirc ) ) );
+ DBGC ( drive, "EFIBLK %#02x could not uninstall protocols: "
+ "%s\n", drive, strerror ( -EEFI ( efirc ) ) );
leak = 1;
}
efi_nullify_block ( &block->block_io );
sandev_put ( sandev );
/* Report leakage, if applicable */
- if ( leak && ( ! efi_shutdown_in_progress ) ) {
- DBGC ( sandev, "EFIBLK %#02x nullified and leaked\n",
- sandev->drive );
- }
+ if ( leak && ( ! efi_shutdown_in_progress ) )
+ DBGC ( drive, "EFIBLK %#02x nullified and leaked\n", drive );
}
/** An installed ACPI table */
&path.interface, efi_image_handle,
handle,
EFI_OPEN_PROTOCOL_GET_PROTOCOL ))!=0){
- DBGC ( sandev, "EFIBLK %#02x found filesystem with no device "
- "path??", sandev->drive );
+ DBGC ( sandev->drive, "EFIBLK %#02x found filesystem with no "
+ "device path??", sandev->drive );
rc = -EEFI ( efirc );
goto err_open_device_path;
}
rc = -ENOTTY;
goto err_not_child;
}
- DBGC ( sandev, "EFIBLK %#02x found child device %s\n",
+ DBGC ( sandev->drive, "EFIBLK %#02x found child device %s\n",
sandev->drive, efi_devpath_text ( path.path ) );
/* Construct device path for boot image */
}
end = ( ( ( void * ) filepath ) + filepath_len );
efi_path_terminate ( end );
- DBGC ( sandev, "EFIBLK %#02x trying to load %s\n",
+ DBGC ( sandev->drive, "EFIBLK %#02x trying to load %s\n",
sandev->drive, efi_devpath_text ( boot_path ) );
/* Try loading boot image from this device */
if ( ( efirc = bs->LoadImage ( FALSE, efi_image_handle, boot_path,
NULL, 0, image ) ) != 0 ) {
rc = -EEFI ( efirc );
- DBGC ( sandev, "EFIBLK %#02x could not load image: %s\n",
+ DBGC ( sandev->drive, "EFIBLK %#02x could not load image: %s\n",
sandev->drive, strerror ( rc ) );
if ( efirc == EFI_SECURITY_VIOLATION )
bs->UnloadImage ( *image );
/* Find SAN device */
sandev = sandev_find ( drive );
if ( ! sandev ) {
- DBG ( "EFIBLK cannot find drive %#02x\n", drive );
+ DBGC ( drive, "EFIBLK %#02x is not a SAN drive\n", drive );
rc = -ENODEV;
goto err_sandev_find;
}
ByProtocol, &efi_simple_file_system_protocol_guid,
NULL, &count, &handles ) ) != 0 ) {
rc = -EEFI ( efirc );
- DBGC ( sandev, "EFIBLK %#02x cannot locate file systems: %s\n",
- sandev->drive, strerror ( rc ) );
+ DBGC ( drive, "EFIBLK %#02x cannot locate file systems: %s\n",
+ drive, strerror ( rc ) );
goto err_locate_file_systems;
}
if ( ( rc = efi_block_boot_image ( sandev, handles[i], filename,
&image ) ) != 0 )
continue;
- DBGC ( sandev, "EFIBLK %#02x found boot image\n",
- sandev->drive );
+ DBGC ( drive, "EFIBLK %#02x found boot image\n", drive );
efirc = bs->StartImage ( image, NULL, NULL );
rc = ( efirc ? -EEFI ( efirc ) : 0 );
bs->UnloadImage ( image );
- DBGC ( sandev, "EFIBLK %#02x boot image returned: %s\n",
- sandev->drive, strerror ( rc ) );
+ DBGC ( drive, "EFIBLK %#02x boot image returned: %s\n",
+ drive, strerror ( rc ) );
break;
}