root/drivers/block/ide_modes.h

/* [previous][next][first][last][top][bottom][index][help] */

INCLUDED FROM


DEFINITIONS

This source file includes following definitions.
  1. ide_scan_pio_blacklist
  2. ide_get_best_pio_mode

   1 #ifndef _IDE_MODES_H
   2 #define _IDE_MODES_H
   3 /*
   4  *  linux/drivers/block/ide_modes.h
   5  *
   6  *  Copyright (C) 1996  Linus Torvalds, Igor Abramov, and Mark Lord
   7  */
   8 
   9 /*
  10  * Shared data/functions for determining best PIO mode for an IDE drive.
  11  * Most of this stuff originally lived in cmd640.c, and changes to the
  12  * ide_pio_blacklist[] table should be made with EXTREME CAUTION to avoid
  13  * breaking the fragile cmd640.c support.
  14  */
  15 
  16 #if defined(CONFIG_BLK_DEV_CMD640) || defined(CONFIG_IDE_CHIPSETS)
  17 
  18 #ifndef _IDE_C
  19 
  20 int ide_scan_pio_blacklist (char *model);
  21 unsigned int ide_get_best_pio_mode (ide_drive_t *drive);
  22 
  23 #else /* _IDE_C */
  24 
  25 /*
  26  * Black list. Some drives incorrectly report their maximal PIO mode,
  27  * at least in respect to CMD640. Here we keep info on some known drives.
  28  */
  29 static struct ide_pio_info {
  30         const char      *name;
  31         int             pio;
  32 } ide_pio_blacklist [] = {
  33 /*      { "Conner Peripherals 1275MB - CFS1275A", 4 }, */
  34 
  35         { "WDC AC2700",  3 },
  36         { "WDC AC2540",  3 },
  37         { "WDC AC2420",  3 },
  38         { "WDC AC2340",  3 },
  39         { "WDC AC2250",  0 },
  40         { "WDC AC2200",  0 },
  41         { "WDC AC2120",  0 },
  42         { "WDC AC2850",  3 },
  43         { "WDC AC1270",  3 },
  44         { "WDC AC1170",  3 },
  45         { "WDC AC1210",  1 },
  46         { "WDC AC280",   0 },
  47 /*      { "WDC AC21000", 4 }, */
  48         { "WDC AC31000", 3 },
  49 /*      { "WDC AC21200", 4 }, */
  50         { "WDC AC31200", 3 },
  51 /*      { "WDC AC31600", 4 }, */
  52 
  53         { "Maxtor 7131 AT", 1 },
  54         { "Maxtor 7171 AT", 1 },
  55         { "Maxtor 7213 AT", 1 },
  56         { "Maxtor 7245 AT", 1 },
  57         { "Maxtor 7345 AT", 1 },
  58         { "Maxtor 7546 AT", 3 },
  59         { "Maxtor 7540 AV", 3 },
  60 
  61         { "SAMSUNG SHD-3121A", 1 },
  62         { "SAMSUNG SHD-3122A", 1 },
  63         { "SAMSUNG SHD-3172A", 1 },
  64 
  65 /*      { "ST51080A", 4 },
  66  *      { "ST51270A", 4 },
  67  *      { "ST31220A", 4 },
  68  *      { "ST31640A", 4 },
  69  *      { "ST32140A", 4 },
  70  *      { "ST3780A",  4 },
  71  */
  72         { "ST5660A",  3 },
  73         { "ST3660A",  3 },
  74         { "ST3630A",  3 },
  75         { "ST3655A",  3 },
  76         { "ST3391A",  3 },
  77         { "ST3390A",  1 },
  78         { "ST3600A",  1 },
  79         { "ST3290A",  0 },
  80         { "ST3144A",  0 },
  81 
  82         { "QUANTUM ELS127A", 0 },
  83         { "QUANTUM ELS170A", 0 },
  84         { "QUANTUM LPS240A", 0 },
  85         { "QUANTUM LPS210A", 3 },
  86         { "QUANTUM LPS270A", 3 },
  87         { "QUANTUM LPS365A", 3 },
  88         { "QUANTUM LPS540A", 3 },
  89         { "QUANTUM LIGHTNING 540A", 3 },
  90         { "QUANTUM FIREBALL", 3 }, /* For models 540/640/1080/1280 */
  91                                    /* 1080A works fine in mode4 with triton */
  92         { NULL, 0 }
  93 };
  94 
  95 /*
  96  * This routine searches the ide_pio_blacklist for an entry
  97  * matching the start/whole of the supplied model name.
  98  *
  99  * Returns -1 if no match found.
 100  * Otherwise returns the recommended PIO mode from ide_pio_blacklist[].
 101  */
 102 int ide_scan_pio_blacklist (char *model)
     /* [previous][next][first][last][top][bottom][index][help] */
 103 {
 104         struct ide_pio_info *p;
 105 
 106         for (p = ide_pio_blacklist; p->name != NULL; p++) {
 107                 if (strncmp(p->name, model, strlen(p->name)) == 0)
 108                         return p->pio;
 109         }
 110         return -1;
 111 }
 112 
 113 /*
 114  * This routine returns the recommended PIO mode for a given drive,
 115  * based on the drive->id information and the ide_pio_blacklist[].
 116  * This is used by most chipset support modules when "auto-tuning".
 117  */
 118 unsigned int ide_get_best_pio_mode (ide_drive_t *drive)
     /* [previous][next][first][last][top][bottom][index][help] */
 119 {
 120         unsigned int pio = 0;
 121         struct hd_driveid *id = drive->id;
 122 
 123         if (id != NULL) {
 124                 if (HWIF(drive)->chipset != ide_cmd640 && !strcmp("QUANTUM FIREBALL1080A", id->model))
 125                         pio = 4;
 126                 else
 127                         pio = ide_scan_pio_blacklist(id->model);
 128                 if (pio == -1) {
 129                         pio = (id->tPIO < 2) ? id->tPIO : 2;
 130                         if (id->field_valid & 2) {
 131                                 byte modes = id->eide_pio_modes;
 132                                 if      (modes & 4)     pio = 5;
 133                                 else if (modes & 2)     pio = 4;
 134                                 else if (modes & 1)     pio = 3;
 135                         }
 136                 }
 137         }
 138         return pio;
 139 }
 140 
 141 #endif /* _IDE_C */
 142 #endif /* defined(CONFIG_BLK_DEV_CMD640) || defined(CONFIG_IDE_CHIPSETS) */
 143 #endif /* _IDE_MODES_H */

/* [previous][next][first][last][top][bottom][index][help] */