#include <linux/string.h>
#include <linux/kernel.h>
#include <linux/export.h>
#include <linux/interrupt.h>
#include <linux/bitops.h>
u64 ide_get_lba_addr(struct ide_cmd *cmd, int lba48)
struct ide_taskfile *tf = &cmd->tf;
low = (tf->lbah << 16) | (tf->lbam << 8) | tf->lbal;
high = (tf->lbah << 16) | (tf->lbam << 8) | tf->lbal;
return ((u64)high << 24) | low;
EXPORT_SYMBOL_GPL(ide_get_lba_addr);
static void ide_dump_sector(ide_drive_t *drive)
struct ide_taskfile *tf = &cmd.tf;
u8 lba48 = !!(drive->dev_flags & IDE_DFLAG_LBA48);
memset(&cmd, 0, sizeof(cmd));
cmd.valid.in.tf = IDE_VALID_LBA;
cmd.valid.in.hob = IDE_VALID_LBA;
cmd.tf_flags = IDE_TFLAG_LBA48;
cmd.valid.in.tf = IDE_VALID_LBA | IDE_VALID_DEVICE;
ide_tf_readback(drive, &cmd);
if (lba48 || (tf->device & ATA_LBA))
printk(KERN_CONT ", LBAsect=%llu",
(unsigned long long)ide_get_lba_addr(&cmd, lba48));
printk(KERN_CONT ", CHS=%d/%d/%d", (tf->lbah << 8) + tf->lbam,
tf->device & 0xf, tf->lbal);
static void ide_dump_ata_error(ide_drive_t *drive, u8 err)
printk(KERN_CONT "DriveStatusError ");
(err & ATA_ABORTED) ? "BadCRC " : "BadSector ");
printk(KERN_CONT "UncorrectableError ");
printk(KERN_CONT "SectorIdNotFound ");
printk(KERN_CONT "TrackZeroNotFound ");