cregit-Linux how code gets into the kernel

Release 4.7 drivers/ide/ide-lib.c

Directory: drivers/ide
#include <linux/types.h>
#include <linux/string.h>
#include <linux/kernel.h>
#include <linux/export.h>
#include <linux/interrupt.h>
#include <linux/ide.h>
#include <linux/bitops.h>

/**
 *      ide_toggle_bounce       -       handle bounce buffering
 *      @drive: drive to update
 *      @on: on/off boolean
 *
 *      Enable or disable bounce buffering for the device. Drives move
 *      between PIO and DMA and that changes the rules we need.
 */


void ide_toggle_bounce(ide_drive_t *drive, int on) { u64 addr = BLK_BOUNCE_HIGH; /* dma64_addr_t */ if (!PCI_DMA_BUS_IS_PHYS) { addr = BLK_BOUNCE_ANY; } else if (on && drive->media == ide_disk) { struct device *dev = drive->hwif->dev; if (dev && dev->dma_mask) addr = *dev->dma_mask; } if (drive->queue) blk_queue_bounce_limit(drive->queue, addr); }

Contributors

PersonTokensPropCommitsCommitProp
jens axboejens axboe5262.65%240.00%
bartlomiej zolnierkiewiczbartlomiej zolnierkiewicz1720.48%120.00%
james bottomleyjames bottomley1214.46%120.00%
linus torvaldslinus torvalds22.41%120.00%
Total83100.00%5100.00%


u64 ide_get_lba_addr(struct ide_cmd *cmd, int lba48) { struct ide_taskfile *tf = &cmd->tf; u32 high, low; low = (tf->lbah << 16) | (tf->lbam << 8) | tf->lbal; if (lba48) { tf = &cmd->hob; high = (tf->lbah << 16) | (tf->lbam << 8) | tf->lbal; } else high = tf->device & 0xf; return ((u64)high << 24) | low; }

Contributors

PersonTokensPropCommitsCommitProp
bartlomiej zolnierkiewiczbartlomiej zolnierkiewicz7066.04%150.00%
sergei shtylyovsergei shtylyov3633.96%150.00%
Total106100.00%2100.00%

EXPORT_SYMBOL_GPL(ide_get_lba_addr);
static void ide_dump_sector(ide_drive_t *drive) { struct ide_cmd cmd; struct ide_taskfile *tf = &cmd.tf; u8 lba48 = !!(drive->dev_flags & IDE_DFLAG_LBA48); memset(&cmd, 0, sizeof(cmd)); if (lba48) { cmd.valid.in.tf = IDE_VALID_LBA; cmd.valid.in.hob = IDE_VALID_LBA; cmd.tf_flags = IDE_TFLAG_LBA48; } else 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)); else printk(KERN_CONT ", CHS=%d/%d/%d", (tf->lbah << 8) + tf->lbam, tf->device & 0xf, tf->lbal); }

Contributors

PersonTokensPropCommitsCommitProp
bartlomiej zolnierkiewiczbartlomiej zolnierkiewicz12677.30%450.00%
sergei shtylyovsergei shtylyov3219.63%337.50%
andrew mortonandrew morton53.07%112.50%
Total163100.00%8100.00%


static void ide_dump_ata_error(ide_drive_t *drive, u8 err) { printk(KERN_CONT "{ "); if (err & ATA_ABORTED) printk(KERN_CONT "DriveStatusError "); if (err & ATA_ICRC) printk(KERN_CONT "%s", (err & ATA_ABORTED) ? "BadCRC " : "BadSector "); if (err & ATA_UNC) printk(KERN_CONT "UncorrectableError "); if (err & ATA_IDNF) printk(KERN_CONT "SectorIdNotFound "); if (err & ATA_TRK0NF) printk(KERN_CONT "TrackZeroNotFound "); if (err & ATA_AMNF) printk(KERN_CONT "AddrMarkNotFound "); printk(KERN_CONT "}"); if ((err & (ATA_BBK | ATA_ABORTED)) == ATA_BBK || (err & (ATA_UNC | ATA_IDNF | ATA_AMNF))) { struct request *rq = drive->hwif->rq; ide_dump_sector(drive); if (rq) printk(KERN_CONT ", sector=%llu", (unsigned long long)blk_rq_pos(rq)); } printk(KERN_CONT "\n"); }

Contributors

PersonTokensPropCommitsCommitProp
bartlomiej zolnierkiewiczbartlomiej zolnierkiewicz17196.61%880.00%
denys vlasenkodenys vlasenko31.69%110.00%
tejun heotejun heo31.69%110.00%
Total177100.00%10100.00%


static void ide_dump_atapi_error(ide_drive_t *drive, u8 err) { printk(KERN_CONT "{ "); if (err & ATAPI_ILI) printk(KERN_CONT "IllegalLengthIndication "); if (err & ATAPI_EOM) printk(KERN_CONT "EndOfMedia "); if (err & ATA_ABORTED) printk(KERN_CONT "AbortedCommand "); if (err & ATA_MCR) printk(KERN_CONT "MediaChangeRequested "); if (err & ATAPI_LFS) printk(KERN_CONT "LastFailedSense=0x%02x ", (err & ATAPI_LFS) >> 4); printk(KERN_CONT "}\n"); }

Contributors

PersonTokensPropCommitsCommitProp
bartlomiej zolnierkiewiczbartlomiej zolnierkiewicz93100.00%6100.00%
Total93100.00%6100.00%

/** * ide_dump_status - translate ATA/ATAPI error * @drive: drive that status applies to * @msg: text message to print * @stat: status byte to decode * * Error reporting, in human readable form (luxurious, but a memory hog). * Combines the drive name, message and status byte to provide a * user understandable explanation of the device error. */
u8 ide_dump_status(ide_drive_t *drive, const char *msg, u8 stat) { u8 err = 0; printk(KERN_ERR "%s: %s: status=0x%02x { ", drive->name, msg, stat); if (stat & ATA_BUSY) printk(KERN_CONT "Busy "); else { if (stat & ATA_DRDY) printk(KERN_CONT "DriveReady "); if (stat & ATA_DF) printk(KERN_CONT "DeviceFault "); if (stat & ATA_DSC) printk(KERN_CONT "SeekComplete "); if (stat & ATA_DRQ) printk(KERN_CONT "DataRequest "); if (stat & ATA_CORR) printk(KERN_CONT "CorrectedError "); if (stat & ATA_SENSE) printk(KERN_CONT "Sense "); if (stat & ATA_ERR) printk(KERN_CONT "Error "); } printk(KERN_CONT "}\n"); if ((stat & (ATA_BUSY | ATA_ERR)) == ATA_ERR) { err = ide_read_error(drive); printk(KERN_ERR "%s: %s: error=0x%02x ", drive->name, msg, err); if (drive->media == ide_disk) ide_dump_ata_error(drive, err); else ide_dump_atapi_error(drive, err); } printk(KERN_ERR "%s: possibly failed opcode: 0x%02x\n", drive->name, drive->hwif->cmd.tf.command); return err; }

Contributors

PersonTokensPropCommitsCommitProp
andrew mortonandrew morton12857.14%17.69%
bartlomiej zolnierkiewiczbartlomiej zolnierkiewicz9341.52%1076.92%
hannes reineckehannes reinecke20.89%17.69%
al viroal viro10.45%17.69%
Total224100.00%13100.00%

EXPORT_SYMBOL(ide_dump_status);

Overall Contributors

PersonTokensPropCommitsCommitProp
bartlomiej zolnierkiewiczbartlomiej zolnierkiewicz57765.64%1851.43%
andrew mortonandrew morton13715.59%25.71%
jens axboejens axboe697.85%38.57%
sergei shtylyovsergei shtylyov687.74%38.57%
james bottomleyjames bottomley121.37%12.86%
tejun heotejun heo30.34%12.86%
paul gortmakerpaul gortmaker30.34%12.86%
denys vlasenkodenys vlasenko30.34%12.86%
hannes reineckehannes reinecke20.23%12.86%
linus torvaldslinus torvalds20.23%12.86%
al viroal viro10.11%12.86%
alan coxalan cox10.11%12.86%
adrian bunkadrian bunk10.11%12.86%
Total879100.00%35100.00%
Directory: drivers/ide
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.
{% endraw %}