Merge git://git.kernel.org/pub/scm/linux/kernel/git/bart/ide-2.6

* git://git.kernel.org/pub/scm/linux/kernel/git/bart/ide-2.6: (76 commits)
ide: use proper printk() KERN_* levels in ide-probe.c
ide: fix for EATA SCSI HBA in ATA emulating mode
ide: remove stale comments from drivers/ide/Makefile
ide: enable local IRQs in all handlers for TASKFILE_NO_DATA data phase
ide-scsi: remove kmalloced struct request
ht6560b: remove old history
ht6560b: update email address
ide-cd: fix oops when using growisofs
gayle: release resources on ide_host_add() failure
palm_bk3710: add UltraDMA/100 support
ide: trivial sparse annotations
ide: ide-tape.c sparse annotations and unaligned access removal
ide: drop 'name' parameter from ->init_chipset method
ide: prefix messages from IDE PCI host drivers by driver name
it821x: remove DECLARE_ITE_DEV() macro
it8213: remove DECLARE_ITE_DEV() macro
ide: include PCI device name in messages from IDE PCI host drivers
ide: remove <asm/ide.h> for some archs
ide-generic: remove ide_default_{io_base,irq}() inlines (take 3)
ide-generic: is no longer needed on ppc32
...

+1394 -1471
+1 -1
drivers/ide/Kconfig
··· 314 315 config IDE_GENERIC 316 tristate "generic/default IDE chipset support" 317 - depends on ALPHA || X86 || IA64 || M32R || MIPS || PPC32 318 help 319 If unsure, say N. 320
··· 314 315 config IDE_GENERIC 316 tristate "generic/default IDE chipset support" 317 + depends on ALPHA || X86 || IA64 || M32R || MIPS 318 help 319 If unsure, say N. 320
+1 -8
drivers/ide/Makefile
··· 1 # 2 - # Makefile for the kernel ata, atapi, and ide block device drivers. 3 - # 4 - # 12 September 2000, Bartlomiej Zolnierkiewicz <bkz@linux-ide.org> 5 - # Rewritten to use lists instead of if-statements. 6 - # 7 - # Note : at this point, these files are compiled on all systems. 8 - # In the future, some of these should be built conditionally. 9 - # 10 # link order is important here 11 12 EXTRA_CFLAGS += -Idrivers/ide 13
··· 1 # 2 # link order is important here 3 + # 4 5 EXTRA_CFLAGS += -Idrivers/ide 6
+6
drivers/ide/arm/icside.c
··· 710 return ecard_register_driver(&icside_driver); 711 } 712 713 MODULE_AUTHOR("Russell King <rmk@arm.linux.org.uk>"); 714 MODULE_LICENSE("GPL"); 715 MODULE_DESCRIPTION("ICS IDE driver"); 716 717 module_init(icside_init);
··· 710 return ecard_register_driver(&icside_driver); 711 } 712 713 + static void __exit icside_exit(void); 714 + { 715 + ecard_unregister_driver(&icside_driver); 716 + } 717 + 718 MODULE_AUTHOR("Russell King <rmk@arm.linux.org.uk>"); 719 MODULE_LICENSE("GPL"); 720 MODULE_DESCRIPTION("ICS IDE driver"); 721 722 module_init(icside_init); 723 + module_exit(icside_exit);
+6 -3
drivers/ide/arm/palm_bk3710.c
··· 82 {100, 120}, /* UDMA Mode 2 */ 83 {100, 90}, /* UDMA Mode 3 */ 84 {100, 60}, /* UDMA Mode 4 */ 85 }; 86 87 static void palm_bk3710_setudmamode(void __iomem *base, unsigned int dev, ··· 335 .cable_detect = palm_bk3710_cable_detect, 336 }; 337 338 - static const struct ide_port_info __devinitdata palm_bk3710_port_info = { 339 .init_dma = palm_bk3710_init_dma, 340 .port_ops = &palm_bk3710_ports_ops, 341 .host_flags = IDE_HFLAG_MMIO, 342 .pio_mask = ATA_PIO4, 343 - .udma_mask = ATA_UDMA4, /* (input clk 99MHz) */ 344 .mwdma_mask = ATA_MWDMA2, 345 }; 346 ··· 352 int i, rc; 353 hw_regs_t hw, *hws[] = { &hw, NULL, NULL, NULL }; 354 355 - clk = clk_get(NULL, "IDECLK"); 356 if (IS_ERR(clk)) 357 return -ENODEV; 358 ··· 391 hw.io_ports.ctl_addr = base + IDE_PALM_ATA_PRI_CTL_OFFSET; 392 hw.irq = irq->start; 393 hw.chipset = ide_palm3710; 394 395 rc = ide_host_add(&palm_bk3710_port_info, hws, NULL); 396 if (rc)
··· 82 {100, 120}, /* UDMA Mode 2 */ 83 {100, 90}, /* UDMA Mode 3 */ 84 {100, 60}, /* UDMA Mode 4 */ 85 + {85, 40}, /* UDMA Mode 5 */ 86 }; 87 88 static void palm_bk3710_setudmamode(void __iomem *base, unsigned int dev, ··· 334 .cable_detect = palm_bk3710_cable_detect, 335 }; 336 337 + static struct ide_port_info __devinitdata palm_bk3710_port_info = { 338 .init_dma = palm_bk3710_init_dma, 339 .port_ops = &palm_bk3710_ports_ops, 340 .host_flags = IDE_HFLAG_MMIO, 341 .pio_mask = ATA_PIO4, 342 .mwdma_mask = ATA_MWDMA2, 343 }; 344 ··· 352 int i, rc; 353 hw_regs_t hw, *hws[] = { &hw, NULL, NULL, NULL }; 354 355 + clk = clk_get(&pdev->dev, "IDECLK"); 356 if (IS_ERR(clk)) 357 return -ENODEV; 358 ··· 391 hw.io_ports.ctl_addr = base + IDE_PALM_ATA_PRI_CTL_OFFSET; 392 hw.irq = irq->start; 393 hw.chipset = ide_palm3710; 394 + 395 + palm_bk3710_port_info.udma_mask = rate < 100000000 ? ATA_UDMA4 : 396 + ATA_UDMA5; 397 398 rc = ide_host_add(&palm_bk3710_port_info, hws, NULL); 399 if (rc)
+6
drivers/ide/arm/rapide.c
··· 95 return ecard_register_driver(&rapide_driver); 96 } 97 98 MODULE_LICENSE("GPL"); 99 MODULE_DESCRIPTION("Yellowstone RAPIDE driver"); 100 101 module_init(rapide_init);
··· 95 return ecard_register_driver(&rapide_driver); 96 } 97 98 + static void __exit rapide_exit(void) 99 + { 100 + ecard_unregister_driver(&rapide_driver); 101 + } 102 + 103 MODULE_LICENSE("GPL"); 104 MODULE_DESCRIPTION("Yellowstone RAPIDE driver"); 105 106 module_init(rapide_init); 107 + module_exit(rapide_exit);
+31 -8
drivers/ide/ide-cd.c
··· 57 #define ide_cd_g(disk) \ 58 container_of((disk)->private_data, struct cdrom_info, driver) 59 60 static struct cdrom_info *ide_cd_get(struct gendisk *disk) 61 { 62 struct cdrom_info *cd = NULL; 63 64 mutex_lock(&idecd_ref_mutex); 65 cd = ide_cd_g(disk); 66 - if (cd) 67 kref_get(&cd->kref); 68 mutex_unlock(&idecd_ref_mutex); 69 return cd; 70 } 71 72 - static void ide_cd_release(struct kref *); 73 - 74 static void ide_cd_put(struct cdrom_info *cd) 75 { 76 mutex_lock(&idecd_ref_mutex); 77 kref_put(&cd->kref, ide_cd_release); 78 mutex_unlock(&idecd_ref_mutex); 79 } ··· 1311 1312 stat = ide_cd_queue_pc(drive, cmd, 0, &capbuf, &len, sense, 0, 1313 REQ_QUIET); 1314 - if (stat == 0) { 1315 - *capacity = 1 + be32_to_cpu(capbuf.lba); 1316 - *sectors_per_frame = 1317 - be32_to_cpu(capbuf.blocklen) >> SECTOR_BITS; 1318 } 1319 1320 - return stat; 1321 } 1322 1323 static int cdrom_read_tocentry(ide_drive_t *drive, int trackno, int msf_flag,
··· 57 #define ide_cd_g(disk) \ 58 container_of((disk)->private_data, struct cdrom_info, driver) 59 60 + static void ide_cd_release(struct kref *); 61 + 62 static struct cdrom_info *ide_cd_get(struct gendisk *disk) 63 { 64 struct cdrom_info *cd = NULL; 65 66 mutex_lock(&idecd_ref_mutex); 67 cd = ide_cd_g(disk); 68 + if (cd) { 69 kref_get(&cd->kref); 70 + if (ide_device_get(cd->drive)) { 71 + kref_put(&cd->kref, ide_cd_release); 72 + cd = NULL; 73 + } 74 + } 75 mutex_unlock(&idecd_ref_mutex); 76 return cd; 77 } 78 79 static void ide_cd_put(struct cdrom_info *cd) 80 { 81 mutex_lock(&idecd_ref_mutex); 82 + ide_device_put(cd->drive); 83 kref_put(&cd->kref, ide_cd_release); 84 mutex_unlock(&idecd_ref_mutex); 85 } ··· 1305 1306 stat = ide_cd_queue_pc(drive, cmd, 0, &capbuf, &len, sense, 0, 1307 REQ_QUIET); 1308 + if (stat) 1309 + return stat; 1310 + 1311 + /* 1312 + * Sanity check the given block size 1313 + */ 1314 + switch (capbuf.blocklen) { 1315 + case __constant_cpu_to_be32(512): 1316 + case __constant_cpu_to_be32(1024): 1317 + case __constant_cpu_to_be32(2048): 1318 + case __constant_cpu_to_be32(4096): 1319 + break; 1320 + default: 1321 + printk(KERN_ERR "%s: weird block size %u\n", 1322 + drive->name, capbuf.blocklen); 1323 + printk(KERN_ERR "%s: default to 2kb block size\n", 1324 + drive->name); 1325 + capbuf.blocklen = __constant_cpu_to_be32(2048); 1326 + break; 1327 } 1328 1329 + *capacity = 1 + be32_to_cpu(capbuf.lba); 1330 + *sectors_per_frame = be32_to_cpu(capbuf.blocklen) >> SECTOR_BITS; 1331 + return 0; 1332 } 1333 1334 static int cdrom_read_tocentry(ide_drive_t *drive, int trackno, int msf_flag,
+9 -3
drivers/ide/ide-disk.c
··· 56 #define ide_disk_g(disk) \ 57 container_of((disk)->private_data, struct ide_disk_obj, driver) 58 59 static struct ide_disk_obj *ide_disk_get(struct gendisk *disk) 60 { 61 struct ide_disk_obj *idkp = NULL; 62 63 mutex_lock(&idedisk_ref_mutex); 64 idkp = ide_disk_g(disk); 65 - if (idkp) 66 kref_get(&idkp->kref); 67 mutex_unlock(&idedisk_ref_mutex); 68 return idkp; 69 } 70 71 - static void ide_disk_release(struct kref *); 72 - 73 static void ide_disk_put(struct ide_disk_obj *idkp) 74 { 75 mutex_lock(&idedisk_ref_mutex); 76 kref_put(&idkp->kref, ide_disk_release); 77 mutex_unlock(&idedisk_ref_mutex); 78 }
··· 56 #define ide_disk_g(disk) \ 57 container_of((disk)->private_data, struct ide_disk_obj, driver) 58 59 + static void ide_disk_release(struct kref *); 60 + 61 static struct ide_disk_obj *ide_disk_get(struct gendisk *disk) 62 { 63 struct ide_disk_obj *idkp = NULL; 64 65 mutex_lock(&idedisk_ref_mutex); 66 idkp = ide_disk_g(disk); 67 + if (idkp) { 68 kref_get(&idkp->kref); 69 + if (ide_device_get(idkp->drive)) { 70 + kref_put(&idkp->kref, ide_disk_release); 71 + idkp = NULL; 72 + } 73 + } 74 mutex_unlock(&idedisk_ref_mutex); 75 return idkp; 76 } 77 78 static void ide_disk_put(struct ide_disk_obj *idkp) 79 { 80 mutex_lock(&idedisk_ref_mutex); 81 + ide_device_put(idkp->drive); 82 kref_put(&idkp->kref, ide_disk_release); 83 mutex_unlock(&idedisk_ref_mutex); 84 }
+1 -1
drivers/ide/ide-dma.c
··· 173 int ide_build_dmatable (ide_drive_t *drive, struct request *rq) 174 { 175 ide_hwif_t *hwif = HWIF(drive); 176 - unsigned int *table = hwif->dmatable_cpu; 177 unsigned int is_trm290 = (hwif->chipset == ide_trm290) ? 1 : 0; 178 unsigned int count = 0; 179 int i;
··· 173 int ide_build_dmatable (ide_drive_t *drive, struct request *rq) 174 { 175 ide_hwif_t *hwif = HWIF(drive); 176 + __le32 *table = (__le32 *)hwif->dmatable_cpu; 177 unsigned int is_trm290 = (hwif->chipset == ide_trm290) ? 1 : 0; 178 unsigned int count = 0; 179 int i;
+9 -3
drivers/ide/ide-floppy.c
··· 158 #define ide_floppy_g(disk) \ 159 container_of((disk)->private_data, struct ide_floppy_obj, driver) 160 161 static struct ide_floppy_obj *ide_floppy_get(struct gendisk *disk) 162 { 163 struct ide_floppy_obj *floppy = NULL; 164 165 mutex_lock(&idefloppy_ref_mutex); 166 floppy = ide_floppy_g(disk); 167 - if (floppy) 168 kref_get(&floppy->kref); 169 mutex_unlock(&idefloppy_ref_mutex); 170 return floppy; 171 } 172 173 - static void idefloppy_cleanup_obj(struct kref *); 174 - 175 static void ide_floppy_put(struct ide_floppy_obj *floppy) 176 { 177 mutex_lock(&idefloppy_ref_mutex); 178 kref_put(&floppy->kref, idefloppy_cleanup_obj); 179 mutex_unlock(&idefloppy_ref_mutex); 180 }
··· 158 #define ide_floppy_g(disk) \ 159 container_of((disk)->private_data, struct ide_floppy_obj, driver) 160 161 + static void idefloppy_cleanup_obj(struct kref *); 162 + 163 static struct ide_floppy_obj *ide_floppy_get(struct gendisk *disk) 164 { 165 struct ide_floppy_obj *floppy = NULL; 166 167 mutex_lock(&idefloppy_ref_mutex); 168 floppy = ide_floppy_g(disk); 169 + if (floppy) { 170 kref_get(&floppy->kref); 171 + if (ide_device_get(floppy->drive)) { 172 + kref_put(&floppy->kref, idefloppy_cleanup_obj); 173 + floppy = NULL; 174 + } 175 + } 176 mutex_unlock(&idefloppy_ref_mutex); 177 return floppy; 178 } 179 180 static void ide_floppy_put(struct ide_floppy_obj *floppy) 181 { 182 mutex_lock(&idefloppy_ref_mutex); 183 + ide_device_put(floppy->drive); 184 kref_put(&floppy->kref, idefloppy_cleanup_obj); 185 mutex_unlock(&idefloppy_ref_mutex); 186 }
+33 -3
drivers/ide/ide-generic.c
··· 20 #include <linux/module.h> 21 #include <linux/ide.h> 22 23 #define DRV_NAME "ide_generic" 24 25 static int probe_mask = 0x03; ··· 85 return 0; 86 } 87 88 static int __init ide_generic_init(void) 89 { 90 hw_regs_t hw[MAX_HWIFS], *hws[MAX_HWIFS]; ··· 107 unsigned long io_addr; 108 int i, rc; 109 110 printk(KERN_INFO DRV_NAME ": please use \"probe_mask=0x3f\" module " 111 "parameter for probing all legacy ISA IDE ports\n"); 112 113 - for (i = 0; i < MAX_HWIFS; i++) { 114 - io_addr = ide_default_io_base(i); 115 116 hws[i] = NULL; 117 ··· 139 140 memset(&hw[i], 0, sizeof(hw[i])); 141 ide_std_init_ports(&hw[i], io_addr, io_addr + 0x206); 142 - hw[i].irq = ide_default_irq(io_addr); 143 hw[i].chipset = ide_generic; 144 145 hws[i] = &hw[i];
··· 20 #include <linux/module.h> 21 #include <linux/ide.h> 22 23 + /* FIXME: convert m32r to use ide_platform host driver */ 24 + #ifdef CONFIG_M32R 25 + #include <asm/m32r.h> 26 + #endif 27 + 28 #define DRV_NAME "ide_generic" 29 30 static int probe_mask = 0x03; ··· 80 return 0; 81 } 82 83 + #if defined(CONFIG_PLAT_M32700UT) || defined(CONFIG_PLAT_MAPPI2) \ 84 + || defined(CONFIG_PLAT_OPSPUT) 85 + static const u16 legacy_bases[] = { 0x1f0 }; 86 + static const int legacy_irqs[] = { PLD_IRQ_CFIREQ }; 87 + #elif defined(CONFIG_PLAT_MAPPI3) 88 + static const u16 legacy_bases[] = { 0x1f0, 0x170 }; 89 + static const int legacy_irqs[] = { PLD_IRQ_CFIREQ, PLD_IRQ_IDEIREQ }; 90 + #elif defined(CONFIG_ALPHA) 91 + static const u16 legacy_bases[] = { 0x1f0, 0x170, 0x1e8, 0x168 }; 92 + static const int legacy_irqs[] = { 14, 15, 11, 10 }; 93 + #else 94 + static const u16 legacy_bases[] = { 0x1f0, 0x170, 0x1e8, 0x168, 0x1e0, 0x160 }; 95 + static const int legacy_irqs[] = { 14, 15, 11, 10, 8, 12 }; 96 + #endif 97 + 98 static int __init ide_generic_init(void) 99 { 100 hw_regs_t hw[MAX_HWIFS], *hws[MAX_HWIFS]; ··· 87 unsigned long io_addr; 88 int i, rc; 89 90 + #ifdef CONFIG_MIPS 91 + if (!ide_probe_legacy()) 92 + return -ENODEV; 93 + #endif 94 printk(KERN_INFO DRV_NAME ": please use \"probe_mask=0x3f\" module " 95 "parameter for probing all legacy ISA IDE ports\n"); 96 97 + memset(hws, 0, sizeof(hw_regs_t *) * MAX_HWIFS); 98 + 99 + for (i = 0; i < ARRAY_SIZE(legacy_bases); i++) { 100 + io_addr = legacy_bases[i]; 101 102 hws[i] = NULL; 103 ··· 113 114 memset(&hw[i], 0, sizeof(hw[i])); 115 ide_std_init_ports(&hw[i], io_addr, io_addr + 0x206); 116 + #ifdef CONFIG_IA64 117 + hw[i].irq = isa_irq_to_vector(legacy_irqs[i]); 118 + #else 119 + hw[i].irq = legacy_irqs[i]; 120 + #endif 121 hw[i].chipset = ide_generic; 122 123 hws[i] = &hw[i];
+2 -4
drivers/ide/ide-iops.c
··· 510 511 if (byteswap) { 512 /* convert from big-endian to host byte order */ 513 - for (p = end ; p != s;) { 514 - unsigned short *pp = (unsigned short *) (p -= 2); 515 - *pp = ntohs(*pp); 516 - } 517 } 518 /* strip leading blanks */ 519 while (s != end && *s == ' ')
··· 510 511 if (byteswap) { 512 /* convert from big-endian to host byte order */ 513 + for (p = end ; p != s;) 514 + be16_to_cpus((u16 *)(p -= 2)); 515 } 516 /* strip leading blanks */ 517 while (s != end && *s == ' ')
+36 -35
drivers/ide/ide-probe.c
··· 134 #endif 135 ide_fix_driveid(id); 136 137 - #if defined (CONFIG_SCSI_EATA_PIO) || defined (CONFIG_SCSI_EATA) 138 - /* 139 - * EATA SCSI controllers do a hardware ATA emulation: 140 - * Ignore them if there is a driver for them available. 141 - */ 142 - if ((id->model[0] == 'P' && id->model[1] == 'M') || 143 - (id->model[0] == 'S' && id->model[1] == 'K')) { 144 - printk("%s: EATA SCSI HBA %.10s\n", drive->name, id->model); 145 - goto err_misc; 146 - } 147 - #endif /* CONFIG_SCSI_EATA || CONFIG_SCSI_EATA_PIO */ 148 - 149 /* 150 * WIN_IDENTIFY returns little-endian info, 151 * WIN_PIDENTIFY *usually* returns little-endian info. ··· 155 if (strstr(id->model, "E X A B Y T E N E S T")) 156 goto err_misc; 157 158 - printk("%s: %s, ", drive->name, id->model); 159 drive->present = 1; 160 drive->dead = 0; 161 ··· 165 */ 166 if (cmd == WIN_PIDENTIFY) { 167 u8 type = (id->config >> 8) & 0x1f; 168 - printk("ATAPI "); 169 switch (type) { 170 case ide_floppy: 171 if (!strstr(id->model, "CD-ROM")) { 172 if (!strstr(id->model, "oppy") && 173 !strstr(id->model, "poyp") && 174 !strstr(id->model, "ZIP")) 175 - printk("cdrom or floppy?, assuming "); 176 if (drive->media != ide_cdrom) { 177 - printk ("FLOPPY"); 178 drive->removable = 1; 179 break; 180 } ··· 188 /* kludge for Apple PowerBook internal zip */ 189 if (!strstr(id->model, "CD-ROM") && 190 strstr(id->model, "ZIP")) { 191 - printk ("FLOPPY"); 192 type = ide_floppy; 193 break; 194 } 195 #endif 196 - printk ("CD/DVD-ROM"); 197 break; 198 case ide_tape: 199 - printk ("TAPE"); 200 break; 201 case ide_optical: 202 - printk ("OPTICAL"); 203 drive->removable = 1; 204 break; 205 default: 206 - printk("UNKNOWN (type %d)", type); 207 break; 208 } 209 - printk (" drive\n"); 210 drive->media = type; 211 /* an ATAPI device ignores DRDY */ 212 drive->ready_stat = 0; ··· 226 drive->removable = 1; 227 228 drive->media = ide_disk; 229 - printk("%s DISK drive\n", (id->config == 0x848a) ? "CFA" : "ATA" ); 230 231 return; 232 ··· 379 /* Mmmm.. multiple IRQs.. 380 * don't know which was ours 381 */ 382 - printk("%s: IRQ probe failed (0x%lx)\n", 383 drive->name, cookie); 384 } 385 } ··· 448 return 4; 449 } 450 #ifdef DEBUG 451 - printk("probing for %s: present=%d, media=%d, probetype=%s\n", 452 drive->name, drive->present, drive->media, 453 (cmd == WIN_IDENTIFY) ? "ATA" : "ATAPI"); 454 #endif ··· 526 const struct ide_tp_ops *tp_ops = hwif->tp_ops; 527 u8 stat; 528 529 - printk("%s: enabling %s -- ", hwif->name, drive->id->model); 530 SELECT_DRIVE(drive); 531 msleep(50); 532 tp_ops->exec_command(hwif, EXABYTE_ENABLE_NEST); ··· 876 if (m && m->hwgroup && m->hwgroup != new->hwgroup) { 877 if (!new->hwgroup) 878 return; 879 - printk("%s: potential irq problem with %s and %s\n", 880 hwif->name, new->name, m->name); 881 } 882 if (!m || m->irq != hwif->irq) /* don't undo a prior perfect match */ ··· 1135 } 1136 1137 #if !defined(__mc68000__) 1138 - printk("%s at 0x%03lx-0x%03lx,0x%03lx on irq %d", hwif->name, 1139 io_ports->data_addr, io_ports->status_addr, 1140 io_ports->ctl_addr, hwif->irq); 1141 #else 1142 - printk("%s at 0x%08lx on irq %d", hwif->name, 1143 io_ports->data_addr, hwif->irq); 1144 #endif /* __mc68000__ */ 1145 if (match) 1146 - printk(" (%sed with %s)", 1147 hwif->sharing_irq ? "shar" : "serializ", match->name); 1148 - printk("\n"); 1149 1150 mutex_unlock(&ide_cfg_mtx); 1151 return 0; ··· 1280 if (!hwif->irq) { 1281 hwif->irq = __ide_default_irq(hwif->io_ports.data_addr); 1282 if (!hwif->irq) { 1283 - printk("%s: DISABLED, NO IRQ\n", hwif->name); 1284 return 0; 1285 } 1286 } ··· 1310 */ 1311 hwif->irq = __ide_default_irq(hwif->io_ports.data_addr); 1312 if (!hwif->irq) { 1313 - printk("%s: Disabled unable to get IRQ %d.\n", 1314 hwif->name, old_irq); 1315 goto out; 1316 } 1317 if (init_irq(hwif)) { 1318 - printk("%s: probed IRQ %d and default IRQ %d failed.\n", 1319 hwif->name, old_irq, hwif->irq); 1320 goto out; 1321 } 1322 - printk("%s: probed IRQ %d failed, using default.\n", 1323 hwif->name, hwif->irq); 1324 1325 done: ··· 1588 1589 ide_init_port_data(hwif, idx); 1590 1591 host->ports[i] = hwif; 1592 host->n_ports++; 1593 } ··· 1598 kfree(host); 1599 return NULL; 1600 } 1601 1602 return host; 1603 }
··· 134 #endif 135 ide_fix_driveid(id); 136 137 /* 138 * WIN_IDENTIFY returns little-endian info, 139 * WIN_PIDENTIFY *usually* returns little-endian info. ··· 167 if (strstr(id->model, "E X A B Y T E N E S T")) 168 goto err_misc; 169 170 + printk(KERN_INFO "%s: %s, ", drive->name, id->model); 171 + 172 drive->present = 1; 173 drive->dead = 0; 174 ··· 176 */ 177 if (cmd == WIN_PIDENTIFY) { 178 u8 type = (id->config >> 8) & 0x1f; 179 + 180 + printk(KERN_CONT "ATAPI "); 181 switch (type) { 182 case ide_floppy: 183 if (!strstr(id->model, "CD-ROM")) { 184 if (!strstr(id->model, "oppy") && 185 !strstr(id->model, "poyp") && 186 !strstr(id->model, "ZIP")) 187 + printk(KERN_CONT "cdrom or floppy?, assuming "); 188 if (drive->media != ide_cdrom) { 189 + printk(KERN_CONT "FLOPPY"); 190 drive->removable = 1; 191 break; 192 } ··· 198 /* kludge for Apple PowerBook internal zip */ 199 if (!strstr(id->model, "CD-ROM") && 200 strstr(id->model, "ZIP")) { 201 + printk(KERN_CONT "FLOPPY"); 202 type = ide_floppy; 203 break; 204 } 205 #endif 206 + printk(KERN_CONT "CD/DVD-ROM"); 207 break; 208 case ide_tape: 209 + printk(KERN_CONT "TAPE"); 210 break; 211 case ide_optical: 212 + printk(KERN_CONT "OPTICAL"); 213 drive->removable = 1; 214 break; 215 default: 216 + printk(KERN_CONT "UNKNOWN (type %d)", type); 217 break; 218 } 219 + printk(KERN_CONT " drive\n"); 220 drive->media = type; 221 /* an ATAPI device ignores DRDY */ 222 drive->ready_stat = 0; ··· 236 drive->removable = 1; 237 238 drive->media = ide_disk; 239 + 240 + printk(KERN_CONT "%s DISK drive\n", 241 + (id->config == 0x848a) ? "CFA" : "ATA"); 242 243 return; 244 ··· 387 /* Mmmm.. multiple IRQs.. 388 * don't know which was ours 389 */ 390 + printk(KERN_ERR "%s: IRQ probe failed (0x%lx)\n", 391 drive->name, cookie); 392 } 393 } ··· 456 return 4; 457 } 458 #ifdef DEBUG 459 + printk(KERN_INFO "probing for %s: present=%d, media=%d, probetype=%s\n", 460 drive->name, drive->present, drive->media, 461 (cmd == WIN_IDENTIFY) ? "ATA" : "ATAPI"); 462 #endif ··· 534 const struct ide_tp_ops *tp_ops = hwif->tp_ops; 535 u8 stat; 536 537 + printk(KERN_INFO "%s: enabling %s -- ", hwif->name, drive->id->model); 538 + 539 SELECT_DRIVE(drive); 540 msleep(50); 541 tp_ops->exec_command(hwif, EXABYTE_ENABLE_NEST); ··· 883 if (m && m->hwgroup && m->hwgroup != new->hwgroup) { 884 if (!new->hwgroup) 885 return; 886 + printk(KERN_WARNING "%s: potential IRQ problem with %s and %s\n", 887 hwif->name, new->name, m->name); 888 } 889 if (!m || m->irq != hwif->irq) /* don't undo a prior perfect match */ ··· 1142 } 1143 1144 #if !defined(__mc68000__) 1145 + printk(KERN_INFO "%s at 0x%03lx-0x%03lx,0x%03lx on irq %d", hwif->name, 1146 io_ports->data_addr, io_ports->status_addr, 1147 io_ports->ctl_addr, hwif->irq); 1148 #else 1149 + printk(KERN_INFO "%s at 0x%08lx on irq %d", hwif->name, 1150 io_ports->data_addr, hwif->irq); 1151 #endif /* __mc68000__ */ 1152 if (match) 1153 + printk(KERN_CONT " (%sed with %s)", 1154 hwif->sharing_irq ? "shar" : "serializ", match->name); 1155 + printk(KERN_CONT "\n"); 1156 1157 mutex_unlock(&ide_cfg_mtx); 1158 return 0; ··· 1287 if (!hwif->irq) { 1288 hwif->irq = __ide_default_irq(hwif->io_ports.data_addr); 1289 if (!hwif->irq) { 1290 + printk(KERN_ERR "%s: disabled, no IRQ\n", hwif->name); 1291 return 0; 1292 } 1293 } ··· 1317 */ 1318 hwif->irq = __ide_default_irq(hwif->io_ports.data_addr); 1319 if (!hwif->irq) { 1320 + printk(KERN_ERR "%s: disabled, unable to get IRQ %d\n", 1321 hwif->name, old_irq); 1322 goto out; 1323 } 1324 if (init_irq(hwif)) { 1325 + printk(KERN_ERR "%s: probed IRQ %d and default IRQ %d failed\n", 1326 hwif->name, old_irq, hwif->irq); 1327 goto out; 1328 } 1329 + printk(KERN_WARNING "%s: probed IRQ %d failed, using default\n", 1330 hwif->name, hwif->irq); 1331 1332 done: ··· 1595 1596 ide_init_port_data(hwif, idx); 1597 1598 + hwif->host = host; 1599 + 1600 host->ports[i] = hwif; 1601 host->n_ports++; 1602 } ··· 1603 kfree(host); 1604 return NULL; 1605 } 1606 + 1607 + if (hws[0]) 1608 + host->dev[0] = hws[0]->dev; 1609 + 1610 + if (d) 1611 + host->host_flags = d->host_flags; 1612 1613 return host; 1614 }
+2 -2
drivers/ide/ide-proc.c
··· 105 len = sprintf(page, "\n"); 106 107 if (drive) { 108 - unsigned short *val = (unsigned short *) page; 109 110 err = taskfile_lib_get_identify(drive, page); 111 if (!err) { ··· 113 page = out; 114 do { 115 out += sprintf(out, "%04x%c", 116 - le16_to_cpu(*val), (++i & 7) ? ' ' : '\n'); 117 val += 1; 118 } while (i < (SECTOR_WORDS * 2)); 119 len = out - page;
··· 105 len = sprintf(page, "\n"); 106 107 if (drive) { 108 + __le16 *val = (__le16 *)page; 109 110 err = taskfile_lib_get_identify(drive, page); 111 if (!err) { ··· 113 page = out; 114 do { 115 out += sprintf(out, "%04x%c", 116 + le16_to_cpup(val), (++i & 7) ? ' ' : '\n'); 117 val += 1; 118 } while (i < (SECTOR_WORDS * 2)); 119 len = out - page;
+19 -13
drivers/ide/ide-tape.c
··· 322 #define ide_tape_g(disk) \ 323 container_of((disk)->private_data, struct ide_tape_obj, driver) 324 325 static struct ide_tape_obj *ide_tape_get(struct gendisk *disk) 326 { 327 struct ide_tape_obj *tape = NULL; 328 329 mutex_lock(&idetape_ref_mutex); 330 tape = ide_tape_g(disk); 331 - if (tape) 332 kref_get(&tape->kref); 333 mutex_unlock(&idetape_ref_mutex); 334 return tape; 335 } 336 337 - static void ide_tape_release(struct kref *); 338 - 339 static void ide_tape_put(struct ide_tape_obj *tape) 340 { 341 mutex_lock(&idetape_ref_mutex); 342 kref_put(&tape->kref, ide_tape_release); 343 mutex_unlock(&idetape_ref_mutex); 344 } ··· 655 uptodate = 0; 656 } else { 657 debug_log(DBG_SENSE, "Block Location - %u\n", 658 - be32_to_cpu(*(u32 *)&readpos[4])); 659 660 tape->partition = readpos[1]; 661 - tape->first_frame = be32_to_cpu(*(u32 *)&readpos[4]); 662 set_bit(IDE_AFLAG_ADDRESS_VALID, &drive->atapi_flags); 663 } 664 } ··· 2381 caps = pc.buf + 4 + pc.buf[3]; 2382 2383 /* convert to host order and save for later use */ 2384 - speed = be16_to_cpu(*(u16 *)&caps[14]); 2385 - max_speed = be16_to_cpu(*(u16 *)&caps[8]); 2386 2387 - put_unaligned(max_speed, (u16 *)&caps[8]); 2388 - put_unaligned(be16_to_cpu(*(u16 *)&caps[12]), (u16 *)&caps[12]); 2389 - put_unaligned(speed, (u16 *)&caps[14]); 2390 - put_unaligned(be16_to_cpu(*(u16 *)&caps[16]), (u16 *)&caps[16]); 2391 2392 if (!speed) { 2393 printk(KERN_INFO "ide-tape: %s: invalid tape speed " 2394 "(assuming 650KB/sec)\n", drive->name); 2395 - put_unaligned(650, (u16 *)&caps[14]); 2396 } 2397 if (!max_speed) { 2398 printk(KERN_INFO "ide-tape: %s: invalid max_speed " 2399 "(assuming 650KB/sec)\n", drive->name); 2400 - put_unaligned(650, (u16 *)&caps[8]); 2401 } 2402 2403 memcpy(&tape->caps, caps, 20);
··· 322 #define ide_tape_g(disk) \ 323 container_of((disk)->private_data, struct ide_tape_obj, driver) 324 325 + static void ide_tape_release(struct kref *); 326 + 327 static struct ide_tape_obj *ide_tape_get(struct gendisk *disk) 328 { 329 struct ide_tape_obj *tape = NULL; 330 331 mutex_lock(&idetape_ref_mutex); 332 tape = ide_tape_g(disk); 333 + if (tape) { 334 kref_get(&tape->kref); 335 + if (ide_device_get(tape->drive)) { 336 + kref_put(&tape->kref, ide_tape_release); 337 + tape = NULL; 338 + } 339 + } 340 mutex_unlock(&idetape_ref_mutex); 341 return tape; 342 } 343 344 static void ide_tape_put(struct ide_tape_obj *tape) 345 { 346 mutex_lock(&idetape_ref_mutex); 347 + ide_device_put(tape->drive); 348 kref_put(&tape->kref, ide_tape_release); 349 mutex_unlock(&idetape_ref_mutex); 350 } ··· 649 uptodate = 0; 650 } else { 651 debug_log(DBG_SENSE, "Block Location - %u\n", 652 + be32_to_cpup((__be32 *)&readpos[4])); 653 654 tape->partition = readpos[1]; 655 + tape->first_frame = be32_to_cpup((__be32 *)&readpos[4]); 656 set_bit(IDE_AFLAG_ADDRESS_VALID, &drive->atapi_flags); 657 } 658 } ··· 2375 caps = pc.buf + 4 + pc.buf[3]; 2376 2377 /* convert to host order and save for later use */ 2378 + speed = be16_to_cpup((__be16 *)&caps[14]); 2379 + max_speed = be16_to_cpup((__be16 *)&caps[8]); 2380 2381 + *(u16 *)&caps[8] = max_speed; 2382 + *(u16 *)&caps[12] = be16_to_cpup((__be16 *)&caps[12]); 2383 + *(u16 *)&caps[14] = speed; 2384 + *(u16 *)&caps[16] = be16_to_cpup((__be16 *)&caps[16]); 2385 2386 if (!speed) { 2387 printk(KERN_INFO "ide-tape: %s: invalid tape speed " 2388 "(assuming 650KB/sec)\n", drive->name); 2389 + *(u16 *)&caps[14] = 650; 2390 } 2391 if (!max_speed) { 2392 printk(KERN_INFO "ide-tape: %s: invalid max_speed " 2393 "(assuming 650KB/sec)\n", drive->name); 2394 + *(u16 *)&caps[8] = 650; 2395 } 2396 2397 memcpy(&tape->caps, caps, 20);
+10 -2
drivers/ide/ide-taskfile.c
··· 126 static ide_startstop_t set_multmode_intr(ide_drive_t *drive) 127 { 128 ide_hwif_t *hwif = drive->hwif; 129 - u8 stat = hwif->tp_ops->read_status(hwif); 130 131 if (OK_STAT(stat, READY_STAT, BAD_STAT)) 132 drive->mult_count = drive->mult_req; ··· 149 ide_hwif_t *hwif = drive->hwif; 150 int retries = 5; 151 u8 stat; 152 153 while (1) { 154 stat = hwif->tp_ops->read_status(hwif); ··· 175 static ide_startstop_t recal_intr(ide_drive_t *drive) 176 { 177 ide_hwif_t *hwif = drive->hwif; 178 - u8 stat = hwif->tp_ops->read_status(hwif); 179 180 if (!OK_STAT(stat, READY_STAT, BAD_STAT)) 181 return ide_error(drive, "recal_intr", stat);
··· 126 static ide_startstop_t set_multmode_intr(ide_drive_t *drive) 127 { 128 ide_hwif_t *hwif = drive->hwif; 129 + u8 stat; 130 + 131 + local_irq_enable_in_hardirq(); 132 + stat = hwif->tp_ops->read_status(hwif); 133 134 if (OK_STAT(stat, READY_STAT, BAD_STAT)) 135 drive->mult_count = drive->mult_req; ··· 146 ide_hwif_t *hwif = drive->hwif; 147 int retries = 5; 148 u8 stat; 149 + 150 + local_irq_enable_in_hardirq(); 151 152 while (1) { 153 stat = hwif->tp_ops->read_status(hwif); ··· 170 static ide_startstop_t recal_intr(ide_drive_t *drive) 171 { 172 ide_hwif_t *hwif = drive->hwif; 173 + u8 stat; 174 + 175 + local_irq_enable_in_hardirq(); 176 + stat = hwif->tp_ops->read_status(hwif); 177 178 if (!OK_STAT(stat, READY_STAT, BAD_STAT)) 179 return ide_error(drive, "recal_intr", stat);
+47
drivers/ide/ide.c
··· 618 619 EXPORT_SYMBOL(generic_ide_ioctl); 620 621 static int ide_bus_match(struct device *dev, struct device_driver *drv) 622 { 623 return 1;
··· 618 619 EXPORT_SYMBOL(generic_ide_ioctl); 620 621 + /** 622 + * ide_device_get - get an additional reference to a ide_drive_t 623 + * @drive: device to get a reference to 624 + * 625 + * Gets a reference to the ide_drive_t and increments the use count of the 626 + * underlying LLDD module. 627 + */ 628 + int ide_device_get(ide_drive_t *drive) 629 + { 630 + struct device *host_dev; 631 + struct module *module; 632 + 633 + if (!get_device(&drive->gendev)) 634 + return -ENXIO; 635 + 636 + host_dev = drive->hwif->host->dev[0]; 637 + module = host_dev ? host_dev->driver->owner : NULL; 638 + 639 + if (module && !try_module_get(module)) { 640 + put_device(&drive->gendev); 641 + return -ENXIO; 642 + } 643 + 644 + return 0; 645 + } 646 + EXPORT_SYMBOL_GPL(ide_device_get); 647 + 648 + /** 649 + * ide_device_put - release a reference to a ide_drive_t 650 + * @drive: device to release a reference on 651 + * 652 + * Release a reference to the ide_drive_t and decrements the use count of 653 + * the underlying LLDD module. 654 + */ 655 + void ide_device_put(ide_drive_t *drive) 656 + { 657 + #ifdef CONFIG_MODULE_UNLOAD 658 + struct device *host_dev = drive->hwif->host->dev[0]; 659 + struct module *module = host_dev ? host_dev->driver->owner : NULL; 660 + 661 + if (module) 662 + module_put(module); 663 + #endif 664 + put_device(&drive->gendev); 665 + } 666 + EXPORT_SYMBOL_GPL(ide_device_put); 667 + 668 static int ide_bus_match(struct device *dev, struct device_driver *drv) 669 { 670 return 1;
+6 -2
drivers/ide/legacy/gayle.c
··· 127 unsigned long phys_base, res_start, res_n; 128 unsigned long base, ctrlport, irqport; 129 ide_ack_intr_t *ack_intr; 130 - int a4000, i; 131 hw_regs_t hw[GAYLE_NUM_HWIFS], *hws[] = { NULL, NULL, NULL, NULL }; 132 133 if (!MACH_IS_AMIGA) ··· 179 hws[i] = &hw[i]; 180 } 181 182 - return ide_host_add(NULL, hws, NULL); 183 } 184 185 module_init(gayle_init);
··· 127 unsigned long phys_base, res_start, res_n; 128 unsigned long base, ctrlport, irqport; 129 ide_ack_intr_t *ack_intr; 130 + int a4000, i, rc; 131 hw_regs_t hw[GAYLE_NUM_HWIFS], *hws[] = { NULL, NULL, NULL, NULL }; 132 133 if (!MACH_IS_AMIGA) ··· 179 hws[i] = &hw[i]; 180 } 181 182 + rc = ide_host_add(NULL, hws, NULL); 183 + if (rc) 184 + release_mem_region(res_start, res_n); 185 + 186 + return rc; 187 } 188 189 module_init(gayle_init);
+1 -23
drivers/ide/legacy/ht6560b.c
··· 3 */ 4 5 /* 6 - * 7 - * Version 0.01 Initial version hacked out of ide.c 8 - * 9 - * Version 0.02 Added support for PIO modes, auto-tune 10 - * 11 - * Version 0.03 Some cleanups 12 - * 13 - * Version 0.05 PIO mode cycle timings auto-tune using bus-speed 14 - * 15 - * Version 0.06 Prefetch mode now defaults no OFF. To set 16 - * prefetch mode OFF/ON use "hdparm -p8/-p9". 17 - * Unmask irq is disabled when prefetch mode 18 - * is enabled. 19 - * 20 - * Version 0.07 Trying to fix CD-ROM detection problem. 21 - * "Prefetch" mode bit OFF for ide disks and 22 - * ON for anything else. 23 - * 24 - * Version 0.08 Need to force prefetch for CDs and other non-disk 25 - * devices. (not sure which devices exactly need 26 - * prefetch) 27 - * 28 * HT-6560B EIDE-controller support 29 * To activate controller support use kernel parameter "ide0=ht6560b". 30 * Use hdparm utility to enable PIO mode support. 31 * 32 * Author: Mikko Ala-Fossi <maf@iki.fi> 33 - * Jan Evert van Grootheest <janevert@caiway.nl> 34 * 35 * Try: http://www.maf.iki.fi/~maf/ht6560b/ 36 */
··· 3 */ 4 5 /* 6 * HT-6560B EIDE-controller support 7 * To activate controller support use kernel parameter "ide0=ht6560b". 8 * Use hdparm utility to enable PIO mode support. 9 * 10 * Author: Mikko Ala-Fossi <maf@iki.fi> 11 + * Jan Evert van Grootheest <j.e.van.grootheest@caiway.nl> 12 * 13 * Try: http://www.maf.iki.fi/~maf/ht6560b/ 14 */
+48 -28
drivers/ide/pci/aec62xx.c
··· 13 14 #include <asm/io.h> 15 16 struct chipset_bus_clock_list_entry { 17 u8 xfer_speed; 18 u8 chipset_settings; ··· 61 { 0, 0x00, 0x00 } 62 }; 63 64 - #define BUSCLOCK(D) \ 65 - ((struct chipset_bus_clock_list_entry *) pci_get_drvdata((D))) 66 - 67 - 68 /* 69 * TO DO: active tuning and correction of cards without a bios. 70 */ ··· 86 { 87 ide_hwif_t *hwif = HWIF(drive); 88 struct pci_dev *dev = to_pci_dev(hwif->dev); 89 u16 d_conf = 0; 90 u8 ultra = 0, ultra_conf = 0; 91 u8 tmp0 = 0, tmp1 = 0, tmp2 = 0; ··· 96 local_irq_save(flags); 97 /* 0x40|(2*drive->dn): Active, 0x41|(2*drive->dn): Recovery */ 98 pci_read_config_word(dev, 0x40|(2*drive->dn), &d_conf); 99 - tmp0 = pci_bus_clock_list(speed, BUSCLOCK(dev)); 100 d_conf = ((tmp0 & 0xf0) << 4) | (tmp0 & 0xf); 101 pci_write_config_word(dev, 0x40|(2*drive->dn), d_conf); 102 ··· 104 tmp2 = 0x00; 105 pci_read_config_byte(dev, 0x54, &ultra); 106 tmp1 = ((0x00 << (2*drive->dn)) | (ultra & ~(3 << (2*drive->dn)))); 107 - ultra_conf = pci_bus_clock_list_ultra(speed, BUSCLOCK(dev)); 108 tmp2 = ((ultra_conf << (2*drive->dn)) | (tmp1 & ~(3 << (2*drive->dn)))); 109 pci_write_config_byte(dev, 0x54, tmp2); 110 local_irq_restore(flags); ··· 114 { 115 ide_hwif_t *hwif = HWIF(drive); 116 struct pci_dev *dev = to_pci_dev(hwif->dev); 117 u8 unit = (drive->select.b.unit & 0x01); 118 u8 tmp1 = 0, tmp2 = 0; 119 u8 ultra = 0, drive_conf = 0, ultra_conf = 0; ··· 124 local_irq_save(flags); 125 /* high 4-bits: Active, low 4-bits: Recovery */ 126 pci_read_config_byte(dev, 0x40|drive->dn, &drive_conf); 127 - drive_conf = pci_bus_clock_list(speed, BUSCLOCK(dev)); 128 pci_write_config_byte(dev, 0x40|drive->dn, drive_conf); 129 130 pci_read_config_byte(dev, (0x44|hwif->channel), &ultra); 131 tmp1 = ((0x00 << (4*unit)) | (ultra & ~(7 << (4*unit)))); 132 - ultra_conf = pci_bus_clock_list_ultra(speed, BUSCLOCK(dev)); 133 tmp2 = ((ultra_conf << (4*unit)) | (tmp1 & ~(7 << (4*unit)))); 134 pci_write_config_byte(dev, (0x44|hwif->channel), tmp2); 135 local_irq_restore(flags); ··· 140 drive->hwif->port_ops->set_dma_mode(drive, pio + XFER_PIO_0); 141 } 142 143 - static unsigned int __devinit init_chipset_aec62xx(struct pci_dev *dev, const char *name) 144 { 145 - int bus_speed = ide_pci_clk ? ide_pci_clk : 33; 146 - 147 - if (bus_speed <= 33) 148 - pci_set_drvdata(dev, (void *) aec6xxx_33_base); 149 - else 150 - pci_set_drvdata(dev, (void *) aec6xxx_34_base); 151 - 152 /* These are necessary to get AEC6280 Macintosh cards to work */ 153 if ((dev->device == PCI_DEVICE_ID_ARTOP_ATP865) || 154 (dev->device == PCI_DEVICE_ID_ARTOP_ATP865R)) { ··· 182 }; 183 184 static const struct ide_port_info aec62xx_chipsets[] __devinitdata = { 185 - { /* 0 */ 186 - .name = "AEC6210", 187 .init_chipset = init_chipset_aec62xx, 188 .enablebits = {{0x4a,0x02,0x02}, {0x4a,0x04,0x04}}, 189 .port_ops = &atp850_port_ops, ··· 194 .pio_mask = ATA_PIO4, 195 .mwdma_mask = ATA_MWDMA2, 196 .udma_mask = ATA_UDMA2, 197 - },{ /* 1 */ 198 - .name = "AEC6260", 199 .init_chipset = init_chipset_aec62xx, 200 .port_ops = &atp86x_port_ops, 201 .host_flags = IDE_HFLAG_NO_ATAPI_DMA | IDE_HFLAG_NO_AUTODMA | ··· 204 .pio_mask = ATA_PIO4, 205 .mwdma_mask = ATA_MWDMA2, 206 .udma_mask = ATA_UDMA4, 207 - },{ /* 2 */ 208 - .name = "AEC6260R", 209 .init_chipset = init_chipset_aec62xx, 210 .enablebits = {{0x4a,0x02,0x02}, {0x4a,0x04,0x04}}, 211 .port_ops = &atp86x_port_ops, ··· 215 .pio_mask = ATA_PIO4, 216 .mwdma_mask = ATA_MWDMA2, 217 .udma_mask = ATA_UDMA4, 218 - },{ /* 3 */ 219 - .name = "AEC6280", 220 .init_chipset = init_chipset_aec62xx, 221 .port_ops = &atp86x_port_ops, 222 .host_flags = IDE_HFLAG_NO_ATAPI_DMA | ··· 225 .pio_mask = ATA_PIO4, 226 .mwdma_mask = ATA_MWDMA2, 227 .udma_mask = ATA_UDMA5, 228 - },{ /* 4 */ 229 - .name = "AEC6280R", 230 .init_chipset = init_chipset_aec62xx, 231 .enablebits = {{0x4a,0x02,0x02}, {0x4a,0x04,0x04}}, 232 .port_ops = &atp86x_port_ops, ··· 253 254 static int __devinit aec62xx_init_one(struct pci_dev *dev, const struct pci_device_id *id) 255 { 256 struct ide_port_info d; 257 u8 idx = id->driver_data; 258 int err; 259 260 err = pci_enable_device(dev); 261 if (err) ··· 274 unsigned long dma_base = pci_resource_start(dev, 4); 275 276 if (inb(dma_base + 2) & 0x10) { 277 - d.name = (idx == 4) ? "AEC6880R" : "AEC6880"; 278 d.udma_mask = ATA_UDMA6; 279 } 280 } 281 282 - err = ide_setup_pci_device(dev, &d); 283 if (err) 284 pci_disable_device(dev); 285 286 return err; 287 } 288 289 static const struct pci_device_id aec62xx_pci_tbl[] = { ··· 307 .name = "AEC62xx_IDE", 308 .id_table = aec62xx_pci_tbl, 309 .probe = aec62xx_init_one, 310 }; 311 312 static int __init aec62xx_ide_init(void) ··· 315 return ide_pci_register_driver(&driver); 316 } 317 318 module_init(aec62xx_ide_init); 319 320 MODULE_AUTHOR("Andre Hedrick"); 321 MODULE_DESCRIPTION("PCI driver module for ARTOP AEC62xx IDE");
··· 13 14 #include <asm/io.h> 15 16 + #define DRV_NAME "aec62xx" 17 + 18 struct chipset_bus_clock_list_entry { 19 u8 xfer_speed; 20 u8 chipset_settings; ··· 59 { 0, 0x00, 0x00 } 60 }; 61 62 /* 63 * TO DO: active tuning and correction of cards without a bios. 64 */ ··· 88 { 89 ide_hwif_t *hwif = HWIF(drive); 90 struct pci_dev *dev = to_pci_dev(hwif->dev); 91 + struct ide_host *host = pci_get_drvdata(dev); 92 + struct chipset_bus_clock_list_entry *bus_clock = host->host_priv; 93 u16 d_conf = 0; 94 u8 ultra = 0, ultra_conf = 0; 95 u8 tmp0 = 0, tmp1 = 0, tmp2 = 0; ··· 96 local_irq_save(flags); 97 /* 0x40|(2*drive->dn): Active, 0x41|(2*drive->dn): Recovery */ 98 pci_read_config_word(dev, 0x40|(2*drive->dn), &d_conf); 99 + tmp0 = pci_bus_clock_list(speed, bus_clock); 100 d_conf = ((tmp0 & 0xf0) << 4) | (tmp0 & 0xf); 101 pci_write_config_word(dev, 0x40|(2*drive->dn), d_conf); 102 ··· 104 tmp2 = 0x00; 105 pci_read_config_byte(dev, 0x54, &ultra); 106 tmp1 = ((0x00 << (2*drive->dn)) | (ultra & ~(3 << (2*drive->dn)))); 107 + ultra_conf = pci_bus_clock_list_ultra(speed, bus_clock); 108 tmp2 = ((ultra_conf << (2*drive->dn)) | (tmp1 & ~(3 << (2*drive->dn)))); 109 pci_write_config_byte(dev, 0x54, tmp2); 110 local_irq_restore(flags); ··· 114 { 115 ide_hwif_t *hwif = HWIF(drive); 116 struct pci_dev *dev = to_pci_dev(hwif->dev); 117 + struct ide_host *host = pci_get_drvdata(dev); 118 + struct chipset_bus_clock_list_entry *bus_clock = host->host_priv; 119 u8 unit = (drive->select.b.unit & 0x01); 120 u8 tmp1 = 0, tmp2 = 0; 121 u8 ultra = 0, drive_conf = 0, ultra_conf = 0; ··· 122 local_irq_save(flags); 123 /* high 4-bits: Active, low 4-bits: Recovery */ 124 pci_read_config_byte(dev, 0x40|drive->dn, &drive_conf); 125 + drive_conf = pci_bus_clock_list(speed, bus_clock); 126 pci_write_config_byte(dev, 0x40|drive->dn, drive_conf); 127 128 pci_read_config_byte(dev, (0x44|hwif->channel), &ultra); 129 tmp1 = ((0x00 << (4*unit)) | (ultra & ~(7 << (4*unit)))); 130 + ultra_conf = pci_bus_clock_list_ultra(speed, bus_clock); 131 tmp2 = ((ultra_conf << (4*unit)) | (tmp1 & ~(7 << (4*unit)))); 132 pci_write_config_byte(dev, (0x44|hwif->channel), tmp2); 133 local_irq_restore(flags); ··· 138 drive->hwif->port_ops->set_dma_mode(drive, pio + XFER_PIO_0); 139 } 140 141 + static unsigned int __devinit init_chipset_aec62xx(struct pci_dev *dev) 142 { 143 /* These are necessary to get AEC6280 Macintosh cards to work */ 144 if ((dev->device == PCI_DEVICE_ID_ARTOP_ATP865) || 145 (dev->device == PCI_DEVICE_ID_ARTOP_ATP865R)) { ··· 187 }; 188 189 static const struct ide_port_info aec62xx_chipsets[] __devinitdata = { 190 + { /* 0: AEC6210 */ 191 + .name = DRV_NAME, 192 .init_chipset = init_chipset_aec62xx, 193 .enablebits = {{0x4a,0x02,0x02}, {0x4a,0x04,0x04}}, 194 .port_ops = &atp850_port_ops, ··· 199 .pio_mask = ATA_PIO4, 200 .mwdma_mask = ATA_MWDMA2, 201 .udma_mask = ATA_UDMA2, 202 + }, 203 + { /* 1: AEC6260 */ 204 + .name = DRV_NAME, 205 .init_chipset = init_chipset_aec62xx, 206 .port_ops = &atp86x_port_ops, 207 .host_flags = IDE_HFLAG_NO_ATAPI_DMA | IDE_HFLAG_NO_AUTODMA | ··· 208 .pio_mask = ATA_PIO4, 209 .mwdma_mask = ATA_MWDMA2, 210 .udma_mask = ATA_UDMA4, 211 + }, 212 + { /* 2: AEC6260R */ 213 + .name = DRV_NAME, 214 .init_chipset = init_chipset_aec62xx, 215 .enablebits = {{0x4a,0x02,0x02}, {0x4a,0x04,0x04}}, 216 .port_ops = &atp86x_port_ops, ··· 218 .pio_mask = ATA_PIO4, 219 .mwdma_mask = ATA_MWDMA2, 220 .udma_mask = ATA_UDMA4, 221 + }, 222 + { /* 3: AEC6280 */ 223 + .name = DRV_NAME, 224 .init_chipset = init_chipset_aec62xx, 225 .port_ops = &atp86x_port_ops, 226 .host_flags = IDE_HFLAG_NO_ATAPI_DMA | ··· 227 .pio_mask = ATA_PIO4, 228 .mwdma_mask = ATA_MWDMA2, 229 .udma_mask = ATA_UDMA5, 230 + }, 231 + { /* 4: AEC6280R */ 232 + .name = DRV_NAME, 233 .init_chipset = init_chipset_aec62xx, 234 .enablebits = {{0x4a,0x02,0x02}, {0x4a,0x04,0x04}}, 235 .port_ops = &atp86x_port_ops, ··· 254 255 static int __devinit aec62xx_init_one(struct pci_dev *dev, const struct pci_device_id *id) 256 { 257 + const struct chipset_bus_clock_list_entry *bus_clock; 258 struct ide_port_info d; 259 u8 idx = id->driver_data; 260 + int bus_speed = ide_pci_clk ? ide_pci_clk : 33; 261 int err; 262 + 263 + if (bus_speed <= 33) 264 + bus_clock = aec6xxx_33_base; 265 + else 266 + bus_clock = aec6xxx_34_base; 267 268 err = pci_enable_device(dev); 269 if (err) ··· 268 unsigned long dma_base = pci_resource_start(dev, 4); 269 270 if (inb(dma_base + 2) & 0x10) { 271 + printk(KERN_INFO DRV_NAME " %s: AEC6880%s card detected" 272 + "\n", pci_name(dev), (idx == 4) ? "R" : ""); 273 d.udma_mask = ATA_UDMA6; 274 } 275 } 276 277 + err = ide_pci_init_one(dev, &d, (void *)bus_clock); 278 if (err) 279 pci_disable_device(dev); 280 281 return err; 282 + } 283 + 284 + static void __devexit aec62xx_remove(struct pci_dev *dev) 285 + { 286 + ide_pci_remove(dev); 287 + pci_disable_device(dev); 288 } 289 290 static const struct pci_device_id aec62xx_pci_tbl[] = { ··· 294 .name = "AEC62xx_IDE", 295 .id_table = aec62xx_pci_tbl, 296 .probe = aec62xx_init_one, 297 + .remove = aec62xx_remove, 298 }; 299 300 static int __init aec62xx_ide_init(void) ··· 301 return ide_pci_register_driver(&driver); 302 } 303 304 + static void __exit aec62xx_ide_exit(void) 305 + { 306 + pci_unregister_driver(&driver); 307 + } 308 + 309 module_init(aec62xx_ide_init); 310 + module_exit(aec62xx_ide_exit); 311 312 MODULE_AUTHOR("Andre Hedrick"); 313 MODULE_DESCRIPTION("PCI driver module for ARTOP AEC62xx IDE");
+13 -5
drivers/ide/pci/alim15x3.c
··· 38 39 #include <asm/io.h> 40 41 /* 42 * Allow UDMA on M1543C-E chipset for WDC disks that ignore CRC checking 43 * (this is DANGEROUS and could result in data corruption). ··· 209 /** 210 * init_chipset_ali15x3 - Initialise an ALi IDE controller 211 * @dev: PCI device 212 - * @name: Name of the controller 213 * 214 * This function initializes the ALI IDE controller and where 215 * appropriate also sets up the 1533 southbridge. 216 */ 217 - 218 - static unsigned int __devinit init_chipset_ali15x3 (struct pci_dev *dev, const char *name) 219 { 220 unsigned long flags; 221 u8 tmpbyte; ··· 516 }; 517 518 static const struct ide_port_info ali15x3_chipset __devinitdata = { 519 - .name = "ALI15X3", 520 .init_chipset = init_chipset_ali15x3, 521 .init_hwif = init_hwif_ali15x3, 522 .init_dma = init_dma_ali15x3, ··· 566 if (idx == 0) 567 d.host_flags |= IDE_HFLAG_CLEAR_SIMPLEX; 568 569 - return ide_setup_pci_device(dev, &d); 570 } 571 572 ··· 581 .name = "ALI15x3_IDE", 582 .id_table = alim15x3_pci_tbl, 583 .probe = alim15x3_init_one, 584 }; 585 586 static int __init ali15x3_ide_init(void) ··· 589 return ide_pci_register_driver(&driver); 590 } 591 592 module_init(ali15x3_ide_init); 593 594 MODULE_AUTHOR("Michael Aubry, Andrzej Krzysztofowicz, CJ, Andre Hedrick, Alan Cox"); 595 MODULE_DESCRIPTION("PCI driver module for ALi 15x3 IDE");
··· 38 39 #include <asm/io.h> 40 41 + #define DRV_NAME "alim15x3" 42 + 43 /* 44 * Allow UDMA on M1543C-E chipset for WDC disks that ignore CRC checking 45 * (this is DANGEROUS and could result in data corruption). ··· 207 /** 208 * init_chipset_ali15x3 - Initialise an ALi IDE controller 209 * @dev: PCI device 210 * 211 * This function initializes the ALI IDE controller and where 212 * appropriate also sets up the 1533 southbridge. 213 */ 214 + 215 + static unsigned int __devinit init_chipset_ali15x3(struct pci_dev *dev) 216 { 217 unsigned long flags; 218 u8 tmpbyte; ··· 515 }; 516 517 static const struct ide_port_info ali15x3_chipset __devinitdata = { 518 + .name = DRV_NAME, 519 .init_chipset = init_chipset_ali15x3, 520 .init_hwif = init_hwif_ali15x3, 521 .init_dma = init_dma_ali15x3, ··· 565 if (idx == 0) 566 d.host_flags |= IDE_HFLAG_CLEAR_SIMPLEX; 567 568 + return ide_pci_init_one(dev, &d, NULL); 569 } 570 571 ··· 580 .name = "ALI15x3_IDE", 581 .id_table = alim15x3_pci_tbl, 582 .probe = alim15x3_init_one, 583 + .remove = ide_pci_remove, 584 }; 585 586 static int __init ali15x3_ide_init(void) ··· 587 return ide_pci_register_driver(&driver); 588 } 589 590 + static void __exit ali15x3_ide_exit(void) 591 + { 592 + return pci_unregister_driver(&driver); 593 + } 594 + 595 module_init(ali15x3_ide_init); 596 + module_exit(ali15x3_ide_exit); 597 598 MODULE_AUTHOR("Michael Aubry, Andrzej Krzysztofowicz, CJ, Andre Hedrick, Alan Cox"); 599 MODULE_DESCRIPTION("PCI driver module for ALi 15x3 IDE");
+70 -81
drivers/ide/pci/amd74xx.c
··· 21 #include <linux/init.h> 22 #include <linux/ide.h> 23 24 enum { 25 AMD_IDE_CONFIG = 0x41, 26 AMD_CABLE_DETECT = 0x42, ··· 112 amd_set_drive(drive, XFER_PIO_0 + pio); 113 } 114 115 - static void __devinit amd7409_cable_detect(struct pci_dev *dev, 116 - const char *name) 117 { 118 /* no host side cable detection */ 119 amd_80w = 0x03; 120 } 121 122 - static void __devinit amd7411_cable_detect(struct pci_dev *dev, 123 - const char *name) 124 { 125 int i; 126 u32 u = 0; ··· 129 amd_80w = ((t & 0x3) ? 1 : 0) | ((t & 0xc) ? 2 : 0); 130 for (i = 24; i >= 0; i -= 8) 131 if (((u >> i) & 4) && !(amd_80w & (1 << (1 - (i >> 4))))) { 132 - printk(KERN_WARNING "%s: BIOS didn't set cable bits " 133 - "correctly. Enabling workaround.\n", 134 - name); 135 amd_80w |= (1 << (1 - (i >> 4))); 136 } 137 } ··· 140 * The initialization callback. Initialize drive independent registers. 141 */ 142 143 - static unsigned int __devinit init_chipset_amd74xx(struct pci_dev *dev, 144 - const char *name) 145 { 146 u8 t = 0, offset = amd_offset(dev); 147 ··· 153 ; /* no UDMA > 2 */ 154 else if (dev->vendor == PCI_VENDOR_ID_AMD && 155 dev->device == PCI_DEVICE_ID_AMD_VIPER_7409) 156 - amd7409_cable_detect(dev, name); 157 else 158 - amd7411_cable_detect(dev, name); 159 160 /* 161 * Take care of prefetch & postwrite. ··· 171 else 172 t |= 0xf0; 173 pci_write_config_byte(dev, AMD_IDE_CONFIG + offset, t); 174 - 175 - /* 176 - * Determine the system bus clock. 177 - */ 178 - 179 - amd_clock = (ide_pci_clk ? ide_pci_clk : 33) * 1000; 180 - 181 - switch (amd_clock) { 182 - case 33000: amd_clock = 33333; break; 183 - case 37000: amd_clock = 37500; break; 184 - case 41000: amd_clock = 41666; break; 185 - } 186 - 187 - if (amd_clock < 20000 || amd_clock > 50000) { 188 - printk(KERN_WARNING "%s: User given PCI clock speed impossible (%d), using 33 MHz instead.\n", 189 - name, amd_clock); 190 - amd_clock = 33333; 191 - } 192 193 return dev->irq; 194 } ··· 203 IDE_HFLAG_IO_32BIT | \ 204 IDE_HFLAG_UNMASK_IRQS) 205 206 - #define DECLARE_AMD_DEV(name_str, swdma, udma) \ 207 { \ 208 - .name = name_str, \ 209 .init_chipset = init_chipset_amd74xx, \ 210 .init_hwif = init_hwif_amd74xx, \ 211 .enablebits = {{0x40,0x02,0x02}, {0x40,0x01,0x01}}, \ ··· 217 .udma_mask = udma, \ 218 } 219 220 - #define DECLARE_NV_DEV(name_str, udma) \ 221 { \ 222 - .name = name_str, \ 223 .init_chipset = init_chipset_amd74xx, \ 224 .init_hwif = init_hwif_amd74xx, \ 225 .enablebits = {{0x50,0x02,0x02}, {0x50,0x01,0x01}}, \ ··· 232 } 233 234 static const struct ide_port_info amd74xx_chipsets[] __devinitdata = { 235 - /* 0 */ DECLARE_AMD_DEV("AMD7401", 0x00, ATA_UDMA2), 236 - /* 1 */ DECLARE_AMD_DEV("AMD7409", ATA_SWDMA2, ATA_UDMA4), 237 - /* 2 */ DECLARE_AMD_DEV("AMD7411", ATA_SWDMA2, ATA_UDMA5), 238 - /* 3 */ DECLARE_AMD_DEV("AMD7441", ATA_SWDMA2, ATA_UDMA5), 239 - /* 4 */ DECLARE_AMD_DEV("AMD8111", ATA_SWDMA2, ATA_UDMA6), 240 241 - /* 5 */ DECLARE_NV_DEV("NFORCE", ATA_UDMA5), 242 - /* 6 */ DECLARE_NV_DEV("NFORCE2", ATA_UDMA6), 243 - /* 7 */ DECLARE_NV_DEV("NFORCE2-U400R", ATA_UDMA6), 244 - /* 8 */ DECLARE_NV_DEV("NFORCE2-U400R-SATA", ATA_UDMA6), 245 - /* 9 */ DECLARE_NV_DEV("NFORCE3-150", ATA_UDMA6), 246 - /* 10 */ DECLARE_NV_DEV("NFORCE3-250", ATA_UDMA6), 247 - /* 11 */ DECLARE_NV_DEV("NFORCE3-250-SATA", ATA_UDMA6), 248 - /* 12 */ DECLARE_NV_DEV("NFORCE3-250-SATA2", ATA_UDMA6), 249 - /* 13 */ DECLARE_NV_DEV("NFORCE-CK804", ATA_UDMA6), 250 - /* 14 */ DECLARE_NV_DEV("NFORCE-MCP04", ATA_UDMA6), 251 - /* 15 */ DECLARE_NV_DEV("NFORCE-MCP51", ATA_UDMA6), 252 - /* 16 */ DECLARE_NV_DEV("NFORCE-MCP55", ATA_UDMA6), 253 - /* 17 */ DECLARE_NV_DEV("NFORCE-MCP61", ATA_UDMA6), 254 - /* 18 */ DECLARE_NV_DEV("NFORCE-MCP65", ATA_UDMA6), 255 - /* 19 */ DECLARE_NV_DEV("NFORCE-MCP67", ATA_UDMA6), 256 - /* 20 */ DECLARE_NV_DEV("NFORCE-MCP73", ATA_UDMA6), 257 - /* 21 */ DECLARE_NV_DEV("NFORCE-MCP77", ATA_UDMA6), 258 259 - /* 22 */ DECLARE_AMD_DEV("AMD5536", ATA_SWDMA2, ATA_UDMA5), 260 }; 261 262 static int __devinit amd74xx_probe(struct pci_dev *dev, const struct pci_device_id *id) ··· 257 if (dev->revision <= 7) 258 d.swdma_mask = 0; 259 d.host_flags |= IDE_HFLAG_CLEAR_SIMPLEX; 260 - } else if (idx == 4) { 261 if (dev->subsystem_vendor == PCI_VENDOR_ID_AMD && 262 dev->subsystem_device == PCI_DEVICE_ID_AMD_SERENADE) 263 d.udma_mask = ATA_UDMA5; 264 } 265 266 - printk(KERN_INFO "%s: %s (rev %02x) UDMA%s controller\n", 267 - d.name, pci_name(dev), dev->revision, 268 - amd_dma[fls(d.udma_mask) - 1]); 269 270 - return ide_setup_pci_device(dev, &d); 271 } 272 273 static const struct pci_device_id amd74xx_pci_tbl[] = { 274 { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_COBRA_7401), 0 }, 275 { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_VIPER_7409), 1 }, 276 { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_VIPER_7411), 2 }, 277 - { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_OPUS_7441), 3 }, 278 - { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_8111_IDE), 4 }, 279 - { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_IDE), 5 }, 280 - { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE2_IDE), 6 }, 281 - { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE2S_IDE), 7 }, 282 #ifdef CONFIG_BLK_DEV_IDE_SATA 283 - { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE2S_SATA), 8 }, 284 #endif 285 - { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE3_IDE), 9 }, 286 - { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE3S_IDE), 10 }, 287 #ifdef CONFIG_BLK_DEV_IDE_SATA 288 - { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE3S_SATA), 11 }, 289 - { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE3S_SATA2), 12 }, 290 #endif 291 - { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_CK804_IDE), 13 }, 292 - { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP04_IDE), 14 }, 293 - { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP51_IDE), 15 }, 294 - { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP55_IDE), 16 }, 295 - { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP61_IDE), 17 }, 296 - { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP65_IDE), 18 }, 297 - { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP67_IDE), 19 }, 298 - { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP73_IDE), 20 }, 299 - { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP77_IDE), 21 }, 300 - { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_CS5536_IDE), 22 }, 301 { 0, }, 302 }; 303 MODULE_DEVICE_TABLE(pci, amd74xx_pci_tbl); ··· 323 .name = "AMD_IDE", 324 .id_table = amd74xx_pci_tbl, 325 .probe = amd74xx_probe, 326 }; 327 328 static int __init amd74xx_ide_init(void) ··· 331 return ide_pci_register_driver(&driver); 332 } 333 334 module_init(amd74xx_ide_init); 335 336 MODULE_AUTHOR("Vojtech Pavlik"); 337 MODULE_DESCRIPTION("AMD PCI IDE driver");
··· 21 #include <linux/init.h> 22 #include <linux/ide.h> 23 24 + #define DRV_NAME "amd74xx" 25 + 26 enum { 27 AMD_IDE_CONFIG = 0x41, 28 AMD_CABLE_DETECT = 0x42, ··· 110 amd_set_drive(drive, XFER_PIO_0 + pio); 111 } 112 113 + static void __devinit amd7409_cable_detect(struct pci_dev *dev) 114 { 115 /* no host side cable detection */ 116 amd_80w = 0x03; 117 } 118 119 + static void __devinit amd7411_cable_detect(struct pci_dev *dev) 120 { 121 int i; 122 u32 u = 0; ··· 129 amd_80w = ((t & 0x3) ? 1 : 0) | ((t & 0xc) ? 2 : 0); 130 for (i = 24; i >= 0; i -= 8) 131 if (((u >> i) & 4) && !(amd_80w & (1 << (1 - (i >> 4))))) { 132 + printk(KERN_WARNING DRV_NAME " %s: BIOS didn't set " 133 + "cable bits correctly. Enabling workaround.\n", 134 + pci_name(dev)); 135 amd_80w |= (1 << (1 - (i >> 4))); 136 } 137 } ··· 140 * The initialization callback. Initialize drive independent registers. 141 */ 142 143 + static unsigned int __devinit init_chipset_amd74xx(struct pci_dev *dev) 144 { 145 u8 t = 0, offset = amd_offset(dev); 146 ··· 154 ; /* no UDMA > 2 */ 155 else if (dev->vendor == PCI_VENDOR_ID_AMD && 156 dev->device == PCI_DEVICE_ID_AMD_VIPER_7409) 157 + amd7409_cable_detect(dev); 158 else 159 + amd7411_cable_detect(dev); 160 161 /* 162 * Take care of prefetch & postwrite. ··· 172 else 173 t |= 0xf0; 174 pci_write_config_byte(dev, AMD_IDE_CONFIG + offset, t); 175 176 return dev->irq; 177 } ··· 222 IDE_HFLAG_IO_32BIT | \ 223 IDE_HFLAG_UNMASK_IRQS) 224 225 + #define DECLARE_AMD_DEV(swdma, udma) \ 226 { \ 227 + .name = DRV_NAME, \ 228 .init_chipset = init_chipset_amd74xx, \ 229 .init_hwif = init_hwif_amd74xx, \ 230 .enablebits = {{0x40,0x02,0x02}, {0x40,0x01,0x01}}, \ ··· 236 .udma_mask = udma, \ 237 } 238 239 + #define DECLARE_NV_DEV(udma) \ 240 { \ 241 + .name = DRV_NAME, \ 242 .init_chipset = init_chipset_amd74xx, \ 243 .init_hwif = init_hwif_amd74xx, \ 244 .enablebits = {{0x50,0x02,0x02}, {0x50,0x01,0x01}}, \ ··· 251 } 252 253 static const struct ide_port_info amd74xx_chipsets[] __devinitdata = { 254 + /* 0: AMD7401 */ DECLARE_AMD_DEV(0x00, ATA_UDMA2), 255 + /* 1: AMD7409 */ DECLARE_AMD_DEV(ATA_SWDMA2, ATA_UDMA4), 256 + /* 2: AMD7411/7441 */ DECLARE_AMD_DEV(ATA_SWDMA2, ATA_UDMA5), 257 + /* 3: AMD8111 */ DECLARE_AMD_DEV(ATA_SWDMA2, ATA_UDMA6), 258 259 + /* 4: NFORCE */ DECLARE_NV_DEV(ATA_UDMA5), 260 + /* 5: >= NFORCE2 */ DECLARE_NV_DEV(ATA_UDMA6), 261 262 + /* 6: AMD5536 */ DECLARE_AMD_DEV(ATA_SWDMA2, ATA_UDMA5), 263 }; 264 265 static int __devinit amd74xx_probe(struct pci_dev *dev, const struct pci_device_id *id) ··· 292 if (dev->revision <= 7) 293 d.swdma_mask = 0; 294 d.host_flags |= IDE_HFLAG_CLEAR_SIMPLEX; 295 + } else if (idx == 3) { 296 if (dev->subsystem_vendor == PCI_VENDOR_ID_AMD && 297 dev->subsystem_device == PCI_DEVICE_ID_AMD_SERENADE) 298 d.udma_mask = ATA_UDMA5; 299 } 300 301 + printk(KERN_INFO "%s %s: UDMA%s controller\n", 302 + d.name, pci_name(dev), amd_dma[fls(d.udma_mask) - 1]); 303 304 + /* 305 + * Determine the system bus clock. 306 + */ 307 + amd_clock = (ide_pci_clk ? ide_pci_clk : 33) * 1000; 308 + 309 + switch (amd_clock) { 310 + case 33000: amd_clock = 33333; break; 311 + case 37000: amd_clock = 37500; break; 312 + case 41000: amd_clock = 41666; break; 313 + } 314 + 315 + if (amd_clock < 20000 || amd_clock > 50000) { 316 + printk(KERN_WARNING "%s: User given PCI clock speed impossible" 317 + " (%d), using 33 MHz instead.\n", 318 + d.name, amd_clock); 319 + amd_clock = 33333; 320 + } 321 + 322 + return ide_pci_init_one(dev, &d, NULL); 323 } 324 325 static const struct pci_device_id amd74xx_pci_tbl[] = { 326 { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_COBRA_7401), 0 }, 327 { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_VIPER_7409), 1 }, 328 { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_VIPER_7411), 2 }, 329 + { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_OPUS_7441), 2 }, 330 + { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_8111_IDE), 3 }, 331 + { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_IDE), 4 }, 332 + { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE2_IDE), 5 }, 333 + { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE2S_IDE), 5 }, 334 #ifdef CONFIG_BLK_DEV_IDE_SATA 335 + { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE2S_SATA), 5 }, 336 #endif 337 + { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE3_IDE), 5 }, 338 + { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE3S_IDE), 5 }, 339 #ifdef CONFIG_BLK_DEV_IDE_SATA 340 + { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE3S_SATA), 5 }, 341 + { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE3S_SATA2), 5 }, 342 #endif 343 + { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_CK804_IDE), 5 }, 344 + { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP04_IDE), 5 }, 345 + { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP51_IDE), 5 }, 346 + { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP55_IDE), 5 }, 347 + { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP61_IDE), 5 }, 348 + { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP65_IDE), 5 }, 349 + { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP67_IDE), 5 }, 350 + { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP73_IDE), 5 }, 351 + { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP77_IDE), 5 }, 352 + { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_CS5536_IDE), 6 }, 353 { 0, }, 354 }; 355 MODULE_DEVICE_TABLE(pci, amd74xx_pci_tbl); ··· 341 .name = "AMD_IDE", 342 .id_table = amd74xx_pci_tbl, 343 .probe = amd74xx_probe, 344 + .remove = ide_pci_remove, 345 }; 346 347 static int __init amd74xx_ide_init(void) ··· 348 return ide_pci_register_driver(&driver); 349 } 350 351 + static void __exit amd74xx_ide_exit(void) 352 + { 353 + pci_unregister_driver(&driver); 354 + } 355 + 356 module_init(amd74xx_ide_init); 357 + module_exit(amd74xx_ide_exit); 358 359 MODULE_AUTHOR("Vojtech Pavlik"); 360 MODULE_DESCRIPTION("AMD PCI IDE driver");
+15 -5
drivers/ide/pci/atiixp.c
··· 11 #include <linux/ide.h> 12 #include <linux/init.h> 13 14 #define ATIIXP_IDE_PIO_TIMING 0x40 15 #define ATIIXP_IDE_MDMA_TIMING 0x44 16 #define ATIIXP_IDE_PIO_CONTROL 0x48 ··· 139 }; 140 141 static const struct ide_port_info atiixp_pci_info[] __devinitdata = { 142 - { /* 0 */ 143 - .name = "ATIIXP", 144 .enablebits = {{0x48,0x01,0x00}, {0x48,0x08,0x00}}, 145 .port_ops = &atiixp_port_ops, 146 .host_flags = IDE_HFLAG_LEGACY_IRQS, 147 .pio_mask = ATA_PIO4, 148 .mwdma_mask = ATA_MWDMA2, 149 .udma_mask = ATA_UDMA5, 150 - },{ /* 1 */ 151 - .name = "SB600_PATA", 152 .enablebits = {{0x48,0x01,0x00}, {0x00,0x00,0x00}}, 153 .port_ops = &atiixp_port_ops, 154 .host_flags = IDE_HFLAG_SINGLE | IDE_HFLAG_LEGACY_IRQS, ··· 170 171 static int __devinit atiixp_init_one(struct pci_dev *dev, const struct pci_device_id *id) 172 { 173 - return ide_setup_pci_device(dev, &atiixp_pci_info[id->driver_data]); 174 } 175 176 static const struct pci_device_id atiixp_pci_tbl[] = { ··· 187 .name = "ATIIXP_IDE", 188 .id_table = atiixp_pci_tbl, 189 .probe = atiixp_init_one, 190 }; 191 192 static int __init atiixp_ide_init(void) ··· 195 return ide_pci_register_driver(&driver); 196 } 197 198 module_init(atiixp_ide_init); 199 200 MODULE_AUTHOR("HUI YU"); 201 MODULE_DESCRIPTION("PCI driver module for ATI IXP IDE");
··· 11 #include <linux/ide.h> 12 #include <linux/init.h> 13 14 + #define DRV_NAME "atiixp" 15 + 16 #define ATIIXP_IDE_PIO_TIMING 0x40 17 #define ATIIXP_IDE_MDMA_TIMING 0x44 18 #define ATIIXP_IDE_PIO_CONTROL 0x48 ··· 137 }; 138 139 static const struct ide_port_info atiixp_pci_info[] __devinitdata = { 140 + { /* 0: IXP200/300/400/700 */ 141 + .name = DRV_NAME, 142 .enablebits = {{0x48,0x01,0x00}, {0x48,0x08,0x00}}, 143 .port_ops = &atiixp_port_ops, 144 .host_flags = IDE_HFLAG_LEGACY_IRQS, 145 .pio_mask = ATA_PIO4, 146 .mwdma_mask = ATA_MWDMA2, 147 .udma_mask = ATA_UDMA5, 148 + }, 149 + { /* 1: IXP600 */ 150 + .name = DRV_NAME, 151 .enablebits = {{0x48,0x01,0x00}, {0x00,0x00,0x00}}, 152 .port_ops = &atiixp_port_ops, 153 .host_flags = IDE_HFLAG_SINGLE | IDE_HFLAG_LEGACY_IRQS, ··· 167 168 static int __devinit atiixp_init_one(struct pci_dev *dev, const struct pci_device_id *id) 169 { 170 + return ide_pci_init_one(dev, &atiixp_pci_info[id->driver_data], NULL); 171 } 172 173 static const struct pci_device_id atiixp_pci_tbl[] = { ··· 184 .name = "ATIIXP_IDE", 185 .id_table = atiixp_pci_tbl, 186 .probe = atiixp_init_one, 187 + .remove = ide_pci_remove, 188 }; 189 190 static int __init atiixp_ide_init(void) ··· 191 return ide_pci_register_driver(&driver); 192 } 193 194 + static void __exit atiixp_ide_exit(void) 195 + { 196 + pci_unregister_driver(&driver); 197 + } 198 + 199 module_init(atiixp_ide_init); 200 + module_exit(atiixp_ide_exit); 201 202 MODULE_AUTHOR("HUI YU"); 203 MODULE_DESCRIPTION("PCI driver module for ATI IXP IDE");
+22 -28
drivers/ide/pci/cmd64x.c
··· 19 20 #include <asm/io.h> 21 22 #define CMD_DEBUG 0 23 24 #if CMD_DEBUG ··· 332 return (dma_stat & 7) != 4; 333 } 334 335 - static unsigned int __devinit init_chipset_cmd64x(struct pci_dev *dev, const char *name) 336 { 337 u8 mrdmode = 0; 338 - 339 - if (dev->device == PCI_DEVICE_ID_CMD_646) { 340 - 341 - switch (dev->revision) { 342 - case 0x07: 343 - case 0x05: 344 - printk("%s: UltraDMA capable\n", name); 345 - break; 346 - case 0x03: 347 - default: 348 - printk("%s: MultiWord DMA force limited\n", name); 349 - break; 350 - case 0x01: 351 - printk("%s: MultiWord DMA limited, " 352 - "IRQ workaround enabled\n", name); 353 - break; 354 - } 355 - } 356 357 /* Set a good latency timer and cache line size value. */ 358 (void) pci_write_config_byte(dev, PCI_LATENCY_TIMER, 64); ··· 409 }; 410 411 static const struct ide_port_info cmd64x_chipsets[] __devinitdata = { 412 - { /* 0 */ 413 - .name = "CMD643", 414 .init_chipset = init_chipset_cmd64x, 415 .enablebits = {{0x00,0x00,0x00}, {0x51,0x08,0x08}}, 416 .port_ops = &cmd64x_port_ops, ··· 420 .pio_mask = ATA_PIO5, 421 .mwdma_mask = ATA_MWDMA2, 422 .udma_mask = 0x00, /* no udma */ 423 - },{ /* 1 */ 424 - .name = "CMD646", 425 .init_chipset = init_chipset_cmd64x, 426 .enablebits = {{0x51,0x04,0x04}, {0x51,0x08,0x08}}, 427 .chipset = ide_cmd646, ··· 432 .pio_mask = ATA_PIO5, 433 .mwdma_mask = ATA_MWDMA2, 434 .udma_mask = ATA_UDMA2, 435 - },{ /* 2 */ 436 - .name = "CMD648", 437 .init_chipset = init_chipset_cmd64x, 438 .enablebits = {{0x51,0x04,0x04}, {0x51,0x08,0x08}}, 439 .port_ops = &cmd64x_port_ops, ··· 443 .pio_mask = ATA_PIO5, 444 .mwdma_mask = ATA_MWDMA2, 445 .udma_mask = ATA_UDMA4, 446 - },{ /* 3 */ 447 - .name = "CMD649", 448 .init_chipset = init_chipset_cmd64x, 449 .enablebits = {{0x51,0x04,0x04}, {0x51,0x08,0x08}}, 450 .port_ops = &cmd64x_port_ops, ··· 494 } 495 } 496 497 - return ide_setup_pci_device(dev, &d); 498 } 499 500 static const struct pci_device_id cmd64x_pci_tbl[] = { ··· 510 .name = "CMD64x_IDE", 511 .id_table = cmd64x_pci_tbl, 512 .probe = cmd64x_init_one, 513 }; 514 515 static int __init cmd64x_ide_init(void) ··· 518 return ide_pci_register_driver(&driver); 519 } 520 521 module_init(cmd64x_ide_init); 522 523 MODULE_AUTHOR("Eddie Dost, David Miller, Andre Hedrick"); 524 MODULE_DESCRIPTION("PCI driver module for CMD64x IDE");
··· 19 20 #include <asm/io.h> 21 22 + #define DRV_NAME "cmd64x" 23 + 24 #define CMD_DEBUG 0 25 26 #if CMD_DEBUG ··· 330 return (dma_stat & 7) != 4; 331 } 332 333 + static unsigned int __devinit init_chipset_cmd64x(struct pci_dev *dev) 334 { 335 u8 mrdmode = 0; 336 337 /* Set a good latency timer and cache line size value. */ 338 (void) pci_write_config_byte(dev, PCI_LATENCY_TIMER, 64); ··· 425 }; 426 427 static const struct ide_port_info cmd64x_chipsets[] __devinitdata = { 428 + { /* 0: CMD643 */ 429 + .name = DRV_NAME, 430 .init_chipset = init_chipset_cmd64x, 431 .enablebits = {{0x00,0x00,0x00}, {0x51,0x08,0x08}}, 432 .port_ops = &cmd64x_port_ops, ··· 436 .pio_mask = ATA_PIO5, 437 .mwdma_mask = ATA_MWDMA2, 438 .udma_mask = 0x00, /* no udma */ 439 + }, 440 + { /* 1: CMD646 */ 441 + .name = DRV_NAME, 442 .init_chipset = init_chipset_cmd64x, 443 .enablebits = {{0x51,0x04,0x04}, {0x51,0x08,0x08}}, 444 .chipset = ide_cmd646, ··· 447 .pio_mask = ATA_PIO5, 448 .mwdma_mask = ATA_MWDMA2, 449 .udma_mask = ATA_UDMA2, 450 + }, 451 + { /* 2: CMD648 */ 452 + .name = DRV_NAME, 453 .init_chipset = init_chipset_cmd64x, 454 .enablebits = {{0x51,0x04,0x04}, {0x51,0x08,0x08}}, 455 .port_ops = &cmd64x_port_ops, ··· 457 .pio_mask = ATA_PIO5, 458 .mwdma_mask = ATA_MWDMA2, 459 .udma_mask = ATA_UDMA4, 460 + }, 461 + { /* 3: CMD649 */ 462 + .name = DRV_NAME, 463 .init_chipset = init_chipset_cmd64x, 464 .enablebits = {{0x51,0x04,0x04}, {0x51,0x08,0x08}}, 465 .port_ops = &cmd64x_port_ops, ··· 507 } 508 } 509 510 + return ide_pci_init_one(dev, &d, NULL); 511 } 512 513 static const struct pci_device_id cmd64x_pci_tbl[] = { ··· 523 .name = "CMD64x_IDE", 524 .id_table = cmd64x_pci_tbl, 525 .probe = cmd64x_init_one, 526 + .remove = ide_pci_remove, 527 }; 528 529 static int __init cmd64x_ide_init(void) ··· 530 return ide_pci_register_driver(&driver); 531 } 532 533 + static void __exit cmd64x_ide_exit(void) 534 + { 535 + pci_unregister_driver(&driver); 536 + } 537 + 538 module_init(cmd64x_ide_init); 539 + module_exit(cmd64x_ide_exit); 540 541 MODULE_AUTHOR("Eddie Dost, David Miller, Andre Hedrick"); 542 MODULE_DESCRIPTION("PCI driver module for CMD64x IDE");
+10 -14
drivers/ide/pci/cs5520.c
··· 41 #include <linux/ide.h> 42 #include <linux/dma-mapping.h> 43 44 struct pio_clocks 45 { 46 int address; ··· 94 .set_dma_mode = cs5520_set_dma_mode, 95 }; 96 97 - #define DECLARE_CS_DEV(name_str) \ 98 - { \ 99 - .name = name_str, \ 100 - .port_ops = &cs5520_port_ops, \ 101 - .host_flags = IDE_HFLAG_ISA_PORTS | \ 102 - IDE_HFLAG_CS5520, \ 103 - .pio_mask = ATA_PIO4, \ 104 - } 105 - 106 - static const struct ide_port_info cyrix_chipsets[] __devinitdata = { 107 - /* 0 */ DECLARE_CS_DEV("Cyrix 5510"), 108 - /* 1 */ DECLARE_CS_DEV("Cyrix 5520") 109 }; 110 111 /* ··· 109 110 static int __devinit cs5520_init_one(struct pci_dev *dev, const struct pci_device_id *id) 111 { 112 - const struct ide_port_info *d = &cyrix_chipsets[id->driver_data]; 113 hw_regs_t hw[4], *hws[] = { NULL, NULL, NULL, NULL }; 114 115 ide_setup_pci_noise(dev, d); ··· 123 } 124 pci_set_master(dev); 125 if (pci_set_dma_mask(dev, DMA_32BIT_MASK)) { 126 - printk(KERN_WARNING "cs5520: No suitable DMA available.\n"); 127 return -ENODEV; 128 } 129
··· 41 #include <linux/ide.h> 42 #include <linux/dma-mapping.h> 43 44 + #define DRV_NAME "cs5520" 45 + 46 struct pio_clocks 47 { 48 int address; ··· 92 .set_dma_mode = cs5520_set_dma_mode, 93 }; 94 95 + static const struct ide_port_info cyrix_chipset __devinitdata = { 96 + .name = DRV_NAME, 97 + .port_ops = &cs5520_port_ops, 98 + .host_flags = IDE_HFLAG_ISA_PORTS | IDE_HFLAG_CS5520, 99 + .pio_mask = ATA_PIO4, 100 }; 101 102 /* ··· 114 115 static int __devinit cs5520_init_one(struct pci_dev *dev, const struct pci_device_id *id) 116 { 117 + const struct ide_port_info *d = &cyrix_chipset; 118 hw_regs_t hw[4], *hws[] = { NULL, NULL, NULL, NULL }; 119 120 ide_setup_pci_noise(dev, d); ··· 128 } 129 pci_set_master(dev); 130 if (pci_set_dma_mask(dev, DMA_32BIT_MASK)) { 131 + printk(KERN_WARNING "%s: No suitable DMA available.\n", 132 + d->name); 133 return -ENODEV; 134 } 135
+14 -6
drivers/ide/pci/cs5530.c
··· 22 23 #include <asm/io.h> 24 25 /* 26 * Here are the standard PIO mode 0-4 timings for each "format". 27 * Format-0 uses fast data reg timings, with slower command reg timings. ··· 129 /** 130 * init_chipset_5530 - set up 5530 bridge 131 * @dev: PCI device 132 - * @name: device name 133 * 134 * Initialize the cs5530 bridge for reliable IDE DMA operation. 135 */ 136 137 - static unsigned int __devinit init_chipset_cs5530 (struct pci_dev *dev, const char *name) 138 { 139 struct pci_dev *master_0 = NULL, *cs5530_0 = NULL; 140 ··· 152 } 153 } 154 if (!master_0) { 155 - printk(KERN_ERR "%s: unable to locate PCI MASTER function\n", name); 156 goto out; 157 } 158 if (!cs5530_0) { 159 - printk(KERN_ERR "%s: unable to locate CS5530 LEGACY function\n", name); 160 goto out; 161 } 162 ··· 244 }; 245 246 static const struct ide_port_info cs5530_chipset __devinitdata = { 247 - .name = "CS5530", 248 .init_chipset = init_chipset_cs5530, 249 .init_hwif = init_hwif_cs5530, 250 .port_ops = &cs5530_port_ops, ··· 257 258 static int __devinit cs5530_init_one(struct pci_dev *dev, const struct pci_device_id *id) 259 { 260 - return ide_setup_pci_device(dev, &cs5530_chipset); 261 } 262 263 static const struct pci_device_id cs5530_pci_tbl[] = { ··· 270 .name = "CS5530 IDE", 271 .id_table = cs5530_pci_tbl, 272 .probe = cs5530_init_one, 273 }; 274 275 static int __init cs5530_ide_init(void) ··· 278 return ide_pci_register_driver(&driver); 279 } 280 281 module_init(cs5530_ide_init); 282 283 MODULE_AUTHOR("Mark Lord"); 284 MODULE_DESCRIPTION("PCI driver module for Cyrix/NS 5530 IDE");
··· 22 23 #include <asm/io.h> 24 25 + #define DRV_NAME "cs5530" 26 + 27 /* 28 * Here are the standard PIO mode 0-4 timings for each "format". 29 * Format-0 uses fast data reg timings, with slower command reg timings. ··· 127 /** 128 * init_chipset_5530 - set up 5530 bridge 129 * @dev: PCI device 130 * 131 * Initialize the cs5530 bridge for reliable IDE DMA operation. 132 */ 133 134 + static unsigned int __devinit init_chipset_cs5530(struct pci_dev *dev) 135 { 136 struct pci_dev *master_0 = NULL, *cs5530_0 = NULL; 137 ··· 151 } 152 } 153 if (!master_0) { 154 + printk(KERN_ERR DRV_NAME ": unable to locate PCI MASTER function\n"); 155 goto out; 156 } 157 if (!cs5530_0) { 158 + printk(KERN_ERR DRV_NAME ": unable to locate CS5530 LEGACY function\n"); 159 goto out; 160 } 161 ··· 243 }; 244 245 static const struct ide_port_info cs5530_chipset __devinitdata = { 246 + .name = DRV_NAME, 247 .init_chipset = init_chipset_cs5530, 248 .init_hwif = init_hwif_cs5530, 249 .port_ops = &cs5530_port_ops, ··· 256 257 static int __devinit cs5530_init_one(struct pci_dev *dev, const struct pci_device_id *id) 258 { 259 + return ide_pci_init_one(dev, &cs5530_chipset, NULL); 260 } 261 262 static const struct pci_device_id cs5530_pci_tbl[] = { ··· 269 .name = "CS5530 IDE", 270 .id_table = cs5530_pci_tbl, 271 .probe = cs5530_init_one, 272 + .remove = ide_pci_remove, 273 }; 274 275 static int __init cs5530_ide_init(void) ··· 276 return ide_pci_register_driver(&driver); 277 } 278 279 + static void __exit cs5530_ide_exit(void) 280 + { 281 + pci_unregister_driver(&driver); 282 + } 283 + 284 module_init(cs5530_ide_init); 285 + module_exit(cs5530_ide_exit); 286 287 MODULE_AUTHOR("Mark Lord"); 288 MODULE_DESCRIPTION("PCI driver module for Cyrix/NS 5530 IDE");
+11 -2
drivers/ide/pci/cs5535.c
··· 26 #include <linux/pci.h> 27 #include <linux/ide.h> 28 29 #define MSR_ATAC_BASE 0x51300000 30 #define ATAC_GLD_MSR_CAP (MSR_ATAC_BASE+0) 31 #define ATAC_GLD_MSR_CONFIG (MSR_ATAC_BASE+0x01) ··· 171 }; 172 173 static const struct ide_port_info cs5535_chipset __devinitdata = { 174 - .name = "CS5535", 175 .port_ops = &cs5535_port_ops, 176 .host_flags = IDE_HFLAG_SINGLE | IDE_HFLAG_POST_SET_MODE, 177 .pio_mask = ATA_PIO4, ··· 182 static int __devinit cs5535_init_one(struct pci_dev *dev, 183 const struct pci_device_id *id) 184 { 185 - return ide_setup_pci_device(dev, &cs5535_chipset); 186 } 187 188 static const struct pci_device_id cs5535_pci_tbl[] = { ··· 196 .name = "CS5535_IDE", 197 .id_table = cs5535_pci_tbl, 198 .probe = cs5535_init_one, 199 }; 200 201 static int __init cs5535_ide_init(void) ··· 204 return ide_pci_register_driver(&driver); 205 } 206 207 module_init(cs5535_ide_init); 208 209 MODULE_AUTHOR("AMD"); 210 MODULE_DESCRIPTION("PCI driver module for AMD/NS CS5535 IDE");
··· 26 #include <linux/pci.h> 27 #include <linux/ide.h> 28 29 + #define DRV_NAME "cs5535" 30 + 31 #define MSR_ATAC_BASE 0x51300000 32 #define ATAC_GLD_MSR_CAP (MSR_ATAC_BASE+0) 33 #define ATAC_GLD_MSR_CONFIG (MSR_ATAC_BASE+0x01) ··· 169 }; 170 171 static const struct ide_port_info cs5535_chipset __devinitdata = { 172 + .name = DRV_NAME, 173 .port_ops = &cs5535_port_ops, 174 .host_flags = IDE_HFLAG_SINGLE | IDE_HFLAG_POST_SET_MODE, 175 .pio_mask = ATA_PIO4, ··· 180 static int __devinit cs5535_init_one(struct pci_dev *dev, 181 const struct pci_device_id *id) 182 { 183 + return ide_pci_init_one(dev, &cs5535_chipset, NULL); 184 } 185 186 static const struct pci_device_id cs5535_pci_tbl[] = { ··· 194 .name = "CS5535_IDE", 195 .id_table = cs5535_pci_tbl, 196 .probe = cs5535_init_one, 197 + .remove = ide_pci_remove, 198 }; 199 200 static int __init cs5535_ide_init(void) ··· 201 return ide_pci_register_driver(&driver); 202 } 203 204 + static void __exit cs5535_ide_exit(void) 205 + { 206 + pci_unregister_driver(&driver); 207 + } 208 + 209 module_init(cs5535_ide_init); 210 + module_exit(cs5535_ide_exit); 211 212 MODULE_AUTHOR("AMD"); 213 MODULE_DESCRIPTION("PCI driver module for AMD/NS CS5535 IDE");
+27 -8
drivers/ide/pci/cy82c693.c
··· 48 49 #include <asm/io.h> 50 51 /* the current version */ 52 #define CY82_VERSION "CY82C693U driver v0.34 99-13-12 Andreas S. Krebs (akrebs@altavista.net)" 53 ··· 332 /* 333 * this function is called during init and is used to setup the cy82c693 chip 334 */ 335 - static unsigned int __devinit init_chipset_cy82c693(struct pci_dev *dev, const char *name) 336 { 337 if (PCI_FUNC(dev->devfn) != 1) 338 return 0; ··· 351 data = inb(CY82_DATA_PORT); 352 353 #if CY82C693_DEBUG_INFO 354 - printk(KERN_INFO "%s: Peripheral Configuration Register: 0x%X\n", 355 - name, data); 356 #endif /* CY82C693_DEBUG_INFO */ 357 358 /* ··· 373 outb(data, CY82_DATA_PORT); 374 375 #if CY82C693_DEBUG_INFO 376 - printk(KERN_INFO "%s: New Peripheral Configuration Register: 0x%X\n", 377 - name, data); 378 #endif /* CY82C693_DEBUG_INFO */ 379 380 #endif /* CY82C693_SETDMA_CLOCK */ ··· 400 }; 401 402 static const struct ide_port_info cy82c693_chipset __devinitdata = { 403 - .name = "CY82C693", 404 .init_chipset = init_chipset_cy82c693, 405 .init_iops = init_iops_cy82c693, 406 .port_ops = &cy82c693_port_ops, ··· 421 if ((dev->class >> 8) == PCI_CLASS_STORAGE_IDE && 422 PCI_FUNC(dev->devfn) == 1) { 423 dev2 = pci_get_slot(dev->bus, dev->devfn + 1); 424 - ret = ide_setup_pci_devices(dev, dev2, &cy82c693_chipset); 425 - /* We leak pci refs here but thats ok - we can't be unloaded */ 426 } 427 return ret; 428 } 429 430 static const struct pci_device_id cy82c693_pci_tbl[] = { ··· 447 .name = "Cypress_IDE", 448 .id_table = cy82c693_pci_tbl, 449 .probe = cy82c693_init_one, 450 }; 451 452 static int __init cy82c693_ide_init(void) ··· 455 return ide_pci_register_driver(&driver); 456 } 457 458 module_init(cy82c693_ide_init); 459 460 MODULE_AUTHOR("Andreas Krebs, Andre Hedrick"); 461 MODULE_DESCRIPTION("PCI driver module for the Cypress CY82C693 IDE");
··· 48 49 #include <asm/io.h> 50 51 + #define DRV_NAME "cy82c693" 52 + 53 /* the current version */ 54 #define CY82_VERSION "CY82C693U driver v0.34 99-13-12 Andreas S. Krebs (akrebs@altavista.net)" 55 ··· 330 /* 331 * this function is called during init and is used to setup the cy82c693 chip 332 */ 333 + static unsigned int __devinit init_chipset_cy82c693(struct pci_dev *dev) 334 { 335 if (PCI_FUNC(dev->devfn) != 1) 336 return 0; ··· 349 data = inb(CY82_DATA_PORT); 350 351 #if CY82C693_DEBUG_INFO 352 + printk(KERN_INFO DRV_NAME ": Peripheral Configuration Register: 0x%X\n", 353 + data); 354 #endif /* CY82C693_DEBUG_INFO */ 355 356 /* ··· 371 outb(data, CY82_DATA_PORT); 372 373 #if CY82C693_DEBUG_INFO 374 + printk(KERN_INFO ": New Peripheral Configuration Register: 0x%X\n", 375 + data); 376 #endif /* CY82C693_DEBUG_INFO */ 377 378 #endif /* CY82C693_SETDMA_CLOCK */ ··· 398 }; 399 400 static const struct ide_port_info cy82c693_chipset __devinitdata = { 401 + .name = DRV_NAME, 402 .init_chipset = init_chipset_cy82c693, 403 .init_iops = init_iops_cy82c693, 404 .port_ops = &cy82c693_port_ops, ··· 419 if ((dev->class >> 8) == PCI_CLASS_STORAGE_IDE && 420 PCI_FUNC(dev->devfn) == 1) { 421 dev2 = pci_get_slot(dev->bus, dev->devfn + 1); 422 + ret = ide_pci_init_two(dev, dev2, &cy82c693_chipset, NULL); 423 + if (ret) 424 + pci_dev_put(dev2); 425 } 426 return ret; 427 + } 428 + 429 + static void __devexit cy82c693_remove(struct pci_dev *dev) 430 + { 431 + struct ide_host *host = pci_get_drvdata(dev); 432 + struct pci_dev *dev2 = host->dev[1] ? to_pci_dev(host->dev[1]) : NULL; 433 + 434 + ide_pci_remove(dev); 435 + pci_dev_put(dev2); 436 } 437 438 static const struct pci_device_id cy82c693_pci_tbl[] = { ··· 435 .name = "Cypress_IDE", 436 .id_table = cy82c693_pci_tbl, 437 .probe = cy82c693_init_one, 438 + .remove = cy82c693_remove, 439 }; 440 441 static int __init cy82c693_ide_init(void) ··· 442 return ide_pci_register_driver(&driver); 443 } 444 445 + static void __exit cy82c693_ide_exit(void) 446 + { 447 + pci_unregister_driver(&driver); 448 + } 449 + 450 module_init(cy82c693_ide_init); 451 + module_exit(cy82c693_ide_exit); 452 453 MODULE_AUTHOR("Andreas Krebs, Andre Hedrick"); 454 MODULE_DESCRIPTION("PCI driver module for the Cypress CY82C693 IDE");
+40 -36
drivers/ide/pci/generic.c
··· 27 #include <linux/ide.h> 28 #include <linux/init.h> 29 30 static int ide_generic_all; /* Set to claim all devices */ 31 32 module_param_named(all_generic_ide, ide_generic_all, bool, 0444); ··· 36 37 #define IDE_HFLAGS_UMC (IDE_HFLAG_NO_DMA | IDE_HFLAG_FORCE_LEGACY_IRQS) 38 39 - #define DECLARE_GENERIC_PCI_DEV(name_str, extra_flags) \ 40 { \ 41 - .name = name_str, \ 42 .host_flags = IDE_HFLAG_TRUST_BIOS_FOR_DMA | \ 43 extra_flags, \ 44 .swdma_mask = ATA_SWDMA2, \ ··· 47 } 48 49 static const struct ide_port_info generic_chipsets[] __devinitdata = { 50 - /* 0 */ DECLARE_GENERIC_PCI_DEV("Unknown", 0), 51 52 - { /* 1 */ 53 - .name = "NS87410", 54 .enablebits = { {0x43, 0x08, 0x08}, {0x47, 0x08, 0x08} }, 55 .host_flags = IDE_HFLAG_TRUST_BIOS_FOR_DMA, 56 .swdma_mask = ATA_SWDMA2, ··· 59 .udma_mask = ATA_UDMA6, 60 }, 61 62 - /* 2 */ DECLARE_GENERIC_PCI_DEV("SAMURAI", 0), 63 - /* 3 */ DECLARE_GENERIC_PCI_DEV("HT6565", 0), 64 - /* 4 */ DECLARE_GENERIC_PCI_DEV("UM8673F", IDE_HFLAGS_UMC), 65 - /* 5 */ DECLARE_GENERIC_PCI_DEV("UM8886A", IDE_HFLAGS_UMC), 66 - /* 6 */ DECLARE_GENERIC_PCI_DEV("UM8886BF", IDE_HFLAGS_UMC), 67 - /* 7 */ DECLARE_GENERIC_PCI_DEV("HINT_IDE", 0), 68 - /* 8 */ DECLARE_GENERIC_PCI_DEV("VIA_IDE", IDE_HFLAG_NO_AUTODMA), 69 - /* 9 */ DECLARE_GENERIC_PCI_DEV("OPTI621V", IDE_HFLAG_NO_AUTODMA), 70 71 - { /* 10 */ 72 - .name = "VIA8237SATA", 73 .host_flags = IDE_HFLAG_TRUST_BIOS_FOR_DMA | 74 IDE_HFLAG_OFF_BOARD, 75 .swdma_mask = ATA_SWDMA2, ··· 75 .udma_mask = ATA_UDMA6, 76 }, 77 78 - /* 11 */ DECLARE_GENERIC_PCI_DEV("Piccolo0102", IDE_HFLAG_NO_AUTODMA), 79 - /* 12 */ DECLARE_GENERIC_PCI_DEV("Piccolo0103", IDE_HFLAG_NO_AUTODMA), 80 - /* 13 */ DECLARE_GENERIC_PCI_DEV("Piccolo0105", IDE_HFLAG_NO_AUTODMA), 81 - 82 - { /* 14 */ 83 - .name = "Revolution", 84 .host_flags = IDE_HFLAG_CLEAR_SIMPLEX | 85 IDE_HFLAG_TRUST_BIOS_FOR_DMA | 86 IDE_HFLAG_OFF_BOARD, ··· 131 u16 command; 132 pci_read_config_word(dev, PCI_COMMAND, &command); 133 if (!(command & PCI_COMMAND_IO)) { 134 - printk(KERN_INFO "Skipping disabled %s IDE " 135 - "controller.\n", d->name); 136 goto out; 137 } 138 } 139 - ret = ide_setup_pci_device(dev, d); 140 out: 141 return ret; 142 } ··· 144 static const struct pci_device_id generic_pci_tbl[] = { 145 { PCI_VDEVICE(NS, PCI_DEVICE_ID_NS_87410), 1 }, 146 { PCI_VDEVICE(PCTECH, PCI_DEVICE_ID_PCTECH_SAMURAI_IDE), 2 }, 147 - { PCI_VDEVICE(HOLTEK, PCI_DEVICE_ID_HOLTEK_6565), 3 }, 148 - { PCI_VDEVICE(UMC, PCI_DEVICE_ID_UMC_UM8673F), 4 }, 149 - { PCI_VDEVICE(UMC, PCI_DEVICE_ID_UMC_UM8886A), 5 }, 150 - { PCI_VDEVICE(UMC, PCI_DEVICE_ID_UMC_UM8886BF), 6 }, 151 - { PCI_VDEVICE(HINT, PCI_DEVICE_ID_HINT_VXPROII_IDE), 7 }, 152 - { PCI_VDEVICE(VIA, PCI_DEVICE_ID_VIA_82C561), 8 }, 153 - { PCI_VDEVICE(OPTI, PCI_DEVICE_ID_OPTI_82C558), 9 }, 154 #ifdef CONFIG_BLK_DEV_IDE_SATA 155 - { PCI_VDEVICE(VIA, PCI_DEVICE_ID_VIA_8237_SATA), 10 }, 156 #endif 157 - { PCI_VDEVICE(TOSHIBA, PCI_DEVICE_ID_TOSHIBA_PICCOLO), 11 }, 158 - { PCI_VDEVICE(TOSHIBA, PCI_DEVICE_ID_TOSHIBA_PICCOLO_1), 12 }, 159 - { PCI_VDEVICE(TOSHIBA, PCI_DEVICE_ID_TOSHIBA_PICCOLO_2), 13 }, 160 - { PCI_VDEVICE(NETCELL, PCI_DEVICE_ID_REVOLUTION), 14 }, 161 /* 162 * Must come last. If you add entries adjust 163 * this table and generic_chipsets[] appropriately. ··· 171 .name = "PCI_IDE", 172 .id_table = generic_pci_tbl, 173 .probe = generic_init_one, 174 }; 175 176 static int __init generic_ide_init(void) ··· 179 return ide_pci_register_driver(&driver); 180 } 181 182 module_init(generic_ide_init); 183 184 MODULE_AUTHOR("Andre Hedrick"); 185 MODULE_DESCRIPTION("PCI driver module for generic PCI IDE");
··· 27 #include <linux/ide.h> 28 #include <linux/init.h> 29 30 + #define DRV_NAME "ide_pci_generic" 31 + 32 static int ide_generic_all; /* Set to claim all devices */ 33 34 module_param_named(all_generic_ide, ide_generic_all, bool, 0444); ··· 34 35 #define IDE_HFLAGS_UMC (IDE_HFLAG_NO_DMA | IDE_HFLAG_FORCE_LEGACY_IRQS) 36 37 + #define DECLARE_GENERIC_PCI_DEV(extra_flags) \ 38 { \ 39 + .name = DRV_NAME, \ 40 .host_flags = IDE_HFLAG_TRUST_BIOS_FOR_DMA | \ 41 extra_flags, \ 42 .swdma_mask = ATA_SWDMA2, \ ··· 45 } 46 47 static const struct ide_port_info generic_chipsets[] __devinitdata = { 48 + /* 0: Unknown */ 49 + DECLARE_GENERIC_PCI_DEV(0), 50 51 + { /* 1: NS87410 */ 52 + .name = DRV_NAME, 53 .enablebits = { {0x43, 0x08, 0x08}, {0x47, 0x08, 0x08} }, 54 .host_flags = IDE_HFLAG_TRUST_BIOS_FOR_DMA, 55 .swdma_mask = ATA_SWDMA2, ··· 56 .udma_mask = ATA_UDMA6, 57 }, 58 59 + /* 2: SAMURAI / HT6565 / HINT_IDE */ 60 + DECLARE_GENERIC_PCI_DEV(0), 61 + /* 3: UM8673F / UM8886A / UM8886BF */ 62 + DECLARE_GENERIC_PCI_DEV(IDE_HFLAGS_UMC), 63 + /* 4: VIA_IDE / OPTI621V / Piccolo010{2,3,5} */ 64 + DECLARE_GENERIC_PCI_DEV(IDE_HFLAG_NO_AUTODMA), 65 66 + { /* 5: VIA8237SATA */ 67 + .name = DRV_NAME, 68 .host_flags = IDE_HFLAG_TRUST_BIOS_FOR_DMA | 69 IDE_HFLAG_OFF_BOARD, 70 .swdma_mask = ATA_SWDMA2, ··· 74 .udma_mask = ATA_UDMA6, 75 }, 76 77 + { /* 6: Revolution */ 78 + .name = DRV_NAME, 79 .host_flags = IDE_HFLAG_CLEAR_SIMPLEX | 80 IDE_HFLAG_TRUST_BIOS_FOR_DMA | 81 IDE_HFLAG_OFF_BOARD, ··· 134 u16 command; 135 pci_read_config_word(dev, PCI_COMMAND, &command); 136 if (!(command & PCI_COMMAND_IO)) { 137 + printk(KERN_INFO "%s %s: skipping disabled " 138 + "controller\n", d->name, pci_name(dev)); 139 goto out; 140 } 141 } 142 + ret = ide_pci_init_one(dev, d, NULL); 143 out: 144 return ret; 145 } ··· 147 static const struct pci_device_id generic_pci_tbl[] = { 148 { PCI_VDEVICE(NS, PCI_DEVICE_ID_NS_87410), 1 }, 149 { PCI_VDEVICE(PCTECH, PCI_DEVICE_ID_PCTECH_SAMURAI_IDE), 2 }, 150 + { PCI_VDEVICE(HOLTEK, PCI_DEVICE_ID_HOLTEK_6565), 2 }, 151 + { PCI_VDEVICE(UMC, PCI_DEVICE_ID_UMC_UM8673F), 3 }, 152 + { PCI_VDEVICE(UMC, PCI_DEVICE_ID_UMC_UM8886A), 3 }, 153 + { PCI_VDEVICE(UMC, PCI_DEVICE_ID_UMC_UM8886BF), 3 }, 154 + { PCI_VDEVICE(HINT, PCI_DEVICE_ID_HINT_VXPROII_IDE), 2 }, 155 + { PCI_VDEVICE(VIA, PCI_DEVICE_ID_VIA_82C561), 4 }, 156 + { PCI_VDEVICE(OPTI, PCI_DEVICE_ID_OPTI_82C558), 4 }, 157 #ifdef CONFIG_BLK_DEV_IDE_SATA 158 + { PCI_VDEVICE(VIA, PCI_DEVICE_ID_VIA_8237_SATA), 5 }, 159 #endif 160 + { PCI_VDEVICE(TOSHIBA, PCI_DEVICE_ID_TOSHIBA_PICCOLO), 4 }, 161 + { PCI_VDEVICE(TOSHIBA, PCI_DEVICE_ID_TOSHIBA_PICCOLO_1), 4 }, 162 + { PCI_VDEVICE(TOSHIBA, PCI_DEVICE_ID_TOSHIBA_PICCOLO_2), 4 }, 163 + { PCI_VDEVICE(NETCELL, PCI_DEVICE_ID_REVOLUTION), 6 }, 164 /* 165 * Must come last. If you add entries adjust 166 * this table and generic_chipsets[] appropriately. ··· 174 .name = "PCI_IDE", 175 .id_table = generic_pci_tbl, 176 .probe = generic_init_one, 177 + .remove = ide_pci_remove, 178 }; 179 180 static int __init generic_ide_init(void) ··· 181 return ide_pci_register_driver(&driver); 182 } 183 184 + static void __exit generic_ide_exit(void) 185 + { 186 + pci_unregister_driver(&driver); 187 + } 188 + 189 module_init(generic_ide_init); 190 + module_exit(generic_ide_exit); 191 192 MODULE_AUTHOR("Andre Hedrick"); 193 MODULE_DESCRIPTION("PCI driver module for generic PCI IDE");
+15 -6
drivers/ide/pci/hpt34x.c
··· 33 #include <linux/init.h> 34 #include <linux/ide.h> 35 36 #define HPT343_DEBUG_DRIVE_INFO 0 37 38 static void hpt34x_set_mode(ide_drive_t *drive, const u8 speed) ··· 79 */ 80 #define HPT34X_PCI_INIT_REG 0x80 81 82 - static unsigned int __devinit init_chipset_hpt34x(struct pci_dev *dev, const char *name) 83 { 84 int i = 0; 85 unsigned long hpt34xIoBase = pci_resource_start(dev, 4); ··· 128 IDE_HFLAG_NO_AUTODMA) 129 130 static const struct ide_port_info hpt34x_chipsets[] __devinitdata = { 131 - { /* 0 */ 132 - .name = "HPT343", 133 .init_chipset = init_chipset_hpt34x, 134 .port_ops = &hpt34x_port_ops, 135 .host_flags = IDE_HFLAGS_HPT34X | IDE_HFLAG_NON_BOOTABLE, 136 .pio_mask = ATA_PIO5, 137 }, 138 - { /* 1 */ 139 - .name = "HPT345", 140 .init_chipset = init_chipset_hpt34x, 141 .port_ops = &hpt34x_port_ops, 142 .host_flags = IDE_HFLAGS_HPT34X | IDE_HFLAG_OFF_BOARD, ··· 158 159 d = &hpt34x_chipsets[(pcicmd & PCI_COMMAND_MEMORY) ? 1 : 0]; 160 161 - return ide_setup_pci_device(dev, d); 162 } 163 164 static const struct pci_device_id hpt34x_pci_tbl[] = { ··· 171 .name = "HPT34x_IDE", 172 .id_table = hpt34x_pci_tbl, 173 .probe = hpt34x_init_one, 174 }; 175 176 static int __init hpt34x_ide_init(void) ··· 179 return ide_pci_register_driver(&driver); 180 } 181 182 module_init(hpt34x_ide_init); 183 184 MODULE_AUTHOR("Andre Hedrick"); 185 MODULE_DESCRIPTION("PCI driver module for Highpoint 34x IDE");
··· 33 #include <linux/init.h> 34 #include <linux/ide.h> 35 36 + #define DRV_NAME "hpt34x" 37 + 38 #define HPT343_DEBUG_DRIVE_INFO 0 39 40 static void hpt34x_set_mode(ide_drive_t *drive, const u8 speed) ··· 77 */ 78 #define HPT34X_PCI_INIT_REG 0x80 79 80 + static unsigned int __devinit init_chipset_hpt34x(struct pci_dev *dev) 81 { 82 int i = 0; 83 unsigned long hpt34xIoBase = pci_resource_start(dev, 4); ··· 126 IDE_HFLAG_NO_AUTODMA) 127 128 static const struct ide_port_info hpt34x_chipsets[] __devinitdata = { 129 + { /* 0: HPT343 */ 130 + .name = DRV_NAME, 131 .init_chipset = init_chipset_hpt34x, 132 .port_ops = &hpt34x_port_ops, 133 .host_flags = IDE_HFLAGS_HPT34X | IDE_HFLAG_NON_BOOTABLE, 134 .pio_mask = ATA_PIO5, 135 }, 136 + { /* 1: HPT345 */ 137 + .name = DRV_NAME, 138 .init_chipset = init_chipset_hpt34x, 139 .port_ops = &hpt34x_port_ops, 140 .host_flags = IDE_HFLAGS_HPT34X | IDE_HFLAG_OFF_BOARD, ··· 156 157 d = &hpt34x_chipsets[(pcicmd & PCI_COMMAND_MEMORY) ? 1 : 0]; 158 159 + return ide_pci_init_one(dev, d, NULL); 160 } 161 162 static const struct pci_device_id hpt34x_pci_tbl[] = { ··· 169 .name = "HPT34x_IDE", 170 .id_table = hpt34x_pci_tbl, 171 .probe = hpt34x_init_one, 172 + .remove = ide_pci_remove, 173 }; 174 175 static int __init hpt34x_ide_init(void) ··· 176 return ide_pci_register_driver(&driver); 177 } 178 179 + static void __exit hpt34x_ide_exit(void) 180 + { 181 + pci_unregister_driver(&driver); 182 + } 183 + 184 module_init(hpt34x_ide_init); 185 + module_exit(hpt34x_ide_exit); 186 187 MODULE_AUTHOR("Andre Hedrick"); 188 MODULE_DESCRIPTION("PCI driver module for Highpoint 34x IDE");
+89 -94
drivers/ide/pci/hpt366.c
··· 131 #include <asm/uaccess.h> 132 #include <asm/io.h> 133 134 /* various tuning parameters */ 135 #define HPT_RESET_STATE_ENGINE 136 #undef HPT_DELAY_INTERRUPT ··· 622 { 623 ide_hwif_t *hwif = HWIF(drive); 624 struct pci_dev *dev = to_pci_dev(hwif->dev); 625 - struct hpt_info *info = pci_get_drvdata(dev); 626 u8 mask = hwif->ultra_mask; 627 628 switch (info->chip_type) { ··· 663 { 664 ide_hwif_t *hwif = HWIF(drive); 665 struct pci_dev *dev = to_pci_dev(hwif->dev); 666 - struct hpt_info *info = pci_get_drvdata(dev); 667 668 switch (info->chip_type) { 669 case HPT372 : ··· 698 699 static void hpt3xx_set_mode(ide_drive_t *drive, const u8 speed) 700 { 701 - struct pci_dev *dev = to_pci_dev(drive->hwif->dev); 702 - struct hpt_info *info = pci_get_drvdata(dev); 703 struct hpt_timings *t = info->timings; 704 u8 itr_addr = 0x40 + (drive->dn * 4); 705 u32 old_itr = 0; ··· 744 { 745 ide_hwif_t *hwif = HWIF(drive); 746 struct pci_dev *dev = to_pci_dev(hwif->dev); 747 - struct hpt_info *info = pci_get_drvdata(dev); 748 749 if (drive->quirk_list) { 750 if (info->chip_type >= HPT370) { ··· 970 return 1; 971 } 972 973 - static unsigned int __devinit init_chipset_hpt366(struct pci_dev *dev, const char *name) 974 { 975 - struct hpt_info *info = kmalloc(sizeof(struct hpt_info), GFP_KERNEL); 976 unsigned long io_base = pci_resource_start(dev, 4); 977 u8 pci_clk, dpll_clk = 0; /* PCI and DPLL clock in MHz */ 978 u8 chip_type; 979 enum ata_clock clock; 980 981 - if (info == NULL) { 982 - printk(KERN_ERR "%s: out of memory!\n", name); 983 - return -ENOMEM; 984 - } 985 - 986 - /* 987 - * Copy everything from a static "template" structure 988 - * to just allocated per-chip hpt_info structure. 989 - */ 990 - memcpy(info, pci_get_drvdata(dev), sizeof(struct hpt_info)); 991 chip_type = info->chip_type; 992 993 pci_write_config_byte(dev, PCI_CACHE_LINE_SIZE, (L1_CACHE_BYTES / 4)); ··· 1047 if ((temp & 0xFFFFF000) != 0xABCDE000) { 1048 int i; 1049 1050 - printk(KERN_WARNING "%s: no clock data saved by BIOS\n", 1051 - name); 1052 1053 /* Calculate the average value of f_CNT. */ 1054 for (temp = i = 0; i < 128; i++) { ··· 1073 else 1074 pci_clk = 66; 1075 1076 - printk(KERN_INFO "%s: DPLL base: %d MHz, f_CNT: %d, " 1077 - "assuming %d MHz PCI\n", name, dpll_clk, f_cnt, pci_clk); 1078 } else { 1079 u32 itr1 = 0; 1080 ··· 1141 } 1142 1143 if (info->timings->clock_table[clock] == NULL) { 1144 - printk(KERN_ERR "%s: unknown bus timing!\n", name); 1145 - kfree(info); 1146 return -EIO; 1147 } 1148 ··· 1168 f_low += adjust >> 1; 1169 } 1170 if (adjust == 8) { 1171 - printk(KERN_ERR "%s: DPLL did not stabilize!\n", name); 1172 - kfree(info); 1173 return -EIO; 1174 } 1175 1176 - printk("%s: using %d MHz DPLL clock\n", name, dpll_clk); 1177 } else { 1178 /* Mark the fact that we're not using the DPLL. */ 1179 dpll_clk = 0; 1180 1181 - printk("%s: using %d MHz PCI clock\n", name, pci_clk); 1182 } 1183 1184 /* Store the clock frequencies. */ 1185 info->dpll_clk = dpll_clk; 1186 info->pci_clk = pci_clk; 1187 info->clock = clock; 1188 - 1189 - /* Point to this chip's own instance of the hpt_info structure. */ 1190 - pci_set_drvdata(dev, info); 1191 1192 if (chip_type >= HPT370) { 1193 u8 mcr1, mcr4; ··· 1217 static u8 __devinit hpt3xx_cable_detect(ide_hwif_t *hwif) 1218 { 1219 struct pci_dev *dev = to_pci_dev(hwif->dev); 1220 - struct hpt_info *info = pci_get_drvdata(dev); 1221 u8 chip_type = info->chip_type; 1222 u8 scr1 = 0, ata66 = hwif->channel ? 0x01 : 0x02; 1223 ··· 1262 static void __devinit init_hwif_hpt366(ide_hwif_t *hwif) 1263 { 1264 struct pci_dev *dev = to_pci_dev(hwif->dev); 1265 - struct hpt_info *info = pci_get_drvdata(dev); 1266 int serialize = HPT_SERIALIZE_IO; 1267 u8 chip_type = info->chip_type; 1268 u8 new_mcr, old_mcr = 0; ··· 1365 if (dev2->irq != dev->irq) { 1366 /* FIXME: we need a core pci_set_interrupt() */ 1367 dev2->irq = dev->irq; 1368 - printk(KERN_INFO "HPT374: PCI config space interrupt fixed\n"); 1369 } 1370 } 1371 ··· 1401 pci_read_config_byte(dev2, PCI_INTERRUPT_PIN, &pin2); 1402 1403 if (pin1 != pin2 && dev->irq == dev2->irq) { 1404 - printk(KERN_INFO "HPT36x: onboard version of chipset, " 1405 - "pin1=%d pin2=%d\n", pin1, pin2); 1406 return 1; 1407 } 1408 ··· 1457 }; 1458 1459 static const struct ide_port_info hpt366_chipsets[] __devinitdata = { 1460 - { /* 0 */ 1461 - .name = "HPT36x", 1462 .init_chipset = init_chipset_hpt366, 1463 .init_hwif = init_hwif_hpt366, 1464 .init_dma = init_dma_hpt366, ··· 1474 .host_flags = IDE_HFLAGS_HPT3XX | IDE_HFLAG_SINGLE, 1475 .pio_mask = ATA_PIO4, 1476 .mwdma_mask = ATA_MWDMA2, 1477 - },{ /* 1 */ 1478 - .name = "HPT372A", 1479 - .init_chipset = init_chipset_hpt366, 1480 - .init_hwif = init_hwif_hpt366, 1481 - .init_dma = init_dma_hpt366, 1482 - .enablebits = {{0x50,0x04,0x04}, {0x54,0x04,0x04}}, 1483 - .port_ops = &hpt3xx_port_ops, 1484 - .dma_ops = &hpt37x_dma_ops, 1485 - .host_flags = IDE_HFLAGS_HPT3XX, 1486 - .pio_mask = ATA_PIO4, 1487 - .mwdma_mask = ATA_MWDMA2, 1488 - },{ /* 2 */ 1489 - .name = "HPT302", 1490 - .init_chipset = init_chipset_hpt366, 1491 - .init_hwif = init_hwif_hpt366, 1492 - .init_dma = init_dma_hpt366, 1493 - .enablebits = {{0x50,0x04,0x04}, {0x54,0x04,0x04}}, 1494 - .port_ops = &hpt3xx_port_ops, 1495 - .dma_ops = &hpt37x_dma_ops, 1496 - .host_flags = IDE_HFLAGS_HPT3XX, 1497 - .pio_mask = ATA_PIO4, 1498 - .mwdma_mask = ATA_MWDMA2, 1499 - },{ /* 3 */ 1500 - .name = "HPT371", 1501 - .init_chipset = init_chipset_hpt366, 1502 - .init_hwif = init_hwif_hpt366, 1503 - .init_dma = init_dma_hpt366, 1504 - .enablebits = {{0x50,0x04,0x04}, {0x54,0x04,0x04}}, 1505 - .port_ops = &hpt3xx_port_ops, 1506 - .dma_ops = &hpt37x_dma_ops, 1507 - .host_flags = IDE_HFLAGS_HPT3XX, 1508 - .pio_mask = ATA_PIO4, 1509 - .mwdma_mask = ATA_MWDMA2, 1510 - },{ /* 4 */ 1511 - .name = "HPT374", 1512 - .init_chipset = init_chipset_hpt366, 1513 - .init_hwif = init_hwif_hpt366, 1514 - .init_dma = init_dma_hpt366, 1515 - .enablebits = {{0x50,0x04,0x04}, {0x54,0x04,0x04}}, 1516 - .udma_mask = ATA_UDMA5, 1517 - .port_ops = &hpt3xx_port_ops, 1518 - .dma_ops = &hpt37x_dma_ops, 1519 - .host_flags = IDE_HFLAGS_HPT3XX, 1520 - .pio_mask = ATA_PIO4, 1521 - .mwdma_mask = ATA_MWDMA2, 1522 - },{ /* 5 */ 1523 - .name = "HPT372N", 1524 .init_chipset = init_chipset_hpt366, 1525 .init_hwif = init_hwif_hpt366, 1526 .init_dma = init_dma_hpt366, ··· 1500 static int __devinit hpt366_init_one(struct pci_dev *dev, const struct pci_device_id *id) 1501 { 1502 const struct hpt_info *info = NULL; 1503 struct pci_dev *dev2 = NULL; 1504 struct ide_port_info d; 1505 u8 idx = id->driver_data; 1506 u8 rev = dev->revision; 1507 1508 if ((idx == 0 || idx == 4) && (PCI_FUNC(dev->devfn) & 1)) 1509 return -ENODEV; ··· 1542 break; 1543 } 1544 1545 - d = hpt366_chipsets[idx]; 1546 1547 - d.name = info->chip_name; 1548 d.udma_mask = info->udma_mask; 1549 1550 /* fixup ->dma_ops for HPT370/HPT370A */ 1551 if (info == &hpt370 || info == &hpt370a) 1552 d.dma_ops = &hpt370_dma_ops; 1553 1554 - pci_set_drvdata(dev, (void *)info); 1555 - 1556 if (info == &hpt36x || info == &hpt374) 1557 dev2 = pci_get_slot(dev->bus, dev->devfn + 1); 1558 1559 - if (dev2) { 1560 - int ret; 1561 1562 - pci_set_drvdata(dev2, (void *)info); 1563 1564 if (info == &hpt374) 1565 hpt374_init(dev, dev2); ··· 1579 d.host_flags &= ~IDE_HFLAG_NON_BOOTABLE; 1580 } 1581 1582 - ret = ide_setup_pci_devices(dev, dev2, &d); 1583 - if (ret < 0) 1584 pci_dev_put(dev2); 1585 return ret; 1586 } 1587 1588 - return ide_setup_pci_device(dev, &d); 1589 } 1590 1591 static const struct pci_device_id hpt366_pci_tbl[] __devinitconst = { ··· 1620 .name = "HPT366_IDE", 1621 .id_table = hpt366_pci_tbl, 1622 .probe = hpt366_init_one, 1623 }; 1624 1625 static int __init hpt366_ide_init(void) ··· 1628 return ide_pci_register_driver(&driver); 1629 } 1630 1631 module_init(hpt366_ide_init); 1632 1633 MODULE_AUTHOR("Andre Hedrick"); 1634 MODULE_DESCRIPTION("PCI driver module for Highpoint HPT366 IDE");
··· 131 #include <asm/uaccess.h> 132 #include <asm/io.h> 133 134 + #define DRV_NAME "hpt366" 135 + 136 /* various tuning parameters */ 137 #define HPT_RESET_STATE_ENGINE 138 #undef HPT_DELAY_INTERRUPT ··· 620 { 621 ide_hwif_t *hwif = HWIF(drive); 622 struct pci_dev *dev = to_pci_dev(hwif->dev); 623 + struct ide_host *host = pci_get_drvdata(dev); 624 + struct hpt_info *info = host->host_priv + (hwif->dev == host->dev[1]); 625 u8 mask = hwif->ultra_mask; 626 627 switch (info->chip_type) { ··· 660 { 661 ide_hwif_t *hwif = HWIF(drive); 662 struct pci_dev *dev = to_pci_dev(hwif->dev); 663 + struct ide_host *host = pci_get_drvdata(dev); 664 + struct hpt_info *info = host->host_priv + (hwif->dev == host->dev[1]); 665 666 switch (info->chip_type) { 667 case HPT372 : ··· 694 695 static void hpt3xx_set_mode(ide_drive_t *drive, const u8 speed) 696 { 697 + ide_hwif_t *hwif = drive->hwif; 698 + struct pci_dev *dev = to_pci_dev(hwif->dev); 699 + struct ide_host *host = pci_get_drvdata(dev); 700 + struct hpt_info *info = host->host_priv + (hwif->dev == host->dev[1]); 701 struct hpt_timings *t = info->timings; 702 u8 itr_addr = 0x40 + (drive->dn * 4); 703 u32 old_itr = 0; ··· 738 { 739 ide_hwif_t *hwif = HWIF(drive); 740 struct pci_dev *dev = to_pci_dev(hwif->dev); 741 + struct ide_host *host = pci_get_drvdata(dev); 742 + struct hpt_info *info = host->host_priv + (hwif->dev == host->dev[1]); 743 744 if (drive->quirk_list) { 745 if (info->chip_type >= HPT370) { ··· 963 return 1; 964 } 965 966 + static unsigned int __devinit init_chipset_hpt366(struct pci_dev *dev) 967 { 968 unsigned long io_base = pci_resource_start(dev, 4); 969 + struct ide_host *host = pci_get_drvdata(dev); 970 + struct hpt_info *info = host->host_priv + (&dev->dev == host->dev[1]); 971 + const char *name = DRV_NAME; 972 u8 pci_clk, dpll_clk = 0; /* PCI and DPLL clock in MHz */ 973 u8 chip_type; 974 enum ata_clock clock; 975 976 chip_type = info->chip_type; 977 978 pci_write_config_byte(dev, PCI_CACHE_LINE_SIZE, (L1_CACHE_BYTES / 4)); ··· 1048 if ((temp & 0xFFFFF000) != 0xABCDE000) { 1049 int i; 1050 1051 + printk(KERN_WARNING "%s %s: no clock data saved by " 1052 + "BIOS\n", name, pci_name(dev)); 1053 1054 /* Calculate the average value of f_CNT. */ 1055 for (temp = i = 0; i < 128; i++) { ··· 1074 else 1075 pci_clk = 66; 1076 1077 + printk(KERN_INFO "%s %s: DPLL base: %d MHz, f_CNT: %d, " 1078 + "assuming %d MHz PCI\n", name, pci_name(dev), 1079 + dpll_clk, f_cnt, pci_clk); 1080 } else { 1081 u32 itr1 = 0; 1082 ··· 1141 } 1142 1143 if (info->timings->clock_table[clock] == NULL) { 1144 + printk(KERN_ERR "%s %s: unknown bus timing!\n", 1145 + name, pci_name(dev)); 1146 return -EIO; 1147 } 1148 ··· 1168 f_low += adjust >> 1; 1169 } 1170 if (adjust == 8) { 1171 + printk(KERN_ERR "%s %s: DPLL did not stabilize!\n", 1172 + name, pci_name(dev)); 1173 return -EIO; 1174 } 1175 1176 + printk(KERN_INFO "%s %s: using %d MHz DPLL clock\n", 1177 + name, pci_name(dev), dpll_clk); 1178 } else { 1179 /* Mark the fact that we're not using the DPLL. */ 1180 dpll_clk = 0; 1181 1182 + printk(KERN_INFO "%s %s: using %d MHz PCI clock\n", 1183 + name, pci_name(dev), pci_clk); 1184 } 1185 1186 /* Store the clock frequencies. */ 1187 info->dpll_clk = dpll_clk; 1188 info->pci_clk = pci_clk; 1189 info->clock = clock; 1190 1191 if (chip_type >= HPT370) { 1192 u8 mcr1, mcr4; ··· 1218 static u8 __devinit hpt3xx_cable_detect(ide_hwif_t *hwif) 1219 { 1220 struct pci_dev *dev = to_pci_dev(hwif->dev); 1221 + struct ide_host *host = pci_get_drvdata(dev); 1222 + struct hpt_info *info = host->host_priv + (hwif->dev == host->dev[1]); 1223 u8 chip_type = info->chip_type; 1224 u8 scr1 = 0, ata66 = hwif->channel ? 0x01 : 0x02; 1225 ··· 1262 static void __devinit init_hwif_hpt366(ide_hwif_t *hwif) 1263 { 1264 struct pci_dev *dev = to_pci_dev(hwif->dev); 1265 + struct ide_host *host = pci_get_drvdata(dev); 1266 + struct hpt_info *info = host->host_priv + (hwif->dev == host->dev[1]); 1267 int serialize = HPT_SERIALIZE_IO; 1268 u8 chip_type = info->chip_type; 1269 u8 new_mcr, old_mcr = 0; ··· 1364 if (dev2->irq != dev->irq) { 1365 /* FIXME: we need a core pci_set_interrupt() */ 1366 dev2->irq = dev->irq; 1367 + printk(KERN_INFO DRV_NAME " %s: PCI config space interrupt " 1368 + "fixed\n", pci_name(dev2)); 1369 } 1370 } 1371 ··· 1399 pci_read_config_byte(dev2, PCI_INTERRUPT_PIN, &pin2); 1400 1401 if (pin1 != pin2 && dev->irq == dev2->irq) { 1402 + printk(KERN_INFO DRV_NAME " %s: onboard version of chipset, " 1403 + "pin1=%d pin2=%d\n", pci_name(dev), pin1, pin2); 1404 return 1; 1405 } 1406 ··· 1455 }; 1456 1457 static const struct ide_port_info hpt366_chipsets[] __devinitdata = { 1458 + { /* 0: HPT36x */ 1459 + .name = DRV_NAME, 1460 .init_chipset = init_chipset_hpt366, 1461 .init_hwif = init_hwif_hpt366, 1462 .init_dma = init_dma_hpt366, ··· 1472 .host_flags = IDE_HFLAGS_HPT3XX | IDE_HFLAG_SINGLE, 1473 .pio_mask = ATA_PIO4, 1474 .mwdma_mask = ATA_MWDMA2, 1475 + }, 1476 + { /* 1: HPT3xx */ 1477 + .name = DRV_NAME, 1478 .init_chipset = init_chipset_hpt366, 1479 .init_hwif = init_hwif_hpt366, 1480 .init_dma = init_dma_hpt366, ··· 1542 static int __devinit hpt366_init_one(struct pci_dev *dev, const struct pci_device_id *id) 1543 { 1544 const struct hpt_info *info = NULL; 1545 + struct hpt_info *dyn_info; 1546 struct pci_dev *dev2 = NULL; 1547 struct ide_port_info d; 1548 u8 idx = id->driver_data; 1549 u8 rev = dev->revision; 1550 + int ret; 1551 1552 if ((idx == 0 || idx == 4) && (PCI_FUNC(dev->devfn) & 1)) 1553 return -ENODEV; ··· 1582 break; 1583 } 1584 1585 + printk(KERN_INFO DRV_NAME ": %s chipset detected\n", info->chip_name); 1586 1587 + d = hpt366_chipsets[min_t(u8, idx, 1)]; 1588 + 1589 d.udma_mask = info->udma_mask; 1590 1591 /* fixup ->dma_ops for HPT370/HPT370A */ 1592 if (info == &hpt370 || info == &hpt370a) 1593 d.dma_ops = &hpt370_dma_ops; 1594 1595 if (info == &hpt36x || info == &hpt374) 1596 dev2 = pci_get_slot(dev->bus, dev->devfn + 1); 1597 1598 + dyn_info = kzalloc(sizeof(*dyn_info) * (dev2 ? 2 : 1), GFP_KERNEL); 1599 + if (dyn_info == NULL) { 1600 + printk(KERN_ERR "%s %s: out of memory!\n", 1601 + d.name, pci_name(dev)); 1602 + pci_dev_put(dev2); 1603 + return -ENOMEM; 1604 + } 1605 1606 + /* 1607 + * Copy everything from a static "template" structure 1608 + * to just allocated per-chip hpt_info structure. 1609 + */ 1610 + memcpy(dyn_info, info, sizeof(*dyn_info)); 1611 + 1612 + if (dev2) { 1613 + memcpy(dyn_info + 1, info, sizeof(*dyn_info)); 1614 1615 if (info == &hpt374) 1616 hpt374_init(dev, dev2); ··· 1608 d.host_flags &= ~IDE_HFLAG_NON_BOOTABLE; 1609 } 1610 1611 + ret = ide_pci_init_two(dev, dev2, &d, dyn_info); 1612 + if (ret < 0) { 1613 pci_dev_put(dev2); 1614 + kfree(dyn_info); 1615 + } 1616 return ret; 1617 } 1618 1619 + ret = ide_pci_init_one(dev, &d, dyn_info); 1620 + if (ret < 0) 1621 + kfree(dyn_info); 1622 + 1623 + return ret; 1624 + } 1625 + 1626 + static void __devexit hpt366_remove(struct pci_dev *dev) 1627 + { 1628 + struct ide_host *host = pci_get_drvdata(dev); 1629 + struct ide_info *info = host->host_priv; 1630 + struct pci_dev *dev2 = host->dev[1] ? to_pci_dev(host->dev[1]) : NULL; 1631 + 1632 + ide_pci_remove(dev); 1633 + pci_dev_put(dev2); 1634 + kfree(info); 1635 } 1636 1637 static const struct pci_device_id hpt366_pci_tbl[] __devinitconst = { ··· 1632 .name = "HPT366_IDE", 1633 .id_table = hpt366_pci_tbl, 1634 .probe = hpt366_init_one, 1635 + .remove = hpt366_remove, 1636 }; 1637 1638 static int __init hpt366_ide_init(void) ··· 1639 return ide_pci_register_driver(&driver); 1640 } 1641 1642 + static void __exit hpt366_ide_exit(void) 1643 + { 1644 + pci_unregister_driver(&driver); 1645 + } 1646 + 1647 module_init(hpt366_ide_init); 1648 + module_exit(hpt366_ide_exit); 1649 1650 MODULE_AUTHOR("Andre Hedrick"); 1651 MODULE_DESCRIPTION("PCI driver module for Highpoint HPT366 IDE");
+19 -16
drivers/ide/pci/it8213.c
··· 14 #include <linux/ide.h> 15 #include <linux/init.h> 16 17 /** 18 * it8213_set_pio_mode - set host controller for PIO mode 19 * @drive: drive ··· 157 .cable_detect = it8213_cable_detect, 158 }; 159 160 - #define DECLARE_ITE_DEV(name_str) \ 161 - { \ 162 - .name = name_str, \ 163 - .enablebits = { {0x41, 0x80, 0x80} }, \ 164 - .port_ops = &it8213_port_ops, \ 165 - .host_flags = IDE_HFLAG_SINGLE, \ 166 - .pio_mask = ATA_PIO4, \ 167 - .swdma_mask = ATA_SWDMA2_ONLY, \ 168 - .mwdma_mask = ATA_MWDMA12_ONLY, \ 169 - .udma_mask = ATA_UDMA6, \ 170 - } 171 - 172 - static const struct ide_port_info it8213_chipsets[] __devinitdata = { 173 - /* 0 */ DECLARE_ITE_DEV("IT8213"), 174 }; 175 - 176 177 /** 178 * it8213_init_one - pci layer discovery entry ··· 180 181 static int __devinit it8213_init_one(struct pci_dev *dev, const struct pci_device_id *id) 182 { 183 - return ide_setup_pci_device(dev, &it8213_chipsets[id->driver_data]); 184 } 185 186 static const struct pci_device_id it8213_pci_tbl[] = { ··· 194 .name = "ITE8213_IDE", 195 .id_table = it8213_pci_tbl, 196 .probe = it8213_init_one, 197 }; 198 199 static int __init it8213_ide_init(void) ··· 202 return ide_pci_register_driver(&driver); 203 } 204 205 module_init(it8213_ide_init); 206 207 MODULE_AUTHOR("Jack Lee, Alan Cox"); 208 MODULE_DESCRIPTION("PCI driver module for the ITE 8213");
··· 14 #include <linux/ide.h> 15 #include <linux/init.h> 16 17 + #define DRV_NAME "it8213" 18 + 19 /** 20 * it8213_set_pio_mode - set host controller for PIO mode 21 * @drive: drive ··· 155 .cable_detect = it8213_cable_detect, 156 }; 157 158 + static const struct ide_port_info it8213_chipset __devinitdata = { 159 + .name = DRV_NAME, 160 + .enablebits = { {0x41, 0x80, 0x80} }, 161 + .port_ops = &it8213_port_ops, 162 + .host_flags = IDE_HFLAG_SINGLE, 163 + .pio_mask = ATA_PIO4, 164 + .swdma_mask = ATA_SWDMA2_ONLY, 165 + .mwdma_mask = ATA_MWDMA12_ONLY, 166 + .udma_mask = ATA_UDMA6, 167 }; 168 169 /** 170 * it8213_init_one - pci layer discovery entry ··· 184 185 static int __devinit it8213_init_one(struct pci_dev *dev, const struct pci_device_id *id) 186 { 187 + return ide_pci_init_one(dev, &it8213_chipset, NULL); 188 } 189 190 static const struct pci_device_id it8213_pci_tbl[] = { ··· 198 .name = "ITE8213_IDE", 199 .id_table = it8213_pci_tbl, 200 .probe = it8213_init_one, 201 + .remove = ide_pci_remove, 202 }; 203 204 static int __init it8213_ide_init(void) ··· 205 return ide_pci_register_driver(&driver); 206 } 207 208 + static void __exit it8213_ide_exit(void) 209 + { 210 + pci_unregister_driver(&driver); 211 + } 212 + 213 module_init(it8213_ide_init); 214 + module_exit(it8213_ide_exit); 215 216 MODULE_AUTHOR("Jack Lee, Alan Cox"); 217 MODULE_DESCRIPTION("PCI driver module for the ITE 8213");
+44 -30
drivers/ide/pci/it821x.c
··· 67 #include <linux/ide.h> 68 #include <linux/init.h> 69 70 struct it821x_dev 71 { 72 unsigned int smart:1, /* Are we in smart raid mode */ ··· 536 static void __devinit init_hwif_it821x(ide_hwif_t *hwif) 537 { 538 struct pci_dev *dev = to_pci_dev(hwif->dev); 539 - struct it821x_dev **itdevs = (struct it821x_dev **)pci_get_drvdata(dev); 540 - struct it821x_dev *idev = itdevs[hwif->channel]; 541 u8 conf; 542 543 ide_set_hwifdata(hwif, idev); ··· 571 idev->timing10 = 1; 572 hwif->host_flags |= IDE_HFLAG_NO_ATAPI_DMA; 573 if (idev->smart == 0) 574 - printk(KERN_WARNING "it821x: Revision 0x10, workarounds activated.\n"); 575 } 576 577 if (idev->smart == 0) { ··· 605 pci_write_config_byte(dev, PCI_LATENCY_TIMER, 0x20); 606 } 607 608 - static unsigned int __devinit init_chipset_it821x(struct pci_dev *dev, const char *name) 609 { 610 u8 conf; 611 static char *mode[2] = { "pass through", "smart" }; 612 613 /* Force the card into bypass mode if so requested */ 614 if (it8212_noraid) { 615 - printk(KERN_INFO "it8212: forcing bypass mode.\n"); 616 it8212_disable_raid(dev); 617 } 618 pci_read_config_byte(dev, 0x50, &conf); 619 - printk(KERN_INFO "it821x: controller in %s mode.\n", mode[conf & 1]); 620 return 0; 621 } 622 ··· 630 .cable_detect = it821x_cable_detect, 631 }; 632 633 - #define DECLARE_ITE_DEV(name_str) \ 634 - { \ 635 - .name = name_str, \ 636 - .init_chipset = init_chipset_it821x, \ 637 - .init_hwif = init_hwif_it821x, \ 638 - .port_ops = &it821x_port_ops, \ 639 - .pio_mask = ATA_PIO4, \ 640 - } 641 - 642 - static const struct ide_port_info it821x_chipsets[] __devinitdata = { 643 - /* 0 */ DECLARE_ITE_DEV("IT8212"), 644 }; 645 646 /** ··· 649 650 static int __devinit it821x_init_one(struct pci_dev *dev, const struct pci_device_id *id) 651 { 652 - struct it821x_dev *itdevs[2] = { NULL, NULL} , *itdev; 653 - unsigned int i; 654 655 - for (i = 0; i < 2; i++) { 656 - itdev = kzalloc(sizeof(*itdev), GFP_KERNEL); 657 - if (itdev == NULL) { 658 - kfree(itdevs[0]); 659 - printk(KERN_ERR "it821x: out of memory\n"); 660 - return -ENOMEM; 661 - } 662 - 663 - itdevs[i] = itdev; 664 } 665 666 - pci_set_drvdata(dev, itdevs); 667 668 - return ide_setup_pci_device(dev, &it821x_chipsets[id->driver_data]); 669 } 670 671 static const struct pci_device_id it821x_pci_tbl[] = { ··· 686 .name = "ITE821x IDE", 687 .id_table = it821x_pci_tbl, 688 .probe = it821x_init_one, 689 }; 690 691 static int __init it821x_ide_init(void) ··· 694 return ide_pci_register_driver(&driver); 695 } 696 697 module_init(it821x_ide_init); 698 699 module_param_named(noraid, it8212_noraid, int, S_IRUGO); 700 MODULE_PARM_DESC(noraid, "Force card into bypass mode");
··· 67 #include <linux/ide.h> 68 #include <linux/init.h> 69 70 + #define DRV_NAME "it821x" 71 + 72 struct it821x_dev 73 { 74 unsigned int smart:1, /* Are we in smart raid mode */ ··· 534 static void __devinit init_hwif_it821x(ide_hwif_t *hwif) 535 { 536 struct pci_dev *dev = to_pci_dev(hwif->dev); 537 + struct ide_host *host = pci_get_drvdata(dev); 538 + struct it821x_dev *itdevs = host->host_priv; 539 + struct it821x_dev *idev = itdevs + hwif->channel; 540 u8 conf; 541 542 ide_set_hwifdata(hwif, idev); ··· 568 idev->timing10 = 1; 569 hwif->host_flags |= IDE_HFLAG_NO_ATAPI_DMA; 570 if (idev->smart == 0) 571 + printk(KERN_WARNING DRV_NAME " %s: revision 0x10, " 572 + "workarounds activated\n", pci_name(dev)); 573 } 574 575 if (idev->smart == 0) { ··· 601 pci_write_config_byte(dev, PCI_LATENCY_TIMER, 0x20); 602 } 603 604 + static unsigned int __devinit init_chipset_it821x(struct pci_dev *dev) 605 { 606 u8 conf; 607 static char *mode[2] = { "pass through", "smart" }; 608 609 /* Force the card into bypass mode if so requested */ 610 if (it8212_noraid) { 611 + printk(KERN_INFO DRV_NAME " %s: forcing bypass mode\n", 612 + pci_name(dev)); 613 it8212_disable_raid(dev); 614 } 615 pci_read_config_byte(dev, 0x50, &conf); 616 + printk(KERN_INFO DRV_NAME " %s: controller in %s mode\n", 617 + pci_name(dev), mode[conf & 1]); 618 return 0; 619 } 620 ··· 624 .cable_detect = it821x_cable_detect, 625 }; 626 627 + static const struct ide_port_info it821x_chipset __devinitdata = { 628 + .name = DRV_NAME, 629 + .init_chipset = init_chipset_it821x, 630 + .init_hwif = init_hwif_it821x, 631 + .port_ops = &it821x_port_ops, 632 + .pio_mask = ATA_PIO4, 633 }; 634 635 /** ··· 648 649 static int __devinit it821x_init_one(struct pci_dev *dev, const struct pci_device_id *id) 650 { 651 + struct it821x_dev *itdevs; 652 + int rc; 653 654 + itdevs = kzalloc(2 * sizeof(*itdevs), GFP_KERNEL); 655 + if (itdevs == NULL) { 656 + printk(KERN_ERR DRV_NAME " %s: out of memory\n", pci_name(dev)); 657 + return -ENOMEM; 658 } 659 660 + rc = ide_pci_init_one(dev, &it821x_chipset, itdevs); 661 + if (rc) 662 + kfree(itdevs); 663 664 + return rc; 665 + } 666 + 667 + static void __devexit it821x_remove(struct pci_dev *dev) 668 + { 669 + struct ide_host *host = pci_get_drvdata(dev); 670 + struct it821x_dev *itdevs = host->host_priv; 671 + 672 + ide_pci_remove(dev); 673 + kfree(itdevs); 674 } 675 676 static const struct pci_device_id it821x_pci_tbl[] = { ··· 679 .name = "ITE821x IDE", 680 .id_table = it821x_pci_tbl, 681 .probe = it821x_init_one, 682 + .remove = it821x_remove, 683 }; 684 685 static int __init it821x_ide_init(void) ··· 686 return ide_pci_register_driver(&driver); 687 } 688 689 + static void __exit it821x_ide_exit(void) 690 + { 691 + pci_unregister_driver(&driver); 692 + } 693 + 694 module_init(it821x_ide_init); 695 + module_exit(it821x_ide_exit); 696 697 module_param_named(noraid, it8212_noraid, int, S_IRUGO); 698 MODULE_PARM_DESC(noraid, "Force card into bypass mode");
+11 -2
drivers/ide/pci/jmicron.c
··· 12 #include <linux/ide.h> 13 #include <linux/init.h> 14 15 typedef enum { 16 PORT_PATA0 = 0, 17 PORT_PATA1 = 1, ··· 104 }; 105 106 static const struct ide_port_info jmicron_chipset __devinitdata = { 107 - .name = "JMB", 108 .enablebits = { { 0x40, 0x01, 0x01 }, { 0x40, 0x10, 0x10 } }, 109 .port_ops = &jmicron_port_ops, 110 .pio_mask = ATA_PIO5, ··· 123 124 static int __devinit jmicron_init_one(struct pci_dev *dev, const struct pci_device_id *id) 125 { 126 - return ide_setup_pci_device(dev, &jmicron_chipset); 127 } 128 129 /* All JMB PATA controllers have and will continue to have the same ··· 154 .name = "JMicron IDE", 155 .id_table = jmicron_pci_tbl, 156 .probe = jmicron_init_one, 157 }; 158 159 static int __init jmicron_ide_init(void) ··· 162 return ide_pci_register_driver(&driver); 163 } 164 165 module_init(jmicron_ide_init); 166 167 MODULE_AUTHOR("Alan Cox"); 168 MODULE_DESCRIPTION("PCI driver module for the JMicron in legacy modes");
··· 12 #include <linux/ide.h> 13 #include <linux/init.h> 14 15 + #define DRV_NAME "jmicron" 16 + 17 typedef enum { 18 PORT_PATA0 = 0, 19 PORT_PATA1 = 1, ··· 102 }; 103 104 static const struct ide_port_info jmicron_chipset __devinitdata = { 105 + .name = DRV_NAME, 106 .enablebits = { { 0x40, 0x01, 0x01 }, { 0x40, 0x10, 0x10 } }, 107 .port_ops = &jmicron_port_ops, 108 .pio_mask = ATA_PIO5, ··· 121 122 static int __devinit jmicron_init_one(struct pci_dev *dev, const struct pci_device_id *id) 123 { 124 + return ide_pci_init_one(dev, &jmicron_chipset, NULL); 125 } 126 127 /* All JMB PATA controllers have and will continue to have the same ··· 152 .name = "JMicron IDE", 153 .id_table = jmicron_pci_tbl, 154 .probe = jmicron_init_one, 155 + .remove = ide_pci_remove, 156 }; 157 158 static int __init jmicron_ide_init(void) ··· 159 return ide_pci_register_driver(&driver); 160 } 161 162 + static void __exit jmicron_ide_exit(void) 163 + { 164 + pci_unregister_driver(&driver); 165 + } 166 + 167 module_init(jmicron_ide_init); 168 + module_exit(jmicron_ide_exit); 169 170 MODULE_AUTHOR("Alan Cox"); 171 MODULE_DESCRIPTION("PCI driver module for the JMicron in legacy modes");
+11 -2
drivers/ide/pci/ns87415.c
··· 19 20 #include <asm/io.h> 21 22 #ifdef CONFIG_SUPERIO 23 /* SUPERIO 87560 is a PoS chip that NatSem denies exists. 24 * Unfortunately, it's built-in on all Astro-based PA-RISC workstations ··· 307 }; 308 309 static const struct ide_port_info ns87415_chipset __devinitdata = { 310 - .name = "NS87415", 311 .init_hwif = init_hwif_ns87415, 312 .port_ops = &ns87415_port_ops, 313 .dma_ops = &ns87415_dma_ops, ··· 326 d.tp_ops = &superio_tp_ops; 327 } 328 #endif 329 - return ide_setup_pci_device(dev, &d); 330 } 331 332 static const struct pci_device_id ns87415_pci_tbl[] = { ··· 339 .name = "NS87415_IDE", 340 .id_table = ns87415_pci_tbl, 341 .probe = ns87415_init_one, 342 }; 343 344 static int __init ns87415_ide_init(void) ··· 347 return ide_pci_register_driver(&driver); 348 } 349 350 module_init(ns87415_ide_init); 351 352 MODULE_AUTHOR("Mark Lord, Eddie Dost, Andre Hedrick"); 353 MODULE_DESCRIPTION("PCI driver module for NS87415 IDE");
··· 19 20 #include <asm/io.h> 21 22 + #define DRV_NAME "ns87415" 23 + 24 #ifdef CONFIG_SUPERIO 25 /* SUPERIO 87560 is a PoS chip that NatSem denies exists. 26 * Unfortunately, it's built-in on all Astro-based PA-RISC workstations ··· 305 }; 306 307 static const struct ide_port_info ns87415_chipset __devinitdata = { 308 + .name = DRV_NAME, 309 .init_hwif = init_hwif_ns87415, 310 .port_ops = &ns87415_port_ops, 311 .dma_ops = &ns87415_dma_ops, ··· 324 d.tp_ops = &superio_tp_ops; 325 } 326 #endif 327 + return ide_pci_init_one(dev, &d, NULL); 328 } 329 330 static const struct pci_device_id ns87415_pci_tbl[] = { ··· 337 .name = "NS87415_IDE", 338 .id_table = ns87415_pci_tbl, 339 .probe = ns87415_init_one, 340 + .remove = ide_pci_remove, 341 }; 342 343 static int __init ns87415_ide_init(void) ··· 344 return ide_pci_register_driver(&driver); 345 } 346 347 + static void __exit ns87415_ide_exit(void) 348 + { 349 + pci_unregister_driver(&driver); 350 + } 351 + 352 module_init(ns87415_ide_init); 353 + module_exit(ns87415_ide_exit); 354 355 MODULE_AUTHOR("Mark Lord, Eddie Dost, Andre Hedrick"); 356 MODULE_DESCRIPTION("PCI driver module for NS87415 IDE");
+11 -2
drivers/ide/pci/opti621.c
··· 90 91 #include <asm/io.h> 92 93 #define READ_REG 0 /* index of Read cycle timing register */ 94 #define WRITE_REG 1 /* index of Write cycle timing register */ 95 #define CNTRL_REG 3 /* index of Control register */ ··· 202 }; 203 204 static const struct ide_port_info opti621_chipset __devinitdata = { 205 - .name = "OPTI621/X", 206 .enablebits = { {0x45, 0x80, 0x00}, {0x40, 0x08, 0x00} }, 207 .port_ops = &opti621_port_ops, 208 .host_flags = IDE_HFLAG_NO_DMA, ··· 211 212 static int __devinit opti621_init_one(struct pci_dev *dev, const struct pci_device_id *id) 213 { 214 - return ide_setup_pci_device(dev, &opti621_chipset); 215 } 216 217 static const struct pci_device_id opti621_pci_tbl[] = { ··· 225 .name = "Opti621_IDE", 226 .id_table = opti621_pci_tbl, 227 .probe = opti621_init_one, 228 }; 229 230 static int __init opti621_ide_init(void) ··· 233 return ide_pci_register_driver(&driver); 234 } 235 236 module_init(opti621_ide_init); 237 238 MODULE_AUTHOR("Jaromir Koutek, Jan Harkes, Mark Lord"); 239 MODULE_DESCRIPTION("PCI driver module for Opti621 IDE");
··· 90 91 #include <asm/io.h> 92 93 + #define DRV_NAME "opti621" 94 + 95 #define READ_REG 0 /* index of Read cycle timing register */ 96 #define WRITE_REG 1 /* index of Write cycle timing register */ 97 #define CNTRL_REG 3 /* index of Control register */ ··· 200 }; 201 202 static const struct ide_port_info opti621_chipset __devinitdata = { 203 + .name = DRV_NAME, 204 .enablebits = { {0x45, 0x80, 0x00}, {0x40, 0x08, 0x00} }, 205 .port_ops = &opti621_port_ops, 206 .host_flags = IDE_HFLAG_NO_DMA, ··· 209 210 static int __devinit opti621_init_one(struct pci_dev *dev, const struct pci_device_id *id) 211 { 212 + return ide_pci_init_one(dev, &opti621_chipset, NULL); 213 } 214 215 static const struct pci_device_id opti621_pci_tbl[] = { ··· 223 .name = "Opti621_IDE", 224 .id_table = opti621_pci_tbl, 225 .probe = opti621_init_one, 226 + .remove = ide_pci_remove, 227 }; 228 229 static int __init opti621_ide_init(void) ··· 230 return ide_pci_register_driver(&driver); 231 } 232 233 + static void __exit opti621_ide_exit(void) 234 + { 235 + pci_unregister_driver(&driver); 236 + } 237 + 238 module_init(opti621_ide_init); 239 + module_exit(opti621_ide_exit); 240 241 MODULE_AUTHOR("Jaromir Koutek, Jan Harkes, Mark Lord"); 242 MODULE_DESCRIPTION("PCI driver module for Opti621 IDE");
+46 -32
drivers/ide/pci/pdc202xx_new.c
··· 31 #include <asm/pci-bridge.h> 32 #endif 33 34 #undef DEBUG 35 36 #ifdef DEBUG ··· 326 } 327 #endif /* CONFIG_PPC_PMAC */ 328 329 - static unsigned int __devinit init_chipset_pdcnew(struct pci_dev *dev, const char *name) 330 { 331 unsigned long dma_base = pci_resource_start(dev, 4); 332 unsigned long sec_dma_base = dma_base + 0x08; 333 long pll_input, pll_output, ratio; ··· 361 * registers setting. 362 */ 363 pll_input = detect_pll_input_clock(dma_base); 364 - printk("%s: PLL input clock is %ld kHz\n", name, pll_input / 1000); 365 366 /* Sanity check */ 367 if (unlikely(pll_input < 5000000L || pll_input > 70000000L)) { 368 - printk(KERN_ERR "%s: Bad PLL input clock %ld Hz, giving up!\n", 369 - name, pll_input); 370 goto out; 371 } 372 ··· 403 r = 0x00; 404 } else { 405 /* Invalid ratio */ 406 - printk(KERN_ERR "%s: Bad ratio %ld, giving up!\n", name, ratio); 407 goto out; 408 } 409 ··· 414 415 if (unlikely(f < 0 || f > 127)) { 416 /* Invalid F */ 417 - printk(KERN_ERR "%s: F[%d] invalid!\n", name, f); 418 goto out; 419 } 420 ··· 461 462 if (dev2->irq != dev->irq) { 463 dev2->irq = dev->irq; 464 - printk(KERN_INFO "PDC20270: PCI config space " 465 - "interrupt fixed\n"); 466 } 467 468 return dev2; ··· 479 .cable_detect = pdcnew_cable_detect, 480 }; 481 482 - #define DECLARE_PDCNEW_DEV(name_str, udma) \ 483 { \ 484 - .name = name_str, \ 485 .init_chipset = init_chipset_pdcnew, \ 486 .port_ops = &pdcnew_port_ops, \ 487 .host_flags = IDE_HFLAG_POST_SET_MODE | \ ··· 493 } 494 495 static const struct ide_port_info pdcnew_chipsets[] __devinitdata = { 496 - /* 0 */ DECLARE_PDCNEW_DEV("PDC20268", ATA_UDMA5), 497 - /* 1 */ DECLARE_PDCNEW_DEV("PDC20269", ATA_UDMA6), 498 - /* 2 */ DECLARE_PDCNEW_DEV("PDC20270", ATA_UDMA5), 499 - /* 3 */ DECLARE_PDCNEW_DEV("PDC20271", ATA_UDMA6), 500 - /* 4 */ DECLARE_PDCNEW_DEV("PDC20275", ATA_UDMA6), 501 - /* 5 */ DECLARE_PDCNEW_DEV("PDC20276", ATA_UDMA6), 502 - /* 6 */ DECLARE_PDCNEW_DEV("PDC20277", ATA_UDMA6), 503 }; 504 505 /** ··· 508 509 static int __devinit pdc202new_init_one(struct pci_dev *dev, const struct pci_device_id *id) 510 { 511 - const struct ide_port_info *d; 512 struct pci_dev *bridge = dev->bus->self; 513 - u8 idx = id->driver_data; 514 515 - d = &pdcnew_chipsets[idx]; 516 - 517 - if (idx == 2 && bridge && 518 bridge->vendor == PCI_VENDOR_ID_DEC && 519 bridge->device == PCI_DEVICE_ID_DEC_21150) { 520 struct pci_dev *dev2; ··· 522 dev2 = pdc20270_get_dev2(dev); 523 524 if (dev2) { 525 - int ret = ide_setup_pci_devices(dev, dev2, d); 526 if (ret < 0) 527 pci_dev_put(dev2); 528 return ret; 529 } 530 } 531 532 - if (idx == 5 && bridge && 533 bridge->vendor == PCI_VENDOR_ID_INTEL && 534 (bridge->device == PCI_DEVICE_ID_INTEL_I960 || 535 bridge->device == PCI_DEVICE_ID_INTEL_I960RM)) { 536 - printk(KERN_INFO "PDC20276: attached to I2O RAID controller, " 537 - "skipping\n"); 538 return -ENODEV; 539 } 540 541 - return ide_setup_pci_device(dev, d); 542 } 543 544 static const struct pci_device_id pdc202new_pci_tbl[] = { 545 { PCI_VDEVICE(PROMISE, PCI_DEVICE_ID_PROMISE_20268), 0 }, 546 { PCI_VDEVICE(PROMISE, PCI_DEVICE_ID_PROMISE_20269), 1 }, 547 - { PCI_VDEVICE(PROMISE, PCI_DEVICE_ID_PROMISE_20270), 2 }, 548 - { PCI_VDEVICE(PROMISE, PCI_DEVICE_ID_PROMISE_20271), 3 }, 549 - { PCI_VDEVICE(PROMISE, PCI_DEVICE_ID_PROMISE_20275), 4 }, 550 - { PCI_VDEVICE(PROMISE, PCI_DEVICE_ID_PROMISE_20276), 5 }, 551 - { PCI_VDEVICE(PROMISE, PCI_DEVICE_ID_PROMISE_20277), 6 }, 552 { 0, }, 553 }; 554 MODULE_DEVICE_TABLE(pci, pdc202new_pci_tbl); ··· 566 .name = "Promise_IDE", 567 .id_table = pdc202new_pci_tbl, 568 .probe = pdc202new_init_one, 569 }; 570 571 static int __init pdc202new_ide_init(void) ··· 574 return ide_pci_register_driver(&driver); 575 } 576 577 module_init(pdc202new_ide_init); 578 579 MODULE_AUTHOR("Andre Hedrick, Frank Tiernan"); 580 MODULE_DESCRIPTION("PCI driver module for Promise PDC20268 and higher");
··· 31 #include <asm/pci-bridge.h> 32 #endif 33 34 + #define DRV_NAME "pdc202xx_new" 35 + 36 #undef DEBUG 37 38 #ifdef DEBUG ··· 324 } 325 #endif /* CONFIG_PPC_PMAC */ 326 327 + static unsigned int __devinit init_chipset_pdcnew(struct pci_dev *dev) 328 { 329 + const char *name = DRV_NAME; 330 unsigned long dma_base = pci_resource_start(dev, 4); 331 unsigned long sec_dma_base = dma_base + 0x08; 332 long pll_input, pll_output, ratio; ··· 358 * registers setting. 359 */ 360 pll_input = detect_pll_input_clock(dma_base); 361 + printk(KERN_INFO "%s %s: PLL input clock is %ld kHz\n", 362 + name, pci_name(dev), pll_input / 1000); 363 364 /* Sanity check */ 365 if (unlikely(pll_input < 5000000L || pll_input > 70000000L)) { 366 + printk(KERN_ERR "%s %s: Bad PLL input clock %ld Hz, giving up!" 367 + "\n", name, pci_name(dev), pll_input); 368 goto out; 369 } 370 ··· 399 r = 0x00; 400 } else { 401 /* Invalid ratio */ 402 + printk(KERN_ERR "%s %s: Bad ratio %ld, giving up!\n", 403 + name, pci_name(dev), ratio); 404 goto out; 405 } 406 ··· 409 410 if (unlikely(f < 0 || f > 127)) { 411 /* Invalid F */ 412 + printk(KERN_ERR "%s %s: F[%d] invalid!\n", 413 + name, pci_name(dev), f); 414 goto out; 415 } 416 ··· 455 456 if (dev2->irq != dev->irq) { 457 dev2->irq = dev->irq; 458 + printk(KERN_INFO DRV_NAME " %s: PCI config space " 459 + "interrupt fixed\n", pci_name(dev)); 460 } 461 462 return dev2; ··· 473 .cable_detect = pdcnew_cable_detect, 474 }; 475 476 + #define DECLARE_PDCNEW_DEV(udma) \ 477 { \ 478 + .name = DRV_NAME, \ 479 .init_chipset = init_chipset_pdcnew, \ 480 .port_ops = &pdcnew_port_ops, \ 481 .host_flags = IDE_HFLAG_POST_SET_MODE | \ ··· 487 } 488 489 static const struct ide_port_info pdcnew_chipsets[] __devinitdata = { 490 + /* 0: PDC202{68,70} */ DECLARE_PDCNEW_DEV(ATA_UDMA5), 491 + /* 1: PDC202{69,71,75,76,77} */ DECLARE_PDCNEW_DEV(ATA_UDMA6), 492 }; 493 494 /** ··· 507 508 static int __devinit pdc202new_init_one(struct pci_dev *dev, const struct pci_device_id *id) 509 { 510 + const struct ide_port_info *d = &pdcnew_chipsets[id->driver_data]; 511 struct pci_dev *bridge = dev->bus->self; 512 513 + if (dev->device == PCI_DEVICE_ID_PROMISE_20270 && bridge && 514 bridge->vendor == PCI_VENDOR_ID_DEC && 515 bridge->device == PCI_DEVICE_ID_DEC_21150) { 516 struct pci_dev *dev2; ··· 524 dev2 = pdc20270_get_dev2(dev); 525 526 if (dev2) { 527 + int ret = ide_pci_init_two(dev, dev2, d, NULL); 528 if (ret < 0) 529 pci_dev_put(dev2); 530 return ret; 531 } 532 } 533 534 + if (dev->device == PCI_DEVICE_ID_PROMISE_20276 && bridge && 535 bridge->vendor == PCI_VENDOR_ID_INTEL && 536 (bridge->device == PCI_DEVICE_ID_INTEL_I960 || 537 bridge->device == PCI_DEVICE_ID_INTEL_I960RM)) { 538 + printk(KERN_INFO DRV_NAME " %s: attached to I2O RAID controller," 539 + " skipping\n", pci_name(dev)); 540 return -ENODEV; 541 } 542 543 + return ide_pci_init_one(dev, d, NULL); 544 + } 545 + 546 + static void __devexit pdc202new_remove(struct pci_dev *dev) 547 + { 548 + struct ide_host *host = pci_get_drvdata(dev); 549 + struct pci_dev *dev2 = host->dev[1] ? to_pci_dev(host->dev[1]) : NULL; 550 + 551 + ide_pci_remove(dev); 552 + pci_dev_put(dev2); 553 } 554 555 static const struct pci_device_id pdc202new_pci_tbl[] = { 556 { PCI_VDEVICE(PROMISE, PCI_DEVICE_ID_PROMISE_20268), 0 }, 557 { PCI_VDEVICE(PROMISE, PCI_DEVICE_ID_PROMISE_20269), 1 }, 558 + { PCI_VDEVICE(PROMISE, PCI_DEVICE_ID_PROMISE_20270), 0 }, 559 + { PCI_VDEVICE(PROMISE, PCI_DEVICE_ID_PROMISE_20271), 1 }, 560 + { PCI_VDEVICE(PROMISE, PCI_DEVICE_ID_PROMISE_20275), 1 }, 561 + { PCI_VDEVICE(PROMISE, PCI_DEVICE_ID_PROMISE_20276), 1 }, 562 + { PCI_VDEVICE(PROMISE, PCI_DEVICE_ID_PROMISE_20277), 1 }, 563 { 0, }, 564 }; 565 MODULE_DEVICE_TABLE(pci, pdc202new_pci_tbl); ··· 559 .name = "Promise_IDE", 560 .id_table = pdc202new_pci_tbl, 561 .probe = pdc202new_init_one, 562 + .remove = pdc202new_remove, 563 }; 564 565 static int __init pdc202new_ide_init(void) ··· 566 return ide_pci_register_driver(&driver); 567 } 568 569 + static void __exit pdc202new_ide_exit(void) 570 + { 571 + pci_unregister_driver(&driver); 572 + } 573 + 574 module_init(pdc202new_ide_init); 575 + module_exit(pdc202new_ide_exit); 576 577 MODULE_AUTHOR("Andre Hedrick, Frank Tiernan"); 578 MODULE_DESCRIPTION("PCI driver module for Promise PDC20268 and higher");
+29 -20
drivers/ide/pci/pdc202xx_old.c
··· 20 21 #include <asm/io.h> 22 23 #define PDC202XX_DEBUG_DRIVE_INFO 0 24 25 static const char *pdc_quirk_drives[] = { ··· 265 ide_dma_timeout(drive); 266 } 267 268 - static unsigned int __devinit init_chipset_pdc202xx(struct pci_dev *dev, 269 - const char *name) 270 { 271 unsigned long dmabase = pci_resource_start(dev, 4); 272 u8 udma_speed_flag = 0, primary_mode = 0, secondary_mode = 0; ··· 305 if (irq != irq2) { 306 pci_write_config_byte(dev, 307 (PCI_INTERRUPT_LINE)|0x80, irq); /* 0xbc */ 308 - printk(KERN_INFO "%s: PCI config space interrupt " 309 - "mirror fixed\n", name); 310 } 311 } 312 } ··· 351 .dma_timeout = pdc202xx_dma_timeout, 352 }; 353 354 - #define DECLARE_PDC2026X_DEV(name_str, udma, extra_flags) \ 355 { \ 356 - .name = name_str, \ 357 .init_chipset = init_chipset_pdc202xx, \ 358 .port_ops = &pdc2026x_port_ops, \ 359 .dma_ops = &pdc2026x_dma_ops, \ ··· 364 } 365 366 static const struct ide_port_info pdc202xx_chipsets[] __devinitdata = { 367 - { /* 0 */ 368 - .name = "PDC20246", 369 .init_chipset = init_chipset_pdc202xx, 370 .port_ops = &pdc20246_port_ops, 371 .dma_ops = &pdc20246_dma_ops, ··· 375 .udma_mask = ATA_UDMA2, 376 }, 377 378 - /* 1 */ DECLARE_PDC2026X_DEV("PDC20262", ATA_UDMA4, 0), 379 - /* 2 */ DECLARE_PDC2026X_DEV("PDC20263", ATA_UDMA4, 0), 380 - /* 3 */ DECLARE_PDC2026X_DEV("PDC20265", ATA_UDMA5, IDE_HFLAG_RQSIZE_256), 381 - /* 4 */ DECLARE_PDC2026X_DEV("PDC20267", ATA_UDMA5, IDE_HFLAG_RQSIZE_256), 382 }; 383 384 /** ··· 397 398 d = &pdc202xx_chipsets[idx]; 399 400 - if (idx < 3) 401 pdc202ata4_fixup_irq(dev, d->name); 402 403 - if (idx == 3) { 404 struct pci_dev *bridge = dev->bus->self; 405 406 if (bridge && 407 bridge->vendor == PCI_VENDOR_ID_INTEL && 408 (bridge->device == PCI_DEVICE_ID_INTEL_I960 || 409 bridge->device == PCI_DEVICE_ID_INTEL_I960RM)) { 410 - printk(KERN_INFO "ide: Skipping Promise PDC20265 " 411 - "attached to I2O RAID controller\n"); 412 return -ENODEV; 413 } 414 } 415 416 - return ide_setup_pci_device(dev, d); 417 } 418 419 static const struct pci_device_id pdc202xx_pci_tbl[] = { 420 { PCI_VDEVICE(PROMISE, PCI_DEVICE_ID_PROMISE_20246), 0 }, 421 { PCI_VDEVICE(PROMISE, PCI_DEVICE_ID_PROMISE_20262), 1 }, 422 - { PCI_VDEVICE(PROMISE, PCI_DEVICE_ID_PROMISE_20263), 2 }, 423 - { PCI_VDEVICE(PROMISE, PCI_DEVICE_ID_PROMISE_20265), 3 }, 424 - { PCI_VDEVICE(PROMISE, PCI_DEVICE_ID_PROMISE_20267), 4 }, 425 { 0, }, 426 }; 427 MODULE_DEVICE_TABLE(pci, pdc202xx_pci_tbl); ··· 431 .name = "Promise_Old_IDE", 432 .id_table = pdc202xx_pci_tbl, 433 .probe = pdc202xx_init_one, 434 }; 435 436 static int __init pdc202xx_ide_init(void) ··· 439 return ide_pci_register_driver(&driver); 440 } 441 442 module_init(pdc202xx_ide_init); 443 444 MODULE_AUTHOR("Andre Hedrick, Frank Tiernan"); 445 MODULE_DESCRIPTION("PCI driver module for older Promise IDE");
··· 20 21 #include <asm/io.h> 22 23 + #define DRV_NAME "pdc202xx_old" 24 + 25 #define PDC202XX_DEBUG_DRIVE_INFO 0 26 27 static const char *pdc_quirk_drives[] = { ··· 263 ide_dma_timeout(drive); 264 } 265 266 + static unsigned int __devinit init_chipset_pdc202xx(struct pci_dev *dev) 267 { 268 unsigned long dmabase = pci_resource_start(dev, 4); 269 u8 udma_speed_flag = 0, primary_mode = 0, secondary_mode = 0; ··· 304 if (irq != irq2) { 305 pci_write_config_byte(dev, 306 (PCI_INTERRUPT_LINE)|0x80, irq); /* 0xbc */ 307 + printk(KERN_INFO "%s %s: PCI config space interrupt " 308 + "mirror fixed\n", name, pci_name(dev)); 309 } 310 } 311 } ··· 350 .dma_timeout = pdc202xx_dma_timeout, 351 }; 352 353 + #define DECLARE_PDC2026X_DEV(udma, extra_flags) \ 354 { \ 355 + .name = DRV_NAME, \ 356 .init_chipset = init_chipset_pdc202xx, \ 357 .port_ops = &pdc2026x_port_ops, \ 358 .dma_ops = &pdc2026x_dma_ops, \ ··· 363 } 364 365 static const struct ide_port_info pdc202xx_chipsets[] __devinitdata = { 366 + { /* 0: PDC20246 */ 367 + .name = DRV_NAME, 368 .init_chipset = init_chipset_pdc202xx, 369 .port_ops = &pdc20246_port_ops, 370 .dma_ops = &pdc20246_dma_ops, ··· 374 .udma_mask = ATA_UDMA2, 375 }, 376 377 + /* 1: PDC2026{2,3} */ 378 + DECLARE_PDC2026X_DEV(ATA_UDMA4, 0), 379 + /* 2: PDC2026{5,7} */ 380 + DECLARE_PDC2026X_DEV(ATA_UDMA5, IDE_HFLAG_RQSIZE_256), 381 }; 382 383 /** ··· 396 397 d = &pdc202xx_chipsets[idx]; 398 399 + if (idx < 2) 400 pdc202ata4_fixup_irq(dev, d->name); 401 402 + if (dev->vendor == PCI_DEVICE_ID_PROMISE_20265) { 403 struct pci_dev *bridge = dev->bus->self; 404 405 if (bridge && 406 bridge->vendor == PCI_VENDOR_ID_INTEL && 407 (bridge->device == PCI_DEVICE_ID_INTEL_I960 || 408 bridge->device == PCI_DEVICE_ID_INTEL_I960RM)) { 409 + printk(KERN_INFO DRV_NAME " %s: skipping Promise " 410 + "PDC20265 attached to I2O RAID controller\n", 411 + pci_name(dev)); 412 return -ENODEV; 413 } 414 } 415 416 + return ide_pci_init_one(dev, d, NULL); 417 } 418 419 static const struct pci_device_id pdc202xx_pci_tbl[] = { 420 { PCI_VDEVICE(PROMISE, PCI_DEVICE_ID_PROMISE_20246), 0 }, 421 { PCI_VDEVICE(PROMISE, PCI_DEVICE_ID_PROMISE_20262), 1 }, 422 + { PCI_VDEVICE(PROMISE, PCI_DEVICE_ID_PROMISE_20263), 1 }, 423 + { PCI_VDEVICE(PROMISE, PCI_DEVICE_ID_PROMISE_20265), 2 }, 424 + { PCI_VDEVICE(PROMISE, PCI_DEVICE_ID_PROMISE_20267), 2 }, 425 { 0, }, 426 }; 427 MODULE_DEVICE_TABLE(pci, pdc202xx_pci_tbl); ··· 429 .name = "Promise_Old_IDE", 430 .id_table = pdc202xx_pci_tbl, 431 .probe = pdc202xx_init_one, 432 + .remove = ide_pci_remove, 433 }; 434 435 static int __init pdc202xx_ide_init(void) ··· 436 return ide_pci_register_driver(&driver); 437 } 438 439 + static void __exit pdc202xx_ide_exit(void) 440 + { 441 + pci_unregister_driver(&driver); 442 + } 443 + 444 module_init(pdc202xx_ide_init); 445 + module_exit(pdc202xx_ide_exit); 446 447 MODULE_AUTHOR("Andre Hedrick, Frank Tiernan"); 448 MODULE_DESCRIPTION("PCI driver module for older Promise IDE");
+56 -62
drivers/ide/pci/piix.c
··· 54 55 #include <asm/io.h> 56 57 static int no_piix_dma; 58 59 /** ··· 200 /** 201 * init_chipset_ich - set up the ICH chipset 202 * @dev: PCI device to set up 203 - * @name: Name of the device 204 * 205 * Initialize the PCI device as required. For the ICH this turns 206 * out to be nice and simple. 207 */ 208 209 - static unsigned int __devinit init_chipset_ich(struct pci_dev *dev, const char *name) 210 { 211 u32 extra = 0; 212 ··· 315 #define IDE_HFLAGS_PIIX 0 316 #endif 317 318 - #define DECLARE_PIIX_DEV(name_str, udma) \ 319 { \ 320 - .name = name_str, \ 321 .init_hwif = init_hwif_piix, \ 322 .enablebits = {{0x41,0x80,0x80}, {0x43,0x80,0x80}}, \ 323 .port_ops = &piix_port_ops, \ ··· 328 .udma_mask = udma, \ 329 } 330 331 - #define DECLARE_ICH_DEV(name_str, udma) \ 332 { \ 333 - .name = name_str, \ 334 .init_chipset = init_chipset_ich, \ 335 .init_hwif = init_hwif_ich, \ 336 .enablebits = {{0x41,0x80,0x80}, {0x43,0x80,0x80}}, \ ··· 343 } 344 345 static const struct ide_port_info piix_pci_info[] __devinitdata = { 346 - /* 0 */ DECLARE_PIIX_DEV("PIIXa", 0x00), /* no udma */ 347 - /* 1 */ DECLARE_PIIX_DEV("PIIXb", 0x00), /* no udma */ 348 - 349 - /* 2 */ 350 { /* 351 * MPIIX actually has only a single IDE channel mapped to 352 * the primary or secondary ports depending on the value 353 * of the bit 14 of the IDETIM register at offset 0x6c 354 */ 355 - .name = "MPIIX", 356 .enablebits = {{0x6d,0xc0,0x80}, {0x6d,0xc0,0xc0}}, 357 .host_flags = IDE_HFLAG_ISA_PORTS | IDE_HFLAG_NO_DMA | 358 IDE_HFLAGS_PIIX, 359 .pio_mask = ATA_PIO4, 360 /* This is a painful system best to let it self tune for now */ 361 }, 362 - 363 - /* 3 */ DECLARE_PIIX_DEV("PIIX3", 0x00), /* no udma */ 364 - /* 4 */ DECLARE_PIIX_DEV("PIIX4", ATA_UDMA2), 365 - /* 5 */ DECLARE_ICH_DEV("ICH0", ATA_UDMA2), 366 - /* 6 */ DECLARE_PIIX_DEV("PIIX4", ATA_UDMA2), 367 - /* 7 */ DECLARE_ICH_DEV("ICH", ATA_UDMA4), 368 - /* 8 */ DECLARE_PIIX_DEV("PIIX4", ATA_UDMA4), 369 - /* 9 */ DECLARE_PIIX_DEV("PIIX4", ATA_UDMA2), 370 - /* 10 */ DECLARE_ICH_DEV("ICH2", ATA_UDMA5), 371 - /* 11 */ DECLARE_ICH_DEV("ICH2M", ATA_UDMA5), 372 - /* 12 */ DECLARE_ICH_DEV("ICH3M", ATA_UDMA5), 373 - /* 13 */ DECLARE_ICH_DEV("ICH3", ATA_UDMA5), 374 - /* 14 */ DECLARE_ICH_DEV("ICH4", ATA_UDMA5), 375 - /* 15 */ DECLARE_ICH_DEV("ICH5", ATA_UDMA5), 376 - /* 16 */ DECLARE_ICH_DEV("C-ICH", ATA_UDMA5), 377 - /* 17 */ DECLARE_ICH_DEV("ICH4", ATA_UDMA5), 378 - /* 18 */ DECLARE_ICH_DEV("ICH5-SATA", ATA_UDMA5), 379 - /* 19 */ DECLARE_ICH_DEV("ICH5", ATA_UDMA5), 380 - /* 20 */ DECLARE_ICH_DEV("ICH6", ATA_UDMA5), 381 - /* 21 */ DECLARE_ICH_DEV("ICH7", ATA_UDMA5), 382 - /* 22 */ DECLARE_ICH_DEV("ICH4", ATA_UDMA5), 383 - /* 23 */ DECLARE_ICH_DEV("ESB2", ATA_UDMA5), 384 - /* 24 */ DECLARE_ICH_DEV("ICH8M", ATA_UDMA5), 385 }; 386 387 /** ··· 381 382 static int __devinit piix_init_one(struct pci_dev *dev, const struct pci_device_id *id) 383 { 384 - return ide_setup_pci_device(dev, &piix_pci_info[id->driver_data]); 385 } 386 387 /** ··· 408 no_piix_dma = 2; 409 } 410 if(no_piix_dma) 411 - printk(KERN_WARNING "piix: 450NX errata present, disabling IDE DMA.\n"); 412 if(no_piix_dma == 2) 413 - printk(KERN_WARNING "piix: A BIOS update may resolve this.\n"); 414 } 415 416 static const struct pci_device_id piix_pci_tbl[] = { 417 - { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_82371FB_0), 0 }, 418 - { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_82371FB_1), 1 }, 419 - { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_82371MX), 2 }, 420 - { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_82371SB_1), 3 }, 421 - { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_82371AB), 4 }, 422 - { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_82801AB_1), 5 }, 423 - { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_82443MX_1), 6 }, 424 - { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_82801AA_1), 7 }, 425 - { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_82372FB_1), 8 }, 426 - { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_82451NX), 9 }, 427 - { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_82801BA_9), 10 }, 428 - { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_82801BA_8), 11 }, 429 - { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_82801CA_10), 12 }, 430 - { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_82801CA_11), 13 }, 431 - { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_82801DB_11), 14 }, 432 - { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_82801EB_11), 15 }, 433 - { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_82801E_11), 16 }, 434 - { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_82801DB_10), 17 }, 435 #ifdef CONFIG_BLK_DEV_IDE_SATA 436 - { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_82801EB_1), 18 }, 437 #endif 438 - { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_ESB_2), 19 }, 439 - { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_ICH6_19), 20 }, 440 - { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_ICH7_21), 21 }, 441 - { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_82801DB_1), 22 }, 442 - { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_ESB2_18), 23 }, 443 - { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_ICH8_6), 24 }, 444 { 0, }, 445 }; 446 MODULE_DEVICE_TABLE(pci, piix_pci_tbl); ··· 449 .name = "PIIX_IDE", 450 .id_table = piix_pci_tbl, 451 .probe = piix_init_one, 452 }; 453 454 static int __init piix_ide_init(void) ··· 458 return ide_pci_register_driver(&driver); 459 } 460 461 module_init(piix_ide_init); 462 463 MODULE_AUTHOR("Andre Hedrick, Andrzej Krzysztofowicz"); 464 MODULE_DESCRIPTION("PCI driver module for Intel PIIX IDE");
··· 54 55 #include <asm/io.h> 56 57 + #define DRV_NAME "piix" 58 + 59 static int no_piix_dma; 60 61 /** ··· 198 /** 199 * init_chipset_ich - set up the ICH chipset 200 * @dev: PCI device to set up 201 * 202 * Initialize the PCI device as required. For the ICH this turns 203 * out to be nice and simple. 204 */ 205 206 + static unsigned int __devinit init_chipset_ich(struct pci_dev *dev) 207 { 208 u32 extra = 0; 209 ··· 314 #define IDE_HFLAGS_PIIX 0 315 #endif 316 317 + #define DECLARE_PIIX_DEV(udma) \ 318 { \ 319 + .name = DRV_NAME, \ 320 .init_hwif = init_hwif_piix, \ 321 .enablebits = {{0x41,0x80,0x80}, {0x43,0x80,0x80}}, \ 322 .port_ops = &piix_port_ops, \ ··· 327 .udma_mask = udma, \ 328 } 329 330 + #define DECLARE_ICH_DEV(udma) \ 331 { \ 332 + .name = DRV_NAME, \ 333 .init_chipset = init_chipset_ich, \ 334 .init_hwif = init_hwif_ich, \ 335 .enablebits = {{0x41,0x80,0x80}, {0x43,0x80,0x80}}, \ ··· 342 } 343 344 static const struct ide_port_info piix_pci_info[] __devinitdata = { 345 + /* 0: MPIIX */ 346 { /* 347 * MPIIX actually has only a single IDE channel mapped to 348 * the primary or secondary ports depending on the value 349 * of the bit 14 of the IDETIM register at offset 0x6c 350 */ 351 + .name = DRV_NAME, 352 .enablebits = {{0x6d,0xc0,0x80}, {0x6d,0xc0,0xc0}}, 353 .host_flags = IDE_HFLAG_ISA_PORTS | IDE_HFLAG_NO_DMA | 354 IDE_HFLAGS_PIIX, 355 .pio_mask = ATA_PIO4, 356 /* This is a painful system best to let it self tune for now */ 357 }, 358 + /* 1: PIIXa/PIIXb/PIIX3 */ 359 + DECLARE_PIIX_DEV(0x00), /* no udma */ 360 + /* 2: PIIX4 */ 361 + DECLARE_PIIX_DEV(ATA_UDMA2), 362 + /* 3: ICH0 */ 363 + DECLARE_ICH_DEV(ATA_UDMA2), 364 + /* 4: ICH */ 365 + DECLARE_ICH_DEV(ATA_UDMA4), 366 + /* 5: PIIX4 */ 367 + DECLARE_PIIX_DEV(ATA_UDMA4), 368 + /* 6: ICH[2-7]/ICH[2-3]M/C-ICH/ICH5-SATA/ESB2/ICH8M */ 369 + DECLARE_ICH_DEV(ATA_UDMA5), 370 }; 371 372 /** ··· 394 395 static int __devinit piix_init_one(struct pci_dev *dev, const struct pci_device_id *id) 396 { 397 + return ide_pci_init_one(dev, &piix_pci_info[id->driver_data], NULL); 398 } 399 400 /** ··· 421 no_piix_dma = 2; 422 } 423 if(no_piix_dma) 424 + printk(KERN_WARNING DRV_NAME ": 450NX errata present, disabling IDE DMA.\n"); 425 if(no_piix_dma == 2) 426 + printk(KERN_WARNING DRV_NAME ": A BIOS update may resolve this.\n"); 427 } 428 429 static const struct pci_device_id piix_pci_tbl[] = { 430 + { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_82371FB_0), 1 }, 431 + { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_82371FB_1), 1 }, 432 + { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_82371MX), 0 }, 433 + { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_82371SB_1), 1 }, 434 + { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_82371AB), 2 }, 435 + { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_82801AB_1), 3 }, 436 + { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_82443MX_1), 2 }, 437 + { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_82801AA_1), 4 }, 438 + { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_82372FB_1), 5 }, 439 + { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_82451NX), 2 }, 440 + { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_82801BA_9), 6 }, 441 + { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_82801BA_8), 6 }, 442 + { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_82801CA_10), 6 }, 443 + { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_82801CA_11), 6 }, 444 + { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_82801DB_11), 6 }, 445 + { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_82801EB_11), 6 }, 446 + { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_82801E_11), 6 }, 447 + { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_82801DB_10), 6 }, 448 #ifdef CONFIG_BLK_DEV_IDE_SATA 449 + { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_82801EB_1), 6 }, 450 #endif 451 + { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_ESB_2), 6 }, 452 + { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_ICH6_19), 6 }, 453 + { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_ICH7_21), 6 }, 454 + { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_82801DB_1), 6 }, 455 + { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_ESB2_18), 6 }, 456 + { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_ICH8_6), 6 }, 457 { 0, }, 458 }; 459 MODULE_DEVICE_TABLE(pci, piix_pci_tbl); ··· 462 .name = "PIIX_IDE", 463 .id_table = piix_pci_tbl, 464 .probe = piix_init_one, 465 + .remove = ide_pci_remove, 466 }; 467 468 static int __init piix_ide_init(void) ··· 470 return ide_pci_register_driver(&driver); 471 } 472 473 + static void __exit piix_ide_exit(void) 474 + { 475 + pci_unregister_driver(&driver); 476 + } 477 + 478 module_init(piix_ide_init); 479 + module_exit(piix_ide_exit); 480 481 MODULE_AUTHOR("Andre Hedrick, Andrzej Krzysztofowicz"); 482 MODULE_DESCRIPTION("PCI driver module for Intel PIIX IDE");
+11 -2
drivers/ide/pci/rz1000.c
··· 21 #include <linux/ide.h> 22 #include <linux/init.h> 23 24 static void __devinit init_hwif_rz1000 (ide_hwif_t *hwif) 25 { 26 struct pci_dev *dev = to_pci_dev(hwif->dev); ··· 42 } 43 44 static const struct ide_port_info rz1000_chipset __devinitdata = { 45 - .name = "RZ100x", 46 .init_hwif = init_hwif_rz1000, 47 .chipset = ide_rz1000, 48 .host_flags = IDE_HFLAG_NO_DMA, ··· 50 51 static int __devinit rz1000_init_one(struct pci_dev *dev, const struct pci_device_id *id) 52 { 53 - return ide_setup_pci_device(dev, &rz1000_chipset); 54 } 55 56 static const struct pci_device_id rz1000_pci_tbl[] = { ··· 64 .name = "RZ1000_IDE", 65 .id_table = rz1000_pci_tbl, 66 .probe = rz1000_init_one, 67 }; 68 69 static int __init rz1000_ide_init(void) ··· 72 return ide_pci_register_driver(&driver); 73 } 74 75 module_init(rz1000_ide_init); 76 77 MODULE_AUTHOR("Andre Hedrick"); 78 MODULE_DESCRIPTION("PCI driver module for RZ1000 IDE");
··· 21 #include <linux/ide.h> 22 #include <linux/init.h> 23 24 + #define DRV_NAME "rz1000" 25 + 26 static void __devinit init_hwif_rz1000 (ide_hwif_t *hwif) 27 { 28 struct pci_dev *dev = to_pci_dev(hwif->dev); ··· 40 } 41 42 static const struct ide_port_info rz1000_chipset __devinitdata = { 43 + .name = DRV_NAME, 44 .init_hwif = init_hwif_rz1000, 45 .chipset = ide_rz1000, 46 .host_flags = IDE_HFLAG_NO_DMA, ··· 48 49 static int __devinit rz1000_init_one(struct pci_dev *dev, const struct pci_device_id *id) 50 { 51 + return ide_pci_init_one(dev, &rz1000_chipset, NULL); 52 } 53 54 static const struct pci_device_id rz1000_pci_tbl[] = { ··· 62 .name = "RZ1000_IDE", 63 .id_table = rz1000_pci_tbl, 64 .probe = rz1000_init_one, 65 + .remove = ide_pci_remove, 66 }; 67 68 static int __init rz1000_ide_init(void) ··· 69 return ide_pci_register_driver(&driver); 70 } 71 72 + static void __exit rz1000_ide_exit(void) 73 + { 74 + pci_unregister_driver(&driver); 75 + } 76 + 77 module_init(rz1000_ide_init); 78 + module_exit(rz1000_ide_exit); 79 80 MODULE_AUTHOR("Andre Hedrick"); 81 MODULE_DESCRIPTION("PCI driver module for RZ1000 IDE");
+29 -21
drivers/ide/pci/sc1200.c
··· 22 23 #include <asm/io.h> 24 25 #define SC1200_REV_A 0x00 26 #define SC1200_REV_B1 0x01 27 #define SC1200_REV_B3 0x02 ··· 236 * we only save state when going from full power to less 237 */ 238 if (state.event == PM_EVENT_ON) { 239 - struct sc1200_saved_state *ss; 240 unsigned int r; 241 - 242 - /* 243 - * allocate a permanent save area, if not already allocated 244 - */ 245 - ss = (struct sc1200_saved_state *)pci_get_drvdata(dev); 246 - if (ss == NULL) { 247 - ss = kmalloc(sizeof(*ss), GFP_KERNEL); 248 - if (ss == NULL) 249 - return -ENOMEM; 250 - pci_set_drvdata(dev, ss); 251 - } 252 253 /* 254 * save timing registers ··· 255 256 static int sc1200_resume (struct pci_dev *dev) 257 { 258 - struct sc1200_saved_state *ss; 259 unsigned int r; 260 int i; 261 ··· 264 if (i) 265 return i; 266 267 - ss = (struct sc1200_saved_state *)pci_get_drvdata(dev); 268 - 269 /* 270 * restore timing registers 271 * (this may be unnecessary if BIOS also does it) 272 */ 273 - if (ss) { 274 - for (r = 0; r < 8; r++) 275 - pci_write_config_dword(dev, 0x40 + r * 4, ss->regs[r]); 276 - } 277 278 return 0; 279 } ··· 293 }; 294 295 static const struct ide_port_info sc1200_chipset __devinitdata = { 296 - .name = "SC1200", 297 .port_ops = &sc1200_port_ops, 298 .dma_ops = &sc1200_dma_ops, 299 .host_flags = IDE_HFLAG_SERIALIZE | ··· 306 307 static int __devinit sc1200_init_one(struct pci_dev *dev, const struct pci_device_id *id) 308 { 309 - return ide_setup_pci_device(dev, &sc1200_chipset); 310 } 311 312 static const struct pci_device_id sc1200_pci_tbl[] = { ··· 331 .name = "SC1200_IDE", 332 .id_table = sc1200_pci_tbl, 333 .probe = sc1200_init_one, 334 #ifdef CONFIG_PM 335 .suspend = sc1200_suspend, 336 .resume = sc1200_resume, ··· 343 return ide_pci_register_driver(&driver); 344 } 345 346 module_init(sc1200_ide_init); 347 348 MODULE_AUTHOR("Mark Lord"); 349 MODULE_DESCRIPTION("PCI driver module for NS SC1200 IDE");
··· 22 23 #include <asm/io.h> 24 25 + #define DRV_NAME "sc1200" 26 + 27 #define SC1200_REV_A 0x00 28 #define SC1200_REV_B1 0x01 29 #define SC1200_REV_B3 0x02 ··· 234 * we only save state when going from full power to less 235 */ 236 if (state.event == PM_EVENT_ON) { 237 + struct ide_host *host = pci_get_drvdata(dev); 238 + struct sc1200_saved_state *ss = host->host_priv; 239 unsigned int r; 240 241 /* 242 * save timing registers ··· 263 264 static int sc1200_resume (struct pci_dev *dev) 265 { 266 + struct ide_host *host = pci_get_drvdata(dev); 267 + struct sc1200_saved_state *ss = host->host_priv; 268 unsigned int r; 269 int i; 270 ··· 271 if (i) 272 return i; 273 274 /* 275 * restore timing registers 276 * (this may be unnecessary if BIOS also does it) 277 */ 278 + for (r = 0; r < 8; r++) 279 + pci_write_config_dword(dev, 0x40 + r * 4, ss->regs[r]); 280 281 return 0; 282 } ··· 304 }; 305 306 static const struct ide_port_info sc1200_chipset __devinitdata = { 307 + .name = DRV_NAME, 308 .port_ops = &sc1200_port_ops, 309 .dma_ops = &sc1200_dma_ops, 310 .host_flags = IDE_HFLAG_SERIALIZE | ··· 317 318 static int __devinit sc1200_init_one(struct pci_dev *dev, const struct pci_device_id *id) 319 { 320 + struct sc1200_saved_state *ss = NULL; 321 + int rc; 322 + 323 + #ifdef CONFIG_PM 324 + ss = kmalloc(sizeof(*ss), GFP_KERNEL); 325 + if (ss == NULL) 326 + return -ENOMEM; 327 + #endif 328 + rc = ide_pci_init_one(dev, &sc1200_chipset, ss); 329 + if (rc) 330 + kfree(ss); 331 + 332 + return rc; 333 } 334 335 static const struct pci_device_id sc1200_pci_tbl[] = { ··· 330 .name = "SC1200_IDE", 331 .id_table = sc1200_pci_tbl, 332 .probe = sc1200_init_one, 333 + .remove = ide_pci_remove, 334 #ifdef CONFIG_PM 335 .suspend = sc1200_suspend, 336 .resume = sc1200_resume, ··· 341 return ide_pci_register_driver(&driver); 342 } 343 344 + static void __exit sc1200_ide_exit(void) 345 + { 346 + pci_unregister_driver(&driver); 347 + } 348 + 349 module_init(sc1200_ide_init); 350 + module_exit(sc1200_ide_exit); 351 352 MODULE_AUTHOR("Mark Lord"); 353 MODULE_DESCRIPTION("PCI driver module for NS SC1200 IDE");
+27 -13
drivers/ide/pci/serverworks.c
··· 38 39 #include <asm/io.h> 40 41 #define SVWKS_CSB5_REVISION_NEW 0x92 /* min PCI_REVISION_ID for UDMA5 (A2.0) */ 42 #define SVWKS_CSB6_REVISION 0xa0 /* min PCI_REVISION_ID for UDMA4 (A1.0) */ 43 ··· 174 pci_write_config_byte(dev, 0x54, ultra_enable); 175 } 176 177 - static unsigned int __devinit init_chipset_svwks (struct pci_dev *dev, const char *name) 178 { 179 unsigned int reg; 180 u8 btr; ··· 190 pci_read_config_dword(isa_dev, 0x64, &reg); 191 reg &= ~0x00002000; /* disable 600ns interrupt mask */ 192 if(!(reg & 0x00004000)) 193 - printk(KERN_DEBUG "%s: UDMA not BIOS enabled.\n", name); 194 reg |= 0x00004000; /* enable UDMA/33 support */ 195 pci_write_config_dword(isa_dev, 0x64, reg); 196 } ··· 355 #define IDE_HFLAGS_SVWKS IDE_HFLAG_LEGACY_IRQS 356 357 static const struct ide_port_info serverworks_chipsets[] __devinitdata = { 358 - { /* 0 */ 359 - .name = "SvrWks OSB4", 360 .init_chipset = init_chipset_svwks, 361 .port_ops = &osb4_port_ops, 362 .host_flags = IDE_HFLAGS_SVWKS, 363 .pio_mask = ATA_PIO4, 364 .mwdma_mask = ATA_MWDMA2, 365 .udma_mask = 0x00, /* UDMA is problematic on OSB4 */ 366 - },{ /* 1 */ 367 - .name = "SvrWks CSB5", 368 .init_chipset = init_chipset_svwks, 369 .port_ops = &svwks_port_ops, 370 .host_flags = IDE_HFLAGS_SVWKS, 371 .pio_mask = ATA_PIO4, 372 .mwdma_mask = ATA_MWDMA2, 373 .udma_mask = ATA_UDMA5, 374 - },{ /* 2 */ 375 - .name = "SvrWks CSB6", 376 .init_chipset = init_chipset_svwks, 377 .port_ops = &svwks_port_ops, 378 .host_flags = IDE_HFLAGS_SVWKS, 379 .pio_mask = ATA_PIO4, 380 .mwdma_mask = ATA_MWDMA2, 381 .udma_mask = ATA_UDMA5, 382 - },{ /* 3 */ 383 - .name = "SvrWks CSB6", 384 .init_chipset = init_chipset_svwks, 385 .port_ops = &svwks_port_ops, 386 .host_flags = IDE_HFLAGS_SVWKS | IDE_HFLAG_SINGLE, 387 .pio_mask = ATA_PIO4, 388 .mwdma_mask = ATA_MWDMA2, 389 .udma_mask = ATA_UDMA5, 390 - },{ /* 4 */ 391 - .name = "SvrWks HT1000", 392 .init_chipset = init_chipset_svwks, 393 .port_ops = &svwks_port_ops, 394 .host_flags = IDE_HFLAGS_SVWKS | IDE_HFLAG_SINGLE, ··· 429 d.host_flags &= ~IDE_HFLAG_SINGLE; 430 } 431 432 - return ide_setup_pci_device(dev, &d); 433 } 434 435 static const struct pci_device_id svwks_pci_tbl[] = { ··· 446 .name = "Serverworks_IDE", 447 .id_table = svwks_pci_tbl, 448 .probe = svwks_init_one, 449 }; 450 451 static int __init svwks_ide_init(void) ··· 454 return ide_pci_register_driver(&driver); 455 } 456 457 module_init(svwks_ide_init); 458 459 MODULE_AUTHOR("Michael Aubry. Andrzej Krzysztofowicz, Andre Hedrick"); 460 MODULE_DESCRIPTION("PCI driver module for Serverworks OSB4/CSB5/CSB6 IDE");
··· 38 39 #include <asm/io.h> 40 41 + #define DRV_NAME "serverworks" 42 + 43 #define SVWKS_CSB5_REVISION_NEW 0x92 /* min PCI_REVISION_ID for UDMA5 (A2.0) */ 44 #define SVWKS_CSB6_REVISION 0xa0 /* min PCI_REVISION_ID for UDMA4 (A1.0) */ 45 ··· 172 pci_write_config_byte(dev, 0x54, ultra_enable); 173 } 174 175 + static unsigned int __devinit init_chipset_svwks(struct pci_dev *dev) 176 { 177 unsigned int reg; 178 u8 btr; ··· 188 pci_read_config_dword(isa_dev, 0x64, &reg); 189 reg &= ~0x00002000; /* disable 600ns interrupt mask */ 190 if(!(reg & 0x00004000)) 191 + printk(KERN_DEBUG DRV_NAME " %s: UDMA not BIOS " 192 + "enabled.\n", pci_name(dev)); 193 reg |= 0x00004000; /* enable UDMA/33 support */ 194 pci_write_config_dword(isa_dev, 0x64, reg); 195 } ··· 352 #define IDE_HFLAGS_SVWKS IDE_HFLAG_LEGACY_IRQS 353 354 static const struct ide_port_info serverworks_chipsets[] __devinitdata = { 355 + { /* 0: OSB4 */ 356 + .name = DRV_NAME, 357 .init_chipset = init_chipset_svwks, 358 .port_ops = &osb4_port_ops, 359 .host_flags = IDE_HFLAGS_SVWKS, 360 .pio_mask = ATA_PIO4, 361 .mwdma_mask = ATA_MWDMA2, 362 .udma_mask = 0x00, /* UDMA is problematic on OSB4 */ 363 + }, 364 + { /* 1: CSB5 */ 365 + .name = DRV_NAME, 366 .init_chipset = init_chipset_svwks, 367 .port_ops = &svwks_port_ops, 368 .host_flags = IDE_HFLAGS_SVWKS, 369 .pio_mask = ATA_PIO4, 370 .mwdma_mask = ATA_MWDMA2, 371 .udma_mask = ATA_UDMA5, 372 + }, 373 + { /* 2: CSB6 */ 374 + .name = DRV_NAME, 375 .init_chipset = init_chipset_svwks, 376 .port_ops = &svwks_port_ops, 377 .host_flags = IDE_HFLAGS_SVWKS, 378 .pio_mask = ATA_PIO4, 379 .mwdma_mask = ATA_MWDMA2, 380 .udma_mask = ATA_UDMA5, 381 + }, 382 + { /* 3: CSB6-2 */ 383 + .name = DRV_NAME, 384 .init_chipset = init_chipset_svwks, 385 .port_ops = &svwks_port_ops, 386 .host_flags = IDE_HFLAGS_SVWKS | IDE_HFLAG_SINGLE, 387 .pio_mask = ATA_PIO4, 388 .mwdma_mask = ATA_MWDMA2, 389 .udma_mask = ATA_UDMA5, 390 + }, 391 + { /* 4: HT1000 */ 392 + .name = DRV_NAME, 393 .init_chipset = init_chipset_svwks, 394 .port_ops = &svwks_port_ops, 395 .host_flags = IDE_HFLAGS_SVWKS | IDE_HFLAG_SINGLE, ··· 422 d.host_flags &= ~IDE_HFLAG_SINGLE; 423 } 424 425 + return ide_pci_init_one(dev, &d, NULL); 426 } 427 428 static const struct pci_device_id svwks_pci_tbl[] = { ··· 439 .name = "Serverworks_IDE", 440 .id_table = svwks_pci_tbl, 441 .probe = svwks_init_one, 442 + .remove = ide_pci_remove, 443 }; 444 445 static int __init svwks_ide_init(void) ··· 446 return ide_pci_register_driver(&driver); 447 } 448 449 + static void __exit svwks_ide_exit(void) 450 + { 451 + pci_unregister_driver(&driver); 452 + } 453 + 454 module_init(svwks_ide_init); 455 + module_exit(svwks_ide_exit); 456 457 MODULE_AUTHOR("Michael Aubry. Andrzej Krzysztofowicz, Andre Hedrick"); 458 MODULE_DESCRIPTION("PCI driver module for Serverworks OSB4/CSB5/CSB6 IDE");
+94 -67
drivers/ide/pci/siimage.c
··· 44 #include <linux/init.h> 45 #include <linux/io.h> 46 47 /** 48 * pdev_is_sata - check if device is SATA 49 * @pdev: PCI device to check ··· 129 130 static u8 sil_ioread8(struct pci_dev *dev, unsigned long addr) 131 { 132 u8 tmp = 0; 133 134 - if (pci_get_drvdata(dev)) 135 tmp = readb((void __iomem *)addr); 136 else 137 pci_read_config_byte(dev, addr, &tmp); ··· 142 143 static u16 sil_ioread16(struct pci_dev *dev, unsigned long addr) 144 { 145 u16 tmp = 0; 146 147 - if (pci_get_drvdata(dev)) 148 tmp = readw((void __iomem *)addr); 149 else 150 pci_read_config_word(dev, addr, &tmp); ··· 155 156 static void sil_iowrite8(struct pci_dev *dev, u8 val, unsigned long addr) 157 { 158 - if (pci_get_drvdata(dev)) 159 writeb(val, (void __iomem *)addr); 160 else 161 pci_write_config_byte(dev, addr, val); ··· 165 166 static void sil_iowrite16(struct pci_dev *dev, u16 val, unsigned long addr) 167 { 168 - if (pci_get_drvdata(dev)) 169 writew(val, (void __iomem *)addr); 170 else 171 pci_write_config_word(dev, addr, val); ··· 175 176 static void sil_iowrite32(struct pci_dev *dev, u32 val, unsigned long addr) 177 { 178 - if (pci_get_drvdata(dev)) 179 writel(val, (void __iomem *)addr); 180 else 181 pci_write_config_dword(dev, addr, val); ··· 455 } 456 457 /** 458 - * setup_mmio_siimage - switch controller into MMIO mode 459 - * @dev: PCI device we are configuring 460 - * @name: device name 461 - * 462 - * Attempt to put the device into MMIO mode. There are some slight 463 - * complications here with certain systems where the MMIO BAR isn't 464 - * mapped, so we have to be sure that we can fall back to I/O. 465 - */ 466 - 467 - static unsigned int setup_mmio_siimage(struct pci_dev *dev, const char *name) 468 - { 469 - resource_size_t bar5 = pci_resource_start(dev, 5); 470 - unsigned long barsize = pci_resource_len(dev, 5); 471 - void __iomem *ioaddr; 472 - 473 - /* 474 - * Drop back to PIO if we can't map the MMIO. Some systems 475 - * seem to get terminally confused in the PCI spaces. 476 - */ 477 - if (!request_mem_region(bar5, barsize, name)) { 478 - printk(KERN_WARNING "siimage: IDE controller MMIO ports not " 479 - "available.\n"); 480 - return 0; 481 - } 482 - 483 - ioaddr = ioremap(bar5, barsize); 484 - if (ioaddr == NULL) { 485 - release_mem_region(bar5, barsize); 486 - return 0; 487 - } 488 - 489 - pci_set_master(dev); 490 - pci_set_drvdata(dev, (void *) ioaddr); 491 - 492 - return 1; 493 - } 494 - 495 - /** 496 * init_chipset_siimage - set up an SI device 497 * @dev: PCI device 498 - * @name: device name 499 * 500 * Perform the initial PCI set up for this device. Attempt to switch 501 * to 133 MHz clocking if the system isn't already set up to do it. 502 */ 503 504 - static unsigned int __devinit init_chipset_siimage(struct pci_dev *dev, 505 - const char *name) 506 { 507 unsigned long base, scsc_addr; 508 - void __iomem *ioaddr = NULL; 509 - u8 rev = dev->revision, tmp, BA5_EN; 510 511 pci_write_config_byte(dev, PCI_CACHE_LINE_SIZE, rev ? 1 : 255); 512 513 - pci_read_config_byte(dev, 0x8A, &BA5_EN); 514 - 515 - if ((BA5_EN & 0x01) || pci_resource_start(dev, 5)) 516 - if (setup_mmio_siimage(dev, name)) 517 - ioaddr = pci_get_drvdata(dev); 518 519 base = (unsigned long)ioaddr; 520 ··· 539 { "== 100", "== 133", "== 2X PCI", "DISABLED!" }; 540 541 tmp >>= 4; 542 - printk(KERN_INFO "%s: BASE CLOCK %s\n", name, clk_str[tmp & 3]); 543 } 544 545 return 0; ··· 561 static void __devinit init_mmio_iops_siimage(ide_hwif_t *hwif) 562 { 563 struct pci_dev *dev = to_pci_dev(hwif->dev); 564 - void *addr = pci_get_drvdata(dev); 565 u8 ch = hwif->channel; 566 struct ide_io_ports *io_ports = &hwif->io_ports; 567 unsigned long base; ··· 661 static void __devinit init_iops_siimage(ide_hwif_t *hwif) 662 { 663 struct pci_dev *dev = to_pci_dev(hwif->dev); 664 665 hwif->hwif_data = NULL; 666 667 /* Pessimal until we finish probing */ 668 hwif->rqsize = 15; 669 670 - if (pci_get_drvdata(dev) == NULL) 671 - return; 672 - 673 - init_mmio_iops_siimage(hwif); 674 } 675 676 /** ··· 717 .dma_lost_irq = ide_dma_lost_irq, 718 }; 719 720 - #define DECLARE_SII_DEV(name_str, p_ops) \ 721 { \ 722 - .name = name_str, \ 723 .init_chipset = init_chipset_siimage, \ 724 .init_iops = init_iops_siimage, \ 725 .port_ops = p_ops, \ ··· 730 } 731 732 static const struct ide_port_info siimage_chipsets[] __devinitdata = { 733 - /* 0 */ DECLARE_SII_DEV("SiI680", &sil_pata_port_ops), 734 - /* 1 */ DECLARE_SII_DEV("SiI3112 Serial ATA", &sil_sata_port_ops), 735 - /* 2 */ DECLARE_SII_DEV("Adaptec AAR-1210SA", &sil_sata_port_ops) 736 }; 737 738 /** ··· 746 static int __devinit siimage_init_one(struct pci_dev *dev, 747 const struct pci_device_id *id) 748 { 749 struct ide_port_info d; 750 u8 idx = id->driver_data; 751 752 d = siimage_chipsets[idx]; 753 ··· 760 static int first = 1; 761 762 if (first) { 763 - printk(KERN_INFO "siimage: For full SATA support you " 764 "should use the libata sata_sil module.\n"); 765 first = 0; 766 } ··· 768 d.host_flags |= IDE_HFLAG_NO_ATAPI_DMA; 769 } 770 771 - return ide_setup_pci_device(dev, &d); 772 } 773 774 static const struct pci_device_id siimage_pci_tbl[] = { 775 { PCI_VDEVICE(CMD, PCI_DEVICE_ID_SII_680), 0 }, 776 #ifdef CONFIG_BLK_DEV_IDE_SATA 777 { PCI_VDEVICE(CMD, PCI_DEVICE_ID_SII_3112), 1 }, 778 - { PCI_VDEVICE(CMD, PCI_DEVICE_ID_SII_1210SA), 2 }, 779 #endif 780 { 0, }, 781 }; ··· 832 .name = "SiI_IDE", 833 .id_table = siimage_pci_tbl, 834 .probe = siimage_init_one, 835 }; 836 837 static int __init siimage_ide_init(void) ··· 840 return ide_pci_register_driver(&driver); 841 } 842 843 module_init(siimage_ide_init); 844 845 MODULE_AUTHOR("Andre Hedrick, Alan Cox"); 846 MODULE_DESCRIPTION("PCI driver module for SiI IDE");
··· 44 #include <linux/init.h> 45 #include <linux/io.h> 46 47 + #define DRV_NAME "siimage" 48 + 49 /** 50 * pdev_is_sata - check if device is SATA 51 * @pdev: PCI device to check ··· 127 128 static u8 sil_ioread8(struct pci_dev *dev, unsigned long addr) 129 { 130 + struct ide_host *host = pci_get_drvdata(dev); 131 u8 tmp = 0; 132 133 + if (host->host_priv) 134 tmp = readb((void __iomem *)addr); 135 else 136 pci_read_config_byte(dev, addr, &tmp); ··· 139 140 static u16 sil_ioread16(struct pci_dev *dev, unsigned long addr) 141 { 142 + struct ide_host *host = pci_get_drvdata(dev); 143 u16 tmp = 0; 144 145 + if (host->host_priv) 146 tmp = readw((void __iomem *)addr); 147 else 148 pci_read_config_word(dev, addr, &tmp); ··· 151 152 static void sil_iowrite8(struct pci_dev *dev, u8 val, unsigned long addr) 153 { 154 + struct ide_host *host = pci_get_drvdata(dev); 155 + 156 + if (host->host_priv) 157 writeb(val, (void __iomem *)addr); 158 else 159 pci_write_config_byte(dev, addr, val); ··· 159 160 static void sil_iowrite16(struct pci_dev *dev, u16 val, unsigned long addr) 161 { 162 + struct ide_host *host = pci_get_drvdata(dev); 163 + 164 + if (host->host_priv) 165 writew(val, (void __iomem *)addr); 166 else 167 pci_write_config_word(dev, addr, val); ··· 167 168 static void sil_iowrite32(struct pci_dev *dev, u32 val, unsigned long addr) 169 { 170 + struct ide_host *host = pci_get_drvdata(dev); 171 + 172 + if (host->host_priv) 173 writel(val, (void __iomem *)addr); 174 else 175 pci_write_config_dword(dev, addr, val); ··· 445 } 446 447 /** 448 * init_chipset_siimage - set up an SI device 449 * @dev: PCI device 450 * 451 * Perform the initial PCI set up for this device. Attempt to switch 452 * to 133 MHz clocking if the system isn't already set up to do it. 453 */ 454 455 + static unsigned int __devinit init_chipset_siimage(struct pci_dev *dev) 456 { 457 + struct ide_host *host = pci_get_drvdata(dev); 458 + void __iomem *ioaddr = host->host_priv; 459 unsigned long base, scsc_addr; 460 + u8 rev = dev->revision, tmp; 461 462 pci_write_config_byte(dev, PCI_CACHE_LINE_SIZE, rev ? 1 : 255); 463 464 + if (ioaddr) 465 + pci_set_master(dev); 466 467 base = (unsigned long)ioaddr; 468 ··· 571 { "== 100", "== 133", "== 2X PCI", "DISABLED!" }; 572 573 tmp >>= 4; 574 + printk(KERN_INFO DRV_NAME " %s: BASE CLOCK %s\n", 575 + pci_name(dev), clk_str[tmp & 3]); 576 } 577 578 return 0; ··· 592 static void __devinit init_mmio_iops_siimage(ide_hwif_t *hwif) 593 { 594 struct pci_dev *dev = to_pci_dev(hwif->dev); 595 + struct ide_host *host = pci_get_drvdata(dev); 596 + void *addr = host->host_priv; 597 u8 ch = hwif->channel; 598 struct ide_io_ports *io_ports = &hwif->io_ports; 599 unsigned long base; ··· 691 static void __devinit init_iops_siimage(ide_hwif_t *hwif) 692 { 693 struct pci_dev *dev = to_pci_dev(hwif->dev); 694 + struct ide_host *host = pci_get_drvdata(dev); 695 696 hwif->hwif_data = NULL; 697 698 /* Pessimal until we finish probing */ 699 hwif->rqsize = 15; 700 701 + if (host->host_priv) 702 + init_mmio_iops_siimage(hwif); 703 } 704 705 /** ··· 748 .dma_lost_irq = ide_dma_lost_irq, 749 }; 750 751 + #define DECLARE_SII_DEV(p_ops) \ 752 { \ 753 + .name = DRV_NAME, \ 754 .init_chipset = init_chipset_siimage, \ 755 .init_iops = init_iops_siimage, \ 756 .port_ops = p_ops, \ ··· 761 } 762 763 static const struct ide_port_info siimage_chipsets[] __devinitdata = { 764 + /* 0: SiI680 */ DECLARE_SII_DEV(&sil_pata_port_ops), 765 + /* 1: SiI3112 */ DECLARE_SII_DEV(&sil_sata_port_ops) 766 }; 767 768 /** ··· 778 static int __devinit siimage_init_one(struct pci_dev *dev, 779 const struct pci_device_id *id) 780 { 781 + void __iomem *ioaddr = NULL; 782 + resource_size_t bar5 = pci_resource_start(dev, 5); 783 + unsigned long barsize = pci_resource_len(dev, 5); 784 + int rc; 785 struct ide_port_info d; 786 u8 idx = id->driver_data; 787 + u8 BA5_EN; 788 789 d = siimage_chipsets[idx]; 790 ··· 787 static int first = 1; 788 789 if (first) { 790 + printk(KERN_INFO DRV_NAME ": For full SATA support you " 791 "should use the libata sata_sil module.\n"); 792 first = 0; 793 } ··· 795 d.host_flags |= IDE_HFLAG_NO_ATAPI_DMA; 796 } 797 798 + rc = pci_enable_device(dev); 799 + if (rc) 800 + return rc; 801 + 802 + pci_read_config_byte(dev, 0x8A, &BA5_EN); 803 + if ((BA5_EN & 0x01) || bar5) { 804 + /* 805 + * Drop back to PIO if we can't map the MMIO. Some systems 806 + * seem to get terminally confused in the PCI spaces. 807 + */ 808 + if (!request_mem_region(bar5, barsize, d.name)) { 809 + printk(KERN_WARNING DRV_NAME " %s: MMIO ports not " 810 + "available\n", pci_name(dev)); 811 + } else { 812 + ioaddr = ioremap(bar5, barsize); 813 + if (ioaddr == NULL) 814 + release_mem_region(bar5, barsize); 815 + } 816 + } 817 + 818 + rc = ide_pci_init_one(dev, &d, ioaddr); 819 + if (rc) { 820 + if (ioaddr) { 821 + iounmap(ioaddr); 822 + release_mem_region(bar5, barsize); 823 + } 824 + pci_disable_device(dev); 825 + } 826 + 827 + return rc; 828 + } 829 + 830 + static void __devexit siimage_remove(struct pci_dev *dev) 831 + { 832 + struct ide_host *host = pci_get_drvdata(dev); 833 + void __iomem *ioaddr = host->host_priv; 834 + 835 + ide_pci_remove(dev); 836 + 837 + if (ioaddr) { 838 + resource_size_t bar5 = pci_resource_start(dev, 5); 839 + unsigned long barsize = pci_resource_len(dev, 5); 840 + 841 + iounmap(ioaddr); 842 + release_mem_region(bar5, barsize); 843 + } 844 + 845 + pci_disable_device(dev); 846 } 847 848 static const struct pci_device_id siimage_pci_tbl[] = { 849 { PCI_VDEVICE(CMD, PCI_DEVICE_ID_SII_680), 0 }, 850 #ifdef CONFIG_BLK_DEV_IDE_SATA 851 { PCI_VDEVICE(CMD, PCI_DEVICE_ID_SII_3112), 1 }, 852 + { PCI_VDEVICE(CMD, PCI_DEVICE_ID_SII_1210SA), 1 }, 853 #endif 854 { 0, }, 855 }; ··· 812 .name = "SiI_IDE", 813 .id_table = siimage_pci_tbl, 814 .probe = siimage_init_one, 815 + .remove = siimage_remove, 816 }; 817 818 static int __init siimage_ide_init(void) ··· 819 return ide_pci_register_driver(&driver); 820 } 821 822 + static void __exit siimage_ide_exit(void) 823 + { 824 + pci_unregister_driver(&driver); 825 + } 826 + 827 module_init(siimage_ide_init); 828 + module_exit(siimage_ide_exit); 829 830 MODULE_AUTHOR("Andre Hedrick, Alan Cox"); 831 MODULE_DESCRIPTION("PCI driver module for SiI IDE");
+29 -10
drivers/ide/pci/sis5513.c
··· 52 #include <linux/init.h> 53 #include <linux/ide.h> 54 55 /* registers layout and init values are chipset family dependant */ 56 57 #define ATA_16 0x01 ··· 382 } 383 pci_dev_put(host); 384 385 - printk(KERN_INFO "SIS5513: %s %s controller\n", 386 - SiSHostChipInfo[i].name, chipset_capability[chipset_family]); 387 } 388 389 if (!chipset_family) { /* Belongs to pci-quirks */ ··· 399 pci_write_config_dword(dev, 0x54, idemisc); 400 401 if (trueid == 0x5518) { 402 - printk(KERN_INFO "SIS5513: SiS 962/963 MuTIOL IDE UDMA133 controller\n"); 403 chipset_family = ATA_133; 404 405 /* Check for 5513 compability mapping ··· 409 */ 410 if ((idemisc & 0x40000000) == 0) { 411 pci_write_config_dword(dev, 0x54, idemisc | 0x40000000); 412 - printk(KERN_INFO "SIS5513: Switching to 5513 register mapping\n"); 413 } 414 } 415 } ··· 434 pci_dev_put(lpc_bridge); 435 436 if (lpc_bridge->revision == 0x10 && (prefctl & 0x80)) { 437 - printk(KERN_INFO "SIS5513: SiS 961B MuTIOL IDE UDMA133 controller\n"); 438 chipset_family = ATA_133a; 439 } else { 440 - printk(KERN_INFO "SIS5513: SiS 961 MuTIOL IDE UDMA100 controller\n"); 441 chipset_family = ATA_100; 442 } 443 } ··· 448 return chipset_family; 449 } 450 451 - static unsigned int __devinit init_chipset_sis5513(struct pci_dev *dev, 452 - const char *name) 453 { 454 /* Make general config ops here 455 1/ tell IDE channels to operate in Compatibility mode only ··· 561 }; 562 563 static const struct ide_port_info sis5513_chipset __devinitdata = { 564 - .name = "SIS5513", 565 .init_chipset = init_chipset_sis5513, 566 .enablebits = { {0x4a, 0x02, 0x02}, {0x4a, 0x04, 0x04} }, 567 .host_flags = IDE_HFLAG_LEGACY_IRQS | IDE_HFLAG_NO_AUTODMA, ··· 589 590 d.udma_mask = udma_rates[chipset_family]; 591 592 - return ide_setup_pci_device(dev, &d); 593 } 594 595 static const struct pci_device_id sis5513_pci_tbl[] = { ··· 610 .name = "SIS_IDE", 611 .id_table = sis5513_pci_tbl, 612 .probe = sis5513_init_one, 613 }; 614 615 static int __init sis5513_ide_init(void) ··· 618 return ide_pci_register_driver(&driver); 619 } 620 621 module_init(sis5513_ide_init); 622 623 MODULE_AUTHOR("Lionel Bouton, L C Chang, Andre Hedrick, Vojtech Pavlik"); 624 MODULE_DESCRIPTION("PCI driver module for SIS IDE");
··· 52 #include <linux/init.h> 53 #include <linux/ide.h> 54 55 + #define DRV_NAME "sis5513" 56 + 57 /* registers layout and init values are chipset family dependant */ 58 59 #define ATA_16 0x01 ··· 380 } 381 pci_dev_put(host); 382 383 + printk(KERN_INFO DRV_NAME " %s: %s %s controller\n", 384 + pci_name(dev), SiSHostChipInfo[i].name, 385 + chipset_capability[chipset_family]); 386 } 387 388 if (!chipset_family) { /* Belongs to pci-quirks */ ··· 396 pci_write_config_dword(dev, 0x54, idemisc); 397 398 if (trueid == 0x5518) { 399 + printk(KERN_INFO DRV_NAME " %s: SiS 962/963 MuTIOL IDE UDMA133 controller\n", 400 + pci_name(dev)); 401 chipset_family = ATA_133; 402 403 /* Check for 5513 compability mapping ··· 405 */ 406 if ((idemisc & 0x40000000) == 0) { 407 pci_write_config_dword(dev, 0x54, idemisc | 0x40000000); 408 + printk(KERN_INFO DRV_NAME " %s: Switching to 5513 register mapping\n", 409 + pci_name(dev)); 410 } 411 } 412 } ··· 429 pci_dev_put(lpc_bridge); 430 431 if (lpc_bridge->revision == 0x10 && (prefctl & 0x80)) { 432 + printk(KERN_INFO DRV_NAME " %s: SiS 961B MuTIOL IDE UDMA133 controller\n", 433 + pci_name(dev)); 434 chipset_family = ATA_133a; 435 } else { 436 + printk(KERN_INFO DRV_NAME " %s: SiS 961 MuTIOL IDE UDMA100 controller\n", 437 + pci_name(dev)); 438 chipset_family = ATA_100; 439 } 440 } ··· 441 return chipset_family; 442 } 443 444 + static unsigned int __devinit init_chipset_sis5513(struct pci_dev *dev) 445 { 446 /* Make general config ops here 447 1/ tell IDE channels to operate in Compatibility mode only ··· 555 }; 556 557 static const struct ide_port_info sis5513_chipset __devinitdata = { 558 + .name = DRV_NAME, 559 .init_chipset = init_chipset_sis5513, 560 .enablebits = { {0x4a, 0x02, 0x02}, {0x4a, 0x04, 0x04} }, 561 .host_flags = IDE_HFLAG_LEGACY_IRQS | IDE_HFLAG_NO_AUTODMA, ··· 583 584 d.udma_mask = udma_rates[chipset_family]; 585 586 + return ide_pci_init_one(dev, &d, NULL); 587 + } 588 + 589 + static void __devexit sis5513_remove(struct pci_dev *dev) 590 + { 591 + ide_pci_remove(dev); 592 + pci_disable_device(dev); 593 } 594 595 static const struct pci_device_id sis5513_pci_tbl[] = { ··· 598 .name = "SIS_IDE", 599 .id_table = sis5513_pci_tbl, 600 .probe = sis5513_init_one, 601 + .remove = sis5513_remove, 602 }; 603 604 static int __init sis5513_ide_init(void) ··· 605 return ide_pci_register_driver(&driver); 606 } 607 608 + static void __exit sis5513_ide_exit(void) 609 + { 610 + pci_unregister_driver(&driver); 611 + } 612 + 613 module_init(sis5513_ide_init); 614 + module_exit(sis5513_ide_exit); 615 616 MODULE_AUTHOR("Lionel Bouton, L C Chang, Andre Hedrick, Vojtech Pavlik"); 617 MODULE_DESCRIPTION("PCI driver module for SIS IDE");
+13 -4
drivers/ide/pci/sl82c105.c
··· 23 24 #include <asm/io.h> 25 26 #undef DEBUG 27 28 #ifdef DEBUG ··· 272 * channel 0 here at least, but channel 1 has to be enabled by 273 * firmware or arch code. We still set both to 16 bits mode. 274 */ 275 - static unsigned int __devinit init_chipset_sl82c105(struct pci_dev *dev, const char *msg) 276 { 277 u32 val; 278 ··· 303 }; 304 305 static const struct ide_port_info sl82c105_chipset __devinitdata = { 306 - .name = "W82C105", 307 .init_chipset = init_chipset_sl82c105, 308 .enablebits = {{0x40,0x01,0x01}, {0x40,0x10,0x10}}, 309 .port_ops = &sl82c105_port_ops, ··· 330 * Never ever EVER under any circumstances enable 331 * DMA when the bridge is this old. 332 */ 333 - printk(KERN_INFO "W82C105_IDE: Winbond W83C553 bridge " 334 "revision %d, BM-DMA disabled\n", rev); 335 d.dma_ops = NULL; 336 d.mwdma_mask = 0; 337 d.host_flags &= ~IDE_HFLAG_SERIALIZE_DMA; 338 } 339 340 - return ide_setup_pci_device(dev, &d); 341 } 342 343 static const struct pci_device_id sl82c105_pci_tbl[] = { ··· 350 .name = "W82C105_IDE", 351 .id_table = sl82c105_pci_tbl, 352 .probe = sl82c105_init_one, 353 }; 354 355 static int __init sl82c105_ide_init(void) ··· 358 return ide_pci_register_driver(&driver); 359 } 360 361 module_init(sl82c105_ide_init); 362 363 MODULE_DESCRIPTION("PCI driver module for W82C105 IDE"); 364 MODULE_LICENSE("GPL");
··· 23 24 #include <asm/io.h> 25 26 + #define DRV_NAME "sl82c105" 27 + 28 #undef DEBUG 29 30 #ifdef DEBUG ··· 270 * channel 0 here at least, but channel 1 has to be enabled by 271 * firmware or arch code. We still set both to 16 bits mode. 272 */ 273 + static unsigned int __devinit init_chipset_sl82c105(struct pci_dev *dev) 274 { 275 u32 val; 276 ··· 301 }; 302 303 static const struct ide_port_info sl82c105_chipset __devinitdata = { 304 + .name = DRV_NAME, 305 .init_chipset = init_chipset_sl82c105, 306 .enablebits = {{0x40,0x01,0x01}, {0x40,0x10,0x10}}, 307 .port_ops = &sl82c105_port_ops, ··· 328 * Never ever EVER under any circumstances enable 329 * DMA when the bridge is this old. 330 */ 331 + printk(KERN_INFO DRV_NAME ": Winbond W83C553 bridge " 332 "revision %d, BM-DMA disabled\n", rev); 333 d.dma_ops = NULL; 334 d.mwdma_mask = 0; 335 d.host_flags &= ~IDE_HFLAG_SERIALIZE_DMA; 336 } 337 338 + return ide_pci_init_one(dev, &d, NULL); 339 } 340 341 static const struct pci_device_id sl82c105_pci_tbl[] = { ··· 348 .name = "W82C105_IDE", 349 .id_table = sl82c105_pci_tbl, 350 .probe = sl82c105_init_one, 351 + .remove = ide_pci_remove, 352 }; 353 354 static int __init sl82c105_ide_init(void) ··· 355 return ide_pci_register_driver(&driver); 356 } 357 358 + static void __exit sl82c105_ide_exit(void) 359 + { 360 + pci_unregister_driver(&driver); 361 + } 362 + 363 module_init(sl82c105_ide_init); 364 + module_exit(sl82c105_ide_exit); 365 366 MODULE_DESCRIPTION("PCI driver module for W82C105 IDE"); 367 MODULE_LICENSE("GPL");
+11 -2
drivers/ide/pci/slc90e66.c
··· 15 #include <linux/ide.h> 16 #include <linux/init.h> 17 18 static DEFINE_SPINLOCK(slc90e66_lock); 19 20 static void slc90e66_set_pio_mode(ide_drive_t *drive, const u8 pio) ··· 134 }; 135 136 static const struct ide_port_info slc90e66_chipset __devinitdata = { 137 - .name = "SLC90E66", 138 .enablebits = { {0x41, 0x80, 0x80}, {0x43, 0x80, 0x80} }, 139 .port_ops = &slc90e66_port_ops, 140 .host_flags = IDE_HFLAG_LEGACY_IRQS, ··· 146 147 static int __devinit slc90e66_init_one(struct pci_dev *dev, const struct pci_device_id *id) 148 { 149 - return ide_setup_pci_device(dev, &slc90e66_chipset); 150 } 151 152 static const struct pci_device_id slc90e66_pci_tbl[] = { ··· 159 .name = "SLC90e66_IDE", 160 .id_table = slc90e66_pci_tbl, 161 .probe = slc90e66_init_one, 162 }; 163 164 static int __init slc90e66_ide_init(void) ··· 167 return ide_pci_register_driver(&driver); 168 } 169 170 module_init(slc90e66_ide_init); 171 172 MODULE_AUTHOR("Andre Hedrick"); 173 MODULE_DESCRIPTION("PCI driver module for SLC90E66 IDE");
··· 15 #include <linux/ide.h> 16 #include <linux/init.h> 17 18 + #define DRV_NAME "slc90e66" 19 + 20 static DEFINE_SPINLOCK(slc90e66_lock); 21 22 static void slc90e66_set_pio_mode(ide_drive_t *drive, const u8 pio) ··· 132 }; 133 134 static const struct ide_port_info slc90e66_chipset __devinitdata = { 135 + .name = DRV_NAME, 136 .enablebits = { {0x41, 0x80, 0x80}, {0x43, 0x80, 0x80} }, 137 .port_ops = &slc90e66_port_ops, 138 .host_flags = IDE_HFLAG_LEGACY_IRQS, ··· 144 145 static int __devinit slc90e66_init_one(struct pci_dev *dev, const struct pci_device_id *id) 146 { 147 + return ide_pci_init_one(dev, &slc90e66_chipset, NULL); 148 } 149 150 static const struct pci_device_id slc90e66_pci_tbl[] = { ··· 157 .name = "SLC90e66_IDE", 158 .id_table = slc90e66_pci_tbl, 159 .probe = slc90e66_init_one, 160 + .remove = ide_pci_remove, 161 }; 162 163 static int __init slc90e66_ide_init(void) ··· 164 return ide_pci_register_driver(&driver); 165 } 166 167 + static void __exit slc90e66_ide_exit(void) 168 + { 169 + pci_unregister_driver(&driver); 170 + } 171 + 172 module_init(slc90e66_ide_init); 173 + module_exit(slc90e66_ide_exit); 174 175 MODULE_AUTHOR("Andre Hedrick"); 176 MODULE_DESCRIPTION("PCI driver module for SLC90E66 IDE");
+43 -14
drivers/ide/pci/tc86c001.c
··· 11 #include <linux/pci.h> 12 #include <linux/ide.h> 13 14 static void tc86c001_set_mode(ide_drive_t *drive, const u8 speed) 15 { 16 ide_hwif_t *hwif = HWIF(drive); ··· 175 hwif->rqsize = 0xffff; 176 } 177 178 - static unsigned int __devinit init_chipset_tc86c001(struct pci_dev *dev, 179 - const char *name) 180 - { 181 - int err = pci_request_region(dev, 5, name); 182 - 183 - if (err) 184 - printk(KERN_ERR "%s: system control regs already in use", name); 185 - return err; 186 - } 187 - 188 static const struct ide_port_ops tc86c001_port_ops = { 189 .set_pio_mode = tc86c001_set_pio_mode, 190 .set_dma_mode = tc86c001_set_mode, ··· 193 }; 194 195 static const struct ide_port_info tc86c001_chipset __devinitdata = { 196 - .name = "TC86C001", 197 - .init_chipset = init_chipset_tc86c001, 198 .init_hwif = init_hwif_tc86c001, 199 .port_ops = &tc86c001_port_ops, 200 .dma_ops = &tc86c001_dma_ops, ··· 206 static int __devinit tc86c001_init_one(struct pci_dev *dev, 207 const struct pci_device_id *id) 208 { 209 - return ide_setup_pci_device(dev, &tc86c001_chipset); 210 } 211 212 static const struct pci_device_id tc86c001_pci_tbl[] = { ··· 248 static struct pci_driver driver = { 249 .name = "TC86C001", 250 .id_table = tc86c001_pci_tbl, 251 - .probe = tc86c001_init_one 252 }; 253 254 static int __init tc86c001_ide_init(void) 255 { 256 return ide_pci_register_driver(&driver); 257 } 258 module_init(tc86c001_ide_init); 259 260 MODULE_AUTHOR("MontaVista Software, Inc. <source@mvista.com>"); 261 MODULE_DESCRIPTION("PCI driver module for TC86C001 IDE");
··· 11 #include <linux/pci.h> 12 #include <linux/ide.h> 13 14 + #define DRV_NAME "tc86c001" 15 + 16 static void tc86c001_set_mode(ide_drive_t *drive, const u8 speed) 17 { 18 ide_hwif_t *hwif = HWIF(drive); ··· 173 hwif->rqsize = 0xffff; 174 } 175 176 static const struct ide_port_ops tc86c001_port_ops = { 177 .set_pio_mode = tc86c001_set_pio_mode, 178 .set_dma_mode = tc86c001_set_mode, ··· 201 }; 202 203 static const struct ide_port_info tc86c001_chipset __devinitdata = { 204 + .name = DRV_NAME, 205 .init_hwif = init_hwif_tc86c001, 206 .port_ops = &tc86c001_port_ops, 207 .dma_ops = &tc86c001_dma_ops, ··· 215 static int __devinit tc86c001_init_one(struct pci_dev *dev, 216 const struct pci_device_id *id) 217 { 218 + int rc; 219 + 220 + rc = pci_enable_device(dev); 221 + if (rc) 222 + goto out; 223 + 224 + rc = pci_request_region(dev, 5, DRV_NAME); 225 + if (rc) { 226 + printk(KERN_ERR DRV_NAME ": system control regs already in use"); 227 + goto out_disable; 228 + } 229 + 230 + rc = ide_pci_init_one(dev, &tc86c001_chipset, NULL); 231 + if (rc) 232 + goto out_release; 233 + 234 + goto out; 235 + 236 + out_release: 237 + pci_release_region(dev, 5); 238 + out_disable: 239 + pci_disable_device(dev); 240 + out: 241 + return rc; 242 + } 243 + 244 + static void __devexit tc86c001_remove(struct pci_dev *dev) 245 + { 246 + ide_pci_remove(dev); 247 + pci_release_region(dev, 5); 248 + pci_disable_device(dev); 249 } 250 251 static const struct pci_device_id tc86c001_pci_tbl[] = { ··· 227 static struct pci_driver driver = { 228 .name = "TC86C001", 229 .id_table = tc86c001_pci_tbl, 230 + .probe = tc86c001_init_one, 231 + .remove = tc86c001_remove, 232 }; 233 234 static int __init tc86c001_ide_init(void) 235 { 236 return ide_pci_register_driver(&driver); 237 } 238 + 239 + static void __exit tc86c001_ide_exit(void) 240 + { 241 + pci_unregister_driver(&driver); 242 + } 243 + 244 module_init(tc86c001_ide_init); 245 + module_exit(tc86c001_ide_exit); 246 247 MODULE_AUTHOR("MontaVista Software, Inc. <source@mvista.com>"); 248 MODULE_DESCRIPTION("PCI driver module for TC86C001 IDE");
+11 -2
drivers/ide/pci/triflex.c
··· 33 #include <linux/ide.h> 34 #include <linux/init.h> 35 36 static void triflex_set_mode(ide_drive_t *drive, const u8 speed) 37 { 38 ide_hwif_t *hwif = HWIF(drive); ··· 95 }; 96 97 static const struct ide_port_info triflex_device __devinitdata = { 98 - .name = "TRIFLEX", 99 .enablebits = {{0x80, 0x01, 0x01}, {0x80, 0x02, 0x02}}, 100 .port_ops = &triflex_port_ops, 101 .pio_mask = ATA_PIO4, ··· 106 static int __devinit triflex_init_one(struct pci_dev *dev, 107 const struct pci_device_id *id) 108 { 109 - return ide_setup_pci_device(dev, &triflex_device); 110 } 111 112 static const struct pci_device_id triflex_pci_tbl[] = { ··· 119 .name = "TRIFLEX_IDE", 120 .id_table = triflex_pci_tbl, 121 .probe = triflex_init_one, 122 }; 123 124 static int __init triflex_ide_init(void) ··· 127 return ide_pci_register_driver(&driver); 128 } 129 130 module_init(triflex_ide_init); 131 132 MODULE_AUTHOR("Torben Mathiasen"); 133 MODULE_DESCRIPTION("PCI driver module for Compaq Triflex IDE");
··· 33 #include <linux/ide.h> 34 #include <linux/init.h> 35 36 + #define DRV_NAME "triflex" 37 + 38 static void triflex_set_mode(ide_drive_t *drive, const u8 speed) 39 { 40 ide_hwif_t *hwif = HWIF(drive); ··· 93 }; 94 95 static const struct ide_port_info triflex_device __devinitdata = { 96 + .name = DRV_NAME, 97 .enablebits = {{0x80, 0x01, 0x01}, {0x80, 0x02, 0x02}}, 98 .port_ops = &triflex_port_ops, 99 .pio_mask = ATA_PIO4, ··· 104 static int __devinit triflex_init_one(struct pci_dev *dev, 105 const struct pci_device_id *id) 106 { 107 + return ide_pci_init_one(dev, &triflex_device, NULL); 108 } 109 110 static const struct pci_device_id triflex_pci_tbl[] = { ··· 117 .name = "TRIFLEX_IDE", 118 .id_table = triflex_pci_tbl, 119 .probe = triflex_init_one, 120 + .remove = ide_pci_remove, 121 }; 122 123 static int __init triflex_ide_init(void) ··· 124 return ide_pci_register_driver(&driver); 125 } 126 127 + static void __exit triflex_ide_exit(void) 128 + { 129 + pci_unregister_driver(&driver); 130 + } 131 + 132 module_init(triflex_ide_init); 133 + module_exit(triflex_ide_exit); 134 135 MODULE_AUTHOR("Torben Mathiasen"); 136 MODULE_DESCRIPTION("PCI driver module for Compaq Triflex IDE");
+13 -4
drivers/ide/pci/trm290.c
··· 141 142 #include <asm/io.h> 143 144 static void trm290_prepare_drive (ide_drive_t *drive, unsigned int use_dma) 145 { 146 ide_hwif_t *hwif = HWIF(drive); ··· 247 u8 reg = 0; 248 249 if ((dev->class & 5) && cfg_base) 250 - printk(KERN_INFO "TRM290: chip"); 251 else { 252 cfg_base = 0x3df0; 253 - printk(KERN_INFO "TRM290: using default"); 254 } 255 printk(KERN_CONT " config base at 0x%04x\n", cfg_base); 256 hwif->config_data = cfg_base; ··· 327 }; 328 329 static const struct ide_port_info trm290_chipset __devinitdata = { 330 - .name = "TRM290", 331 .init_hwif = init_hwif_trm290, 332 .chipset = ide_trm290, 333 .port_ops = &trm290_port_ops, ··· 342 343 static int __devinit trm290_init_one(struct pci_dev *dev, const struct pci_device_id *id) 344 { 345 - return ide_setup_pci_device(dev, &trm290_chipset); 346 } 347 348 static const struct pci_device_id trm290_pci_tbl[] = { ··· 355 .name = "TRM290_IDE", 356 .id_table = trm290_pci_tbl, 357 .probe = trm290_init_one, 358 }; 359 360 static int __init trm290_ide_init(void) ··· 363 return ide_pci_register_driver(&driver); 364 } 365 366 module_init(trm290_ide_init); 367 368 MODULE_AUTHOR("Mark Lord"); 369 MODULE_DESCRIPTION("PCI driver module for Tekram TRM290 IDE");
··· 141 142 #include <asm/io.h> 143 144 + #define DRV_NAME "trm290" 145 + 146 static void trm290_prepare_drive (ide_drive_t *drive, unsigned int use_dma) 147 { 148 ide_hwif_t *hwif = HWIF(drive); ··· 245 u8 reg = 0; 246 247 if ((dev->class & 5) && cfg_base) 248 + printk(KERN_INFO DRV_NAME " %s: chip", pci_name(dev)); 249 else { 250 cfg_base = 0x3df0; 251 + printk(KERN_INFO DRV_NAME " %s: using default", pci_name(dev)); 252 } 253 printk(KERN_CONT " config base at 0x%04x\n", cfg_base); 254 hwif->config_data = cfg_base; ··· 325 }; 326 327 static const struct ide_port_info trm290_chipset __devinitdata = { 328 + .name = DRV_NAME, 329 .init_hwif = init_hwif_trm290, 330 .chipset = ide_trm290, 331 .port_ops = &trm290_port_ops, ··· 340 341 static int __devinit trm290_init_one(struct pci_dev *dev, const struct pci_device_id *id) 342 { 343 + return ide_pci_init_one(dev, &trm290_chipset, NULL); 344 } 345 346 static const struct pci_device_id trm290_pci_tbl[] = { ··· 353 .name = "TRM290_IDE", 354 .id_table = trm290_pci_tbl, 355 .probe = trm290_init_one, 356 + .remove = ide_pci_remove, 357 }; 358 359 static int __init trm290_ide_init(void) ··· 360 return ide_pci_register_driver(&driver); 361 } 362 363 + static void __exit trm290_ide_exit(void) 364 + { 365 + pci_unregister_driver(&driver); 366 + } 367 + 368 module_init(trm290_ide_init); 369 + module_exit(trm290_ide_exit); 370 371 MODULE_AUTHOR("Mark Lord"); 372 MODULE_DESCRIPTION("PCI driver module for Tekram TRM290 IDE");
+77 -62
drivers/ide/pci/via82cxxx.c
··· 35 #include <asm/processor.h> 36 #endif 37 38 #define VIA_IDE_ENABLE 0x40 39 #define VIA_IDE_CONFIG 0x41 40 #define VIA_FIFO_CONFIG 0x43 ··· 115 static void via_set_speed(ide_hwif_t *hwif, u8 dn, struct ide_timing *timing) 116 { 117 struct pci_dev *dev = to_pci_dev(hwif->dev); 118 - struct via82cxxx_dev *vdev = pci_get_drvdata(dev); 119 u8 t; 120 121 if (~vdev->via_config->flags & VIA_BAD_AST) { ··· 156 ide_hwif_t *hwif = drive->hwif; 157 ide_drive_t *peer = hwif->drives + (~drive->dn & 1); 158 struct pci_dev *dev = to_pci_dev(hwif->dev); 159 - struct via82cxxx_dev *vdev = pci_get_drvdata(dev); 160 struct ide_timing t, p; 161 unsigned int T, UT; 162 ··· 262 /** 263 * init_chipset_via82cxxx - initialization handler 264 * @dev: PCI device 265 - * @name: Name of interface 266 * 267 * The initialization callback. Here we determine the IDE chip type 268 * and initialize its drive independent registers. 269 */ 270 271 - static unsigned int __devinit init_chipset_via82cxxx(struct pci_dev *dev, const char *name) 272 { 273 - struct pci_dev *isa = NULL; 274 - struct via82cxxx_dev *vdev; 275 - struct via_isa_bridge *via_config; 276 u8 t, v; 277 u32 u; 278 - 279 - vdev = kzalloc(sizeof(*vdev), GFP_KERNEL); 280 - if (!vdev) { 281 - printk(KERN_ERR "VP_IDE: out of memory :(\n"); 282 - return -ENOMEM; 283 - } 284 - pci_set_drvdata(dev, vdev); 285 - 286 - /* 287 - * Find the ISA bridge to see how good the IDE is. 288 - */ 289 - vdev->via_config = via_config = via_config_find(&isa); 290 - 291 - /* We checked this earlier so if it fails here deeep badness 292 - is involved */ 293 - 294 - BUG_ON(!via_config->id); 295 296 /* 297 * Detect cable and configure Clk66 ··· 320 321 pci_write_config_byte(dev, VIA_FIFO_CONFIG, t); 322 323 - /* 324 - * Determine system bus clock. 325 - */ 326 - 327 - via_clock = (ide_pci_clk ? ide_pci_clk : 33) * 1000; 328 - 329 - switch (via_clock) { 330 - case 33000: via_clock = 33333; break; 331 - case 37000: via_clock = 37500; break; 332 - case 41000: via_clock = 41666; break; 333 - } 334 - 335 - if (via_clock < 20000 || via_clock > 50000) { 336 - printk(KERN_WARNING "VP_IDE: User given PCI clock speed " 337 - "impossible (%d), using 33 MHz instead.\n", via_clock); 338 - printk(KERN_WARNING "VP_IDE: Use ide0=ata66 if you want " 339 - "to assume 80-wire cable.\n"); 340 - via_clock = 33333; 341 - } 342 - 343 - /* 344 - * Print the boot message. 345 - */ 346 - 347 - printk(KERN_INFO "VP_IDE: VIA %s (rev %02x) IDE %sDMA%s " 348 - "controller on pci%s\n", 349 - via_config->name, isa->revision, 350 - via_config->udma_mask ? "U" : "MW", 351 - via_dma[via_config->udma_mask ? 352 - (fls(via_config->udma_mask) - 1) : 0], 353 - pci_name(dev)); 354 - 355 - pci_dev_put(isa); 356 return 0; 357 } 358 ··· 355 static u8 __devinit via82cxxx_cable_detect(ide_hwif_t *hwif) 356 { 357 struct pci_dev *pdev = to_pci_dev(hwif->dev); 358 - struct via82cxxx_dev *vdev = pci_get_drvdata(pdev); 359 360 if (via_cable_override(pdev)) 361 return ATA_CBL_PATA40_SHORT; ··· 374 }; 375 376 static const struct ide_port_info via82cxxx_chipset __devinitdata = { 377 - .name = "VP_IDE", 378 .init_chipset = init_chipset_via82cxxx, 379 .enablebits = { { 0x40, 0x02, 0x02 }, { 0x40, 0x01, 0x01 } }, 380 .port_ops = &via_port_ops, ··· 390 { 391 struct pci_dev *isa = NULL; 392 struct via_isa_bridge *via_config; 393 u8 idx = id->driver_data; 394 struct ide_port_info d; 395 ··· 401 * Find the ISA bridge and check we know what it is. 402 */ 403 via_config = via_config_find(&isa); 404 - pci_dev_put(isa); 405 if (!via_config->id) { 406 - printk(KERN_WARNING "VP_IDE: Unknown VIA SouthBridge, disabling DMA.\n"); 407 return -ENODEV; 408 } 409 410 if (idx == 0) ··· 452 453 d.udma_mask = via_config->udma_mask; 454 455 - return ide_setup_pci_device(dev, &d); 456 } 457 458 static const struct pci_device_id via_pci_tbl[] = { ··· 491 .name = "VIA_IDE", 492 .id_table = via_pci_tbl, 493 .probe = via_init_one, 494 }; 495 496 static int __init via_ide_init(void) ··· 499 return ide_pci_register_driver(&driver); 500 } 501 502 module_init(via_ide_init); 503 504 MODULE_AUTHOR("Vojtech Pavlik, Michel Aubry, Jeff Garzik, Andre Hedrick"); 505 MODULE_DESCRIPTION("PCI driver module for VIA IDE");
··· 35 #include <asm/processor.h> 36 #endif 37 38 + #define DRV_NAME "via82cxxx" 39 + 40 #define VIA_IDE_ENABLE 0x40 41 #define VIA_IDE_CONFIG 0x41 42 #define VIA_FIFO_CONFIG 0x43 ··· 113 static void via_set_speed(ide_hwif_t *hwif, u8 dn, struct ide_timing *timing) 114 { 115 struct pci_dev *dev = to_pci_dev(hwif->dev); 116 + struct ide_host *host = pci_get_drvdata(dev); 117 + struct via82cxxx_dev *vdev = host->host_priv; 118 u8 t; 119 120 if (~vdev->via_config->flags & VIA_BAD_AST) { ··· 153 ide_hwif_t *hwif = drive->hwif; 154 ide_drive_t *peer = hwif->drives + (~drive->dn & 1); 155 struct pci_dev *dev = to_pci_dev(hwif->dev); 156 + struct ide_host *host = pci_get_drvdata(dev); 157 + struct via82cxxx_dev *vdev = host->host_priv; 158 struct ide_timing t, p; 159 unsigned int T, UT; 160 ··· 258 /** 259 * init_chipset_via82cxxx - initialization handler 260 * @dev: PCI device 261 * 262 * The initialization callback. Here we determine the IDE chip type 263 * and initialize its drive independent registers. 264 */ 265 266 + static unsigned int __devinit init_chipset_via82cxxx(struct pci_dev *dev) 267 { 268 + struct ide_host *host = pci_get_drvdata(dev); 269 + struct via82cxxx_dev *vdev = host->host_priv; 270 + struct via_isa_bridge *via_config = vdev->via_config; 271 u8 t, v; 272 u32 u; 273 274 /* 275 * Detect cable and configure Clk66 ··· 334 335 pci_write_config_byte(dev, VIA_FIFO_CONFIG, t); 336 337 return 0; 338 } 339 ··· 402 static u8 __devinit via82cxxx_cable_detect(ide_hwif_t *hwif) 403 { 404 struct pci_dev *pdev = to_pci_dev(hwif->dev); 405 + struct ide_host *host = pci_get_drvdata(pdev); 406 + struct via82cxxx_dev *vdev = host->host_priv; 407 408 if (via_cable_override(pdev)) 409 return ATA_CBL_PATA40_SHORT; ··· 420 }; 421 422 static const struct ide_port_info via82cxxx_chipset __devinitdata = { 423 + .name = DRV_NAME, 424 .init_chipset = init_chipset_via82cxxx, 425 .enablebits = { { 0x40, 0x02, 0x02 }, { 0x40, 0x01, 0x01 } }, 426 .port_ops = &via_port_ops, ··· 436 { 437 struct pci_dev *isa = NULL; 438 struct via_isa_bridge *via_config; 439 + struct via82cxxx_dev *vdev; 440 + int rc; 441 u8 idx = id->driver_data; 442 struct ide_port_info d; 443 ··· 445 * Find the ISA bridge and check we know what it is. 446 */ 447 via_config = via_config_find(&isa); 448 if (!via_config->id) { 449 + printk(KERN_WARNING DRV_NAME " %s: unknown chipset, skipping\n", 450 + pci_name(dev)); 451 return -ENODEV; 452 + } 453 + 454 + /* 455 + * Print the boot message. 456 + */ 457 + printk(KERN_INFO DRV_NAME " %s: VIA %s (rev %02x) IDE %sDMA%s\n", 458 + pci_name(dev), via_config->name, isa->revision, 459 + via_config->udma_mask ? "U" : "MW", 460 + via_dma[via_config->udma_mask ? 461 + (fls(via_config->udma_mask) - 1) : 0]); 462 + 463 + pci_dev_put(isa); 464 + 465 + /* 466 + * Determine system bus clock. 467 + */ 468 + via_clock = (ide_pci_clk ? ide_pci_clk : 33) * 1000; 469 + 470 + switch (via_clock) { 471 + case 33000: via_clock = 33333; break; 472 + case 37000: via_clock = 37500; break; 473 + case 41000: via_clock = 41666; break; 474 + } 475 + 476 + if (via_clock < 20000 || via_clock > 50000) { 477 + printk(KERN_WARNING DRV_NAME ": User given PCI clock speed " 478 + "impossible (%d), using 33 MHz instead.\n", via_clock); 479 + printk(KERN_WARNING DRV_NAME ": Use ide0=ata66 if you want " 480 + "to assume 80-wire cable.\n"); 481 + via_clock = 33333; 482 } 483 484 if (idx == 0) ··· 466 467 d.udma_mask = via_config->udma_mask; 468 469 + vdev = kzalloc(sizeof(*vdev), GFP_KERNEL); 470 + if (!vdev) { 471 + printk(KERN_ERR DRV_NAME " %s: out of memory :(\n", 472 + pci_name(dev)); 473 + return -ENOMEM; 474 + } 475 + 476 + vdev->via_config = via_config; 477 + 478 + rc = ide_pci_init_one(dev, &d, vdev); 479 + if (rc) 480 + kfree(vdev); 481 + 482 + return rc; 483 + } 484 + 485 + static void __devexit via_remove(struct pci_dev *dev) 486 + { 487 + struct ide_host *host = pci_get_drvdata(dev); 488 + struct via82cxxx_dev *vdev = host->host_priv; 489 + 490 + ide_pci_remove(dev); 491 + kfree(vdev); 492 } 493 494 static const struct pci_device_id via_pci_tbl[] = { ··· 483 .name = "VIA_IDE", 484 .id_table = via_pci_tbl, 485 .probe = via_init_one, 486 + .remove = via_remove, 487 }; 488 489 static int __init via_ide_init(void) ··· 490 return ide_pci_register_driver(&driver); 491 } 492 493 + static void __exit via_ide_exit(void) 494 + { 495 + pci_unregister_driver(&driver); 496 + } 497 + 498 module_init(via_ide_init); 499 + module_exit(via_ide_exit); 500 501 MODULE_AUTHOR("Vojtech Pavlik, Michel Aubry, Jeff Garzik, Andre Hedrick"); 502 MODULE_DESCRIPTION("PCI driver module for VIA IDE");
+158 -82
drivers/ide/setup-pci.c
··· 39 if (pci_read_config_byte(dev, PCI_CLASS_PROG, &progif) || 40 (progif & 5) != 5) { 41 if ((progif & 0xa) != 0xa) { 42 - printk(KERN_INFO "%s: device not capable of full " 43 - "native PCI mode\n", name); 44 return -EOPNOTSUPP; 45 } 46 - printk("%s: placing both ports into native PCI mode\n", name); 47 (void) pci_write_config_byte(dev, PCI_CLASS_PROG, progif|5); 48 if (pci_read_config_byte(dev, PCI_CLASS_PROG, &progif) || 49 (progif & 5) != 5) { 50 - printk(KERN_ERR "%s: rewrite of PROGIF failed, wanted " 51 - "0x%04x, got 0x%04x\n", 52 - name, progif|5, progif); 53 return -EOPNOTSUPP; 54 } 55 } ··· 58 } 59 60 #ifdef CONFIG_BLK_DEV_IDEDMA_PCI 61 - static void ide_pci_clear_simplex(unsigned long dma_base, const char *name) 62 { 63 u8 dma_stat = inb(dma_base + 2); 64 65 outb(dma_stat & 0x60, dma_base + 2); 66 dma_stat = inb(dma_base + 2); 67 - if (dma_stat & 0x80) 68 - printk(KERN_INFO "%s: simplex device: DMA forced\n", name); 69 } 70 71 /** ··· 92 dma_base = pci_resource_start(dev, baridx); 93 94 if (dma_base == 0) { 95 - printk(KERN_ERR "%s: DMA base is invalid\n", d->name); 96 return 0; 97 } 98 } ··· 107 108 int ide_pci_check_simplex(ide_hwif_t *hwif, const struct ide_port_info *d) 109 { 110 u8 dma_stat; 111 112 if (d->host_flags & (IDE_HFLAG_MMIO | IDE_HFLAG_CS5520)) 113 goto out; 114 115 if (d->host_flags & IDE_HFLAG_CLEAR_SIMPLEX) { 116 - ide_pci_clear_simplex(hwif->dma_base, d->name); 117 goto out; 118 } 119 ··· 132 */ 133 dma_stat = hwif->tp_ops->read_sff_dma_status(hwif); 134 if ((dma_stat & 0x80) && hwif->mate && hwif->mate->dma_base) { 135 - printk(KERN_INFO "%s: simplex device: DMA disabled\n", d->name); 136 return -1; 137 } 138 out: ··· 155 156 if (pci_read_config_word(dev, PCI_COMMAND, &pcicmd) || 157 (pcicmd & PCI_COMMAND_MASTER) == 0) { 158 - printk(KERN_ERR "%s: error updating PCICMD on %s\n", 159 - name, pci_name(dev)); 160 return -EIO; 161 } 162 } ··· 168 169 void ide_setup_pci_noise(struct pci_dev *dev, const struct ide_port_info *d) 170 { 171 - printk(KERN_INFO "%s: IDE controller (0x%04x:0x%04x rev 0x%02x) at " 172 - " PCI slot %s\n", d->name, dev->vendor, dev->device, 173 - dev->revision, pci_name(dev)); 174 } 175 EXPORT_SYMBOL_GPL(ide_setup_pci_noise); 176 ··· 195 if (pci_enable_device(dev)) { 196 ret = pci_enable_device_io(dev); 197 if (ret < 0) { 198 - printk(KERN_WARNING "%s: (ide_setup_pci_device:) " 199 - "Could not enable device.\n", d->name); 200 goto out; 201 } 202 - printk(KERN_WARNING "%s: BIOS configuration fixed.\n", d->name); 203 } 204 205 /* ··· 210 */ 211 ret = pci_set_dma_mask(dev, DMA_32BIT_MASK); 212 if (ret < 0) { 213 - printk(KERN_ERR "%s: can't set dma mask\n", d->name); 214 goto out; 215 } 216 ··· 229 230 ret = pci_request_selected_regions(dev, bars, d->name); 231 if (ret < 0) 232 - printk(KERN_ERR "%s: can't reserve resources\n", d->name); 233 out: 234 return ret; 235 } ··· 256 */ 257 if (ide_setup_pci_baseregs(dev, d->name) || 258 pci_write_config_word(dev, PCI_COMMAND, pcicmd | PCI_COMMAND_IO)) { 259 - printk(KERN_INFO "%s: device disabled (BIOS)\n", d->name); 260 return -ENODEV; 261 } 262 if (pci_read_config_word(dev, PCI_COMMAND, &pcicmd)) { 263 - printk(KERN_ERR "%s: error accessing PCI regs\n", d->name); 264 return -EIO; 265 } 266 if (!(pcicmd & PCI_COMMAND_IO)) { 267 - printk(KERN_ERR "%s: unable to enable IDE controller\n", d->name); 268 return -ENXIO; 269 } 270 return 0; ··· 323 if ((d->host_flags & IDE_HFLAG_ISA_PORTS) == 0) { 324 if (ide_pci_check_iomem(dev, d, 2 * port) || 325 ide_pci_check_iomem(dev, d, 2 * port + 1)) { 326 - printk(KERN_ERR "%s: I/O baseregs (BIOS) are reported " 327 - "as MEM for port %d!\n", d->name, port); 328 return -EINVAL; 329 } 330 ··· 338 } 339 340 if (!base || !ctl) { 341 - printk(KERN_ERR "%s: bad PCI BARs for port %d, skipping\n", 342 - d->name, port); 343 return -EINVAL; 344 } 345 ··· 406 * @dev: PCI device 407 * @d: IDE port info 408 * @noisy: verbose flag 409 - * @config: returned as 1 if we configured the hardware 410 * 411 * Set up the PCI and controller side of the IDE interface. This brings 412 * up the PCI side of the device, checks that the device is enabled 413 * and enables it if need be 414 */ 415 416 - static int ide_setup_pci_controller(struct pci_dev *dev, const struct ide_port_info *d, int noisy, int *config) 417 { 418 int ret; 419 u16 pcicmd; ··· 427 428 ret = pci_read_config_word(dev, PCI_COMMAND, &pcicmd); 429 if (ret < 0) { 430 - printk(KERN_ERR "%s: error accessing PCI regs\n", d->name); 431 goto out; 432 } 433 if (!(pcicmd & PCI_COMMAND_IO)) { /* is device disabled? */ 434 ret = ide_pci_configure(dev, d); 435 if (ret < 0) 436 goto out; 437 - *config = 1; 438 - printk(KERN_INFO "%s: device enabled (Linux)\n", d->name); 439 } 440 441 out: ··· 475 476 if (e->reg && (pci_read_config_byte(dev, e->reg, &tmp) || 477 (tmp & e->mask) != e->val)) { 478 - printk(KERN_INFO "%s: IDE port disabled\n", d->name); 479 continue; /* port not enabled */ 480 } 481 ··· 502 const struct ide_port_info *d, 503 u8 noisy) 504 { 505 - int tried_config = 0; 506 int pciirq, ret; 507 - 508 - ret = ide_setup_pci_controller(dev, d, noisy, &tried_config); 509 - if (ret < 0) 510 - goto out; 511 512 /* 513 * Can we trust the reported IRQ? 514 */ 515 pciirq = dev->irq; 516 517 /* Is it an "IDE storage" device in non-PCI mode? */ 518 if ((dev->class >> 8) == PCI_CLASS_STORAGE_IDE && (dev->class & 5) != 5) { 519 if (noisy) 520 - printk(KERN_INFO "%s: not 100%% native mode: " 521 - "will probe irqs later\n", d->name); 522 - /* 523 - * This allows offboard ide-pci cards the enable a BIOS, 524 - * verify interrupt settings of split-mirror pci-config 525 - * space, place chipset into init-mode, and/or preserve 526 - * an interrupt if the card is not native ide support. 527 - */ 528 - ret = d->init_chipset ? d->init_chipset(dev, d->name) : 0; 529 - if (ret < 0) 530 - goto out; 531 pciirq = ret; 532 - } else if (tried_config) { 533 - if (noisy) 534 - printk(KERN_INFO "%s: will probe irqs later\n", d->name); 535 - pciirq = 0; 536 - } else if (!pciirq) { 537 - if (noisy) 538 - printk(KERN_WARNING "%s: bad irq (%d): will probe later\n", 539 - d->name, pciirq); 540 - pciirq = 0; 541 - } else { 542 - if (d->init_chipset) { 543 - ret = d->init_chipset(dev, d->name); 544 - if (ret < 0) 545 - goto out; 546 - } 547 - if (noisy) 548 - printk(KERN_INFO "%s: 100%% native mode on irq %d\n", 549 - d->name, pciirq); 550 } 551 552 ret = pciirq; ··· 538 return ret; 539 } 540 541 - int ide_setup_pci_device(struct pci_dev *dev, const struct ide_port_info *d) 542 { 543 hw_regs_t hw[4], *hws[] = { NULL, NULL, NULL, NULL }; 544 int ret; 545 546 - ret = do_ide_setup_pci_device(dev, d, 1); 547 548 - if (ret >= 0) { 549 - /* FIXME: silent failure can happen */ 550 - ide_pci_setup_ports(dev, d, ret, &hw[0], &hws[0]); 551 552 - ret = ide_host_add(d, hws, NULL); 553 } 554 555 return ret; 556 } 557 - EXPORT_SYMBOL_GPL(ide_setup_pci_device); 558 559 - int ide_setup_pci_devices(struct pci_dev *dev1, struct pci_dev *dev2, 560 - const struct ide_port_info *d) 561 { 562 struct pci_dev *pdev[] = { dev1, dev2 }; 563 int ret, i; 564 hw_regs_t hw[4], *hws[] = { NULL, NULL, NULL, NULL }; 565 566 for (i = 0; i < 2; i++) { 567 ret = do_ide_setup_pci_device(pdev[i], d, !i); ··· 618 if (ret < 0) 619 goto out; 620 621 - /* FIXME: silent failure can happen */ 622 - ide_pci_setup_ports(pdev[i], d, ret, &hw[i*2], &hws[i*2]); 623 } 624 625 - ret = ide_host_add(d, hws, NULL); 626 out: 627 return ret; 628 } 629 - EXPORT_SYMBOL_GPL(ide_setup_pci_devices);
··· 39 if (pci_read_config_byte(dev, PCI_CLASS_PROG, &progif) || 40 (progif & 5) != 5) { 41 if ((progif & 0xa) != 0xa) { 42 + printk(KERN_INFO "%s %s: device not capable of full " 43 + "native PCI mode\n", name, pci_name(dev)); 44 return -EOPNOTSUPP; 45 } 46 + printk(KERN_INFO "%s %s: placing both ports into native PCI " 47 + "mode\n", name, pci_name(dev)); 48 (void) pci_write_config_byte(dev, PCI_CLASS_PROG, progif|5); 49 if (pci_read_config_byte(dev, PCI_CLASS_PROG, &progif) || 50 (progif & 5) != 5) { 51 + printk(KERN_ERR "%s %s: rewrite of PROGIF failed, " 52 + "wanted 0x%04x, got 0x%04x\n", 53 + name, pci_name(dev), progif | 5, progif); 54 return -EOPNOTSUPP; 55 } 56 } ··· 57 } 58 59 #ifdef CONFIG_BLK_DEV_IDEDMA_PCI 60 + static int ide_pci_clear_simplex(unsigned long dma_base, const char *name) 61 { 62 u8 dma_stat = inb(dma_base + 2); 63 64 outb(dma_stat & 0x60, dma_base + 2); 65 dma_stat = inb(dma_base + 2); 66 + 67 + return (dma_stat & 0x80) ? 1 : 0; 68 } 69 70 /** ··· 91 dma_base = pci_resource_start(dev, baridx); 92 93 if (dma_base == 0) { 94 + printk(KERN_ERR "%s %s: DMA base is invalid\n", 95 + d->name, pci_name(dev)); 96 return 0; 97 } 98 } ··· 105 106 int ide_pci_check_simplex(ide_hwif_t *hwif, const struct ide_port_info *d) 107 { 108 + struct pci_dev *dev = to_pci_dev(hwif->dev); 109 u8 dma_stat; 110 111 if (d->host_flags & (IDE_HFLAG_MMIO | IDE_HFLAG_CS5520)) 112 goto out; 113 114 if (d->host_flags & IDE_HFLAG_CLEAR_SIMPLEX) { 115 + if (ide_pci_clear_simplex(hwif->dma_base, d->name)) 116 + printk(KERN_INFO "%s %s: simplex device: DMA forced\n", 117 + d->name, pci_name(dev)); 118 goto out; 119 } 120 ··· 127 */ 128 dma_stat = hwif->tp_ops->read_sff_dma_status(hwif); 129 if ((dma_stat & 0x80) && hwif->mate && hwif->mate->dma_base) { 130 + printk(KERN_INFO "%s %s: simplex device: DMA disabled\n", 131 + d->name, pci_name(dev)); 132 return -1; 133 } 134 out: ··· 149 150 if (pci_read_config_word(dev, PCI_COMMAND, &pcicmd) || 151 (pcicmd & PCI_COMMAND_MASTER) == 0) { 152 + printk(KERN_ERR "%s %s: error updating PCICMD\n", 153 + name, pci_name(dev)); 154 return -EIO; 155 } 156 } ··· 162 163 void ide_setup_pci_noise(struct pci_dev *dev, const struct ide_port_info *d) 164 { 165 + printk(KERN_INFO "%s %s: IDE controller (0x%04x:0x%04x rev 0x%02x)\n", 166 + d->name, pci_name(dev), 167 + dev->vendor, dev->device, dev->revision); 168 } 169 EXPORT_SYMBOL_GPL(ide_setup_pci_noise); 170 ··· 189 if (pci_enable_device(dev)) { 190 ret = pci_enable_device_io(dev); 191 if (ret < 0) { 192 + printk(KERN_WARNING "%s %s: couldn't enable device\n", 193 + d->name, pci_name(dev)); 194 goto out; 195 } 196 + printk(KERN_WARNING "%s %s: BIOS configuration fixed\n", 197 + d->name, pci_name(dev)); 198 } 199 200 /* ··· 203 */ 204 ret = pci_set_dma_mask(dev, DMA_32BIT_MASK); 205 if (ret < 0) { 206 + printk(KERN_ERR "%s %s: can't set DMA mask\n", 207 + d->name, pci_name(dev)); 208 goto out; 209 } 210 ··· 221 222 ret = pci_request_selected_regions(dev, bars, d->name); 223 if (ret < 0) 224 + printk(KERN_ERR "%s %s: can't reserve resources\n", 225 + d->name, pci_name(dev)); 226 out: 227 return ret; 228 } ··· 247 */ 248 if (ide_setup_pci_baseregs(dev, d->name) || 249 pci_write_config_word(dev, PCI_COMMAND, pcicmd | PCI_COMMAND_IO)) { 250 + printk(KERN_INFO "%s %s: device disabled (BIOS)\n", 251 + d->name, pci_name(dev)); 252 return -ENODEV; 253 } 254 if (pci_read_config_word(dev, PCI_COMMAND, &pcicmd)) { 255 + printk(KERN_ERR "%s %s: error accessing PCI regs\n", 256 + d->name, pci_name(dev)); 257 return -EIO; 258 } 259 if (!(pcicmd & PCI_COMMAND_IO)) { 260 + printk(KERN_ERR "%s %s: unable to enable IDE controller\n", 261 + d->name, pci_name(dev)); 262 return -ENXIO; 263 } 264 return 0; ··· 311 if ((d->host_flags & IDE_HFLAG_ISA_PORTS) == 0) { 312 if (ide_pci_check_iomem(dev, d, 2 * port) || 313 ide_pci_check_iomem(dev, d, 2 * port + 1)) { 314 + printk(KERN_ERR "%s %s: I/O baseregs (BIOS) are " 315 + "reported as MEM for port %d!\n", 316 + d->name, pci_name(dev), port); 317 return -EINVAL; 318 } 319 ··· 325 } 326 327 if (!base || !ctl) { 328 + printk(KERN_ERR "%s %s: bad PCI BARs for port %d, skipping\n", 329 + d->name, pci_name(dev), port); 330 return -EINVAL; 331 } 332 ··· 393 * @dev: PCI device 394 * @d: IDE port info 395 * @noisy: verbose flag 396 * 397 * Set up the PCI and controller side of the IDE interface. This brings 398 * up the PCI side of the device, checks that the device is enabled 399 * and enables it if need be 400 */ 401 402 + static int ide_setup_pci_controller(struct pci_dev *dev, 403 + const struct ide_port_info *d, int noisy) 404 { 405 int ret; 406 u16 pcicmd; ··· 414 415 ret = pci_read_config_word(dev, PCI_COMMAND, &pcicmd); 416 if (ret < 0) { 417 + printk(KERN_ERR "%s %s: error accessing PCI regs\n", 418 + d->name, pci_name(dev)); 419 goto out; 420 } 421 if (!(pcicmd & PCI_COMMAND_IO)) { /* is device disabled? */ 422 ret = ide_pci_configure(dev, d); 423 if (ret < 0) 424 goto out; 425 + printk(KERN_INFO "%s %s: device enabled (Linux)\n", 426 + d->name, pci_name(dev)); 427 } 428 429 out: ··· 461 462 if (e->reg && (pci_read_config_byte(dev, e->reg, &tmp) || 463 (tmp & e->mask) != e->val)) { 464 + printk(KERN_INFO "%s %s: IDE port disabled\n", 465 + d->name, pci_name(dev)); 466 continue; /* port not enabled */ 467 } 468 ··· 487 const struct ide_port_info *d, 488 u8 noisy) 489 { 490 int pciirq, ret; 491 492 /* 493 * Can we trust the reported IRQ? 494 */ 495 pciirq = dev->irq; 496 497 + /* 498 + * This allows offboard ide-pci cards the enable a BIOS, 499 + * verify interrupt settings of split-mirror pci-config 500 + * space, place chipset into init-mode, and/or preserve 501 + * an interrupt if the card is not native ide support. 502 + */ 503 + ret = d->init_chipset ? d->init_chipset(dev) : 0; 504 + if (ret < 0) 505 + goto out; 506 + 507 /* Is it an "IDE storage" device in non-PCI mode? */ 508 if ((dev->class >> 8) == PCI_CLASS_STORAGE_IDE && (dev->class & 5) != 5) { 509 if (noisy) 510 + printk(KERN_INFO "%s %s: not 100%% native mode: will " 511 + "probe irqs later\n", d->name, pci_name(dev)); 512 pciirq = ret; 513 + } else if (!pciirq && noisy) { 514 + printk(KERN_WARNING "%s %s: bad irq (%d): will probe later\n", 515 + d->name, pci_name(dev), pciirq); 516 + } else if (noisy) { 517 + printk(KERN_INFO "%s %s: 100%% native mode on irq %d\n", 518 + d->name, pci_name(dev), pciirq); 519 } 520 521 ret = pciirq; ··· 539 return ret; 540 } 541 542 + int ide_pci_init_one(struct pci_dev *dev, const struct ide_port_info *d, 543 + void *priv) 544 { 545 + struct ide_host *host; 546 hw_regs_t hw[4], *hws[] = { NULL, NULL, NULL, NULL }; 547 int ret; 548 549 + ret = ide_setup_pci_controller(dev, d, 1); 550 + if (ret < 0) 551 + goto out; 552 553 + ide_pci_setup_ports(dev, d, 0, &hw[0], &hws[0]); 554 555 + host = ide_host_alloc(d, hws); 556 + if (host == NULL) { 557 + ret = -ENOMEM; 558 + goto out; 559 } 560 561 + host->dev[0] = &dev->dev; 562 + 563 + host->host_priv = priv; 564 + 565 + pci_set_drvdata(dev, host); 566 + 567 + ret = do_ide_setup_pci_device(dev, d, 1); 568 + if (ret < 0) 569 + goto out; 570 + 571 + /* fixup IRQ */ 572 + hw[1].irq = hw[0].irq = ret; 573 + 574 + ret = ide_host_register(host, d, hws); 575 + if (ret) 576 + ide_host_free(host); 577 + out: 578 return ret; 579 } 580 + EXPORT_SYMBOL_GPL(ide_pci_init_one); 581 582 + int ide_pci_init_two(struct pci_dev *dev1, struct pci_dev *dev2, 583 + const struct ide_port_info *d, void *priv) 584 { 585 struct pci_dev *pdev[] = { dev1, dev2 }; 586 + struct ide_host *host; 587 int ret, i; 588 hw_regs_t hw[4], *hws[] = { NULL, NULL, NULL, NULL }; 589 + 590 + for (i = 0; i < 2; i++) { 591 + ret = ide_setup_pci_controller(pdev[i], d, !i); 592 + if (ret < 0) 593 + goto out; 594 + 595 + ide_pci_setup_ports(pdev[i], d, 0, &hw[i*2], &hws[i*2]); 596 + } 597 + 598 + host = ide_host_alloc(d, hws); 599 + if (host == NULL) { 600 + ret = -ENOMEM; 601 + goto out; 602 + } 603 + 604 + host->dev[0] = &dev1->dev; 605 + host->dev[1] = &dev2->dev; 606 + 607 + host->host_priv = priv; 608 + 609 + pci_set_drvdata(pdev[0], host); 610 + pci_set_drvdata(pdev[1], host); 611 612 for (i = 0; i < 2; i++) { 613 ret = do_ide_setup_pci_device(pdev[i], d, !i); ··· 574 if (ret < 0) 575 goto out; 576 577 + /* fixup IRQ */ 578 + hw[i*2 + 1].irq = hw[i*2].irq = ret; 579 } 580 581 + ret = ide_host_register(host, d, hws); 582 + if (ret) 583 + ide_host_free(host); 584 out: 585 return ret; 586 } 587 + EXPORT_SYMBOL_GPL(ide_pci_init_two); 588 + 589 + void ide_pci_remove(struct pci_dev *dev) 590 + { 591 + struct ide_host *host = pci_get_drvdata(dev); 592 + struct pci_dev *dev2 = host->dev[1] ? to_pci_dev(host->dev[1]) : NULL; 593 + int bars; 594 + 595 + if (host->host_flags & IDE_HFLAG_SINGLE) 596 + bars = (1 << 2) - 1; 597 + else 598 + bars = (1 << 4) - 1; 599 + 600 + if ((host->host_flags & IDE_HFLAG_NO_DMA) == 0) { 601 + if (host->host_flags & IDE_HFLAG_CS5520) 602 + bars |= (1 << 2); 603 + else 604 + bars |= (1 << 4); 605 + } 606 + 607 + ide_host_remove(host); 608 + 609 + if (dev2) 610 + pci_release_selected_regions(dev2, bars); 611 + pci_release_selected_regions(dev, bars); 612 + 613 + if (dev2) 614 + pci_disable_device(dev2); 615 + pci_disable_device(dev); 616 + } 617 + EXPORT_SYMBOL_GPL(ide_pci_remove);
+22 -11
drivers/scsi/ide-scsi.c
··· 101 102 mutex_lock(&idescsi_ref_mutex); 103 scsi = ide_scsi_g(disk); 104 - if (scsi) 105 scsi_host_get(scsi->host); 106 mutex_unlock(&idescsi_ref_mutex); 107 return scsi; 108 } ··· 115 static void ide_scsi_put(struct ide_scsi_obj *scsi) 116 { 117 mutex_lock(&idescsi_ref_mutex); 118 scsi_host_put(scsi->host); 119 mutex_unlock(&idescsi_ref_mutex); 120 } ··· 207 208 /* stuff a sense request in front of our current request */ 209 pc = kzalloc(sizeof(struct ide_atapi_pc), GFP_ATOMIC); 210 - rq = kmalloc(sizeof(struct request), GFP_ATOMIC); 211 buf = kzalloc(SCSI_SENSE_BUFFERSIZE, GFP_ATOMIC); 212 if (!pc || !rq || !buf) { 213 kfree(buf); 214 - kfree(rq); 215 kfree(pc); 216 return -ENOMEM; 217 } 218 - blk_rq_init(NULL, rq); 219 rq->special = (char *) pc; 220 pc->rq = rq; 221 pc->buf = buf; ··· 232 ide_scsi_hex_dump(pc->c, 6); 233 } 234 rq->rq_disk = scsi->disk; 235 memcpy(rq->cmd, pc->c, 12); 236 ide_do_drive_cmd(drive, rq); 237 return 0; ··· 279 SCSI_SENSE_BUFFERSIZE); 280 kfree(pc->buf); 281 kfree(pc); 282 - kfree(rq); 283 pc = opc; 284 rq = pc->rq; 285 pc->scsi_cmd->result = (CHECK_CONDITION << 1) | ··· 310 pc->done(pc->scsi_cmd); 311 spin_unlock_irqrestore(host->host_lock, flags); 312 kfree(pc); 313 - kfree(rq); 314 scsi->pc = NULL; 315 return 0; 316 } ··· 584 ide_drive_t *drive = scsi->drive; 585 struct request *rq = NULL; 586 struct ide_atapi_pc *pc = NULL; 587 588 if (!drive) { 589 scmd_printk (KERN_ERR, cmd, "drive not present\n"); ··· 592 } 593 scsi = drive_to_idescsi(drive); 594 pc = kmalloc(sizeof(struct ide_atapi_pc), GFP_ATOMIC); 595 - rq = kmalloc(sizeof(struct request), GFP_ATOMIC); 596 if (rq == NULL || pc == NULL) { 597 printk (KERN_ERR "ide-scsi: %s: out of memory\n", drive->name); 598 goto abort; ··· 622 } 623 } 624 625 - blk_rq_init(NULL, rq); 626 rq->special = (char *) pc; 627 rq->cmd_type = REQ_TYPE_SPECIAL; 628 spin_unlock_irq(host->host_lock); 629 memcpy(rq->cmd, pc->c, 12); 630 blk_execute_rq_nowait(drive->queue, scsi->disk, rq, 0, NULL); 631 spin_lock_irq(host->host_lock); 632 return 0; 633 abort: 634 kfree (pc); 635 - kfree (rq); 636 cmd->result = DID_ERROR << 16; 637 done(cmd); 638 return 0; ··· 681 682 if (blk_sense_request(scsi->pc->rq)) 683 kfree(scsi->pc->buf); 684 - kfree(scsi->pc->rq); 685 kfree(scsi->pc); 686 scsi->pc = NULL; 687 ··· 735 kfree(scsi->pc->buf); 736 kfree(scsi->pc); 737 scsi->pc = NULL; 738 - kfree(req); 739 740 /* now nuke the drive queue */ 741 while ((req = elv_next_request(drive->queue))) {
··· 101 102 mutex_lock(&idescsi_ref_mutex); 103 scsi = ide_scsi_g(disk); 104 + if (scsi) { 105 scsi_host_get(scsi->host); 106 + if (ide_device_get(scsi->drive)) { 107 + scsi_host_put(scsi->host); 108 + scsi = NULL; 109 + } 110 + } 111 mutex_unlock(&idescsi_ref_mutex); 112 return scsi; 113 } ··· 110 static void ide_scsi_put(struct ide_scsi_obj *scsi) 111 { 112 mutex_lock(&idescsi_ref_mutex); 113 + ide_device_put(scsi->drive); 114 scsi_host_put(scsi->host); 115 mutex_unlock(&idescsi_ref_mutex); 116 } ··· 201 202 /* stuff a sense request in front of our current request */ 203 pc = kzalloc(sizeof(struct ide_atapi_pc), GFP_ATOMIC); 204 + rq = blk_get_request(drive->queue, READ, GFP_ATOMIC); 205 buf = kzalloc(SCSI_SENSE_BUFFERSIZE, GFP_ATOMIC); 206 if (!pc || !rq || !buf) { 207 kfree(buf); 208 + if (rq) 209 + blk_put_request(rq); 210 kfree(pc); 211 return -ENOMEM; 212 } 213 rq->special = (char *) pc; 214 pc->rq = rq; 215 pc->buf = buf; ··· 226 ide_scsi_hex_dump(pc->c, 6); 227 } 228 rq->rq_disk = scsi->disk; 229 + rq->ref_count++; 230 memcpy(rq->cmd, pc->c, 12); 231 ide_do_drive_cmd(drive, rq); 232 return 0; ··· 272 SCSI_SENSE_BUFFERSIZE); 273 kfree(pc->buf); 274 kfree(pc); 275 + blk_put_request(rq); 276 pc = opc; 277 rq = pc->rq; 278 pc->scsi_cmd->result = (CHECK_CONDITION << 1) | ··· 303 pc->done(pc->scsi_cmd); 304 spin_unlock_irqrestore(host->host_lock, flags); 305 kfree(pc); 306 + blk_put_request(rq); 307 scsi->pc = NULL; 308 return 0; 309 } ··· 577 ide_drive_t *drive = scsi->drive; 578 struct request *rq = NULL; 579 struct ide_atapi_pc *pc = NULL; 580 + int write = cmd->sc_data_direction == DMA_TO_DEVICE; 581 582 if (!drive) { 583 scmd_printk (KERN_ERR, cmd, "drive not present\n"); ··· 584 } 585 scsi = drive_to_idescsi(drive); 586 pc = kmalloc(sizeof(struct ide_atapi_pc), GFP_ATOMIC); 587 + rq = blk_get_request(drive->queue, write, GFP_ATOMIC); 588 if (rq == NULL || pc == NULL) { 589 printk (KERN_ERR "ide-scsi: %s: out of memory\n", drive->name); 590 goto abort; ··· 614 } 615 } 616 617 rq->special = (char *) pc; 618 rq->cmd_type = REQ_TYPE_SPECIAL; 619 spin_unlock_irq(host->host_lock); 620 + rq->ref_count++; 621 memcpy(rq->cmd, pc->c, 12); 622 blk_execute_rq_nowait(drive->queue, scsi->disk, rq, 0, NULL); 623 spin_lock_irq(host->host_lock); 624 return 0; 625 abort: 626 kfree (pc); 627 + if (rq) 628 + blk_put_request(rq); 629 cmd->result = DID_ERROR << 16; 630 done(cmd); 631 return 0; ··· 672 673 if (blk_sense_request(scsi->pc->rq)) 674 kfree(scsi->pc->buf); 675 + /* we need to call blk_put_request twice. */ 676 + blk_put_request(scsi->pc->rq); 677 + blk_put_request(scsi->pc->rq); 678 kfree(scsi->pc); 679 scsi->pc = NULL; 680 ··· 724 kfree(scsi->pc->buf); 725 kfree(scsi->pc); 726 scsi->pc = NULL; 727 + blk_put_request(req); 728 729 /* now nuke the drive queue */ 730 while ((req = elv_next_request(drive->queue))) {
-44
include/asm-alpha/ide.h
··· 1 - /* 2 - * linux/include/asm-alpha/ide.h 3 - * 4 - * Copyright (C) 1994-1996 Linus Torvalds & authors 5 - */ 6 - 7 - /* 8 - * This file contains the alpha architecture specific IDE code. 9 - */ 10 - 11 - #ifndef __ASMalpha_IDE_H 12 - #define __ASMalpha_IDE_H 13 - 14 - #ifdef __KERNEL__ 15 - 16 - static inline int ide_default_irq(unsigned long base) 17 - { 18 - switch (base) { 19 - case 0x1f0: return 14; 20 - case 0x170: return 15; 21 - case 0x1e8: return 11; 22 - case 0x168: return 10; 23 - default: 24 - return 0; 25 - } 26 - } 27 - 28 - static inline unsigned long ide_default_io_base(int index) 29 - { 30 - switch (index) { 31 - case 0: return 0x1f0; 32 - case 1: return 0x170; 33 - case 2: return 0x1e8; 34 - case 3: return 0x168; 35 - default: 36 - return 0; 37 - } 38 - } 39 - 40 - #include <asm-generic/ide_iops.h> 41 - 42 - #endif /* __KERNEL__ */ 43 - 44 - #endif /* __ASMalpha_IDE_H */
···
-4
include/asm-arm/ide.h
··· 13 14 #ifdef __KERNEL__ 15 16 - #ifndef MAX_HWIFS 17 - #define MAX_HWIFS 4 18 - #endif 19 - 20 #define __ide_mm_insw(port,addr,len) readsw(port,addr,len) 21 #define __ide_mm_insl(port,addr,len) readsl(port,addr,len) 22 #define __ide_mm_outsw(port,addr,len) writesw(port,addr,len)
··· 13 14 #ifdef __KERNEL__ 15 16 #define __ide_mm_insw(port,addr,len) readsw(port,addr,len) 17 #define __ide_mm_insl(port,addr,len) readsl(port,addr,len) 18 #define __ide_mm_outsw(port,addr,len) writesw(port,addr,len)
-27
include/asm-blackfin/ide.h
··· 1 - /****************************************************************************/ 2 - 3 - /* 4 - * linux/include/asm-blackfin/ide.h 5 - * 6 - * Copyright (C) 1994-1996 Linus Torvalds & authors 7 - * Copyright (C) 2001 Lineo Inc., davidm@snapgear.com 8 - * Copyright (C) 2002 Greg Ungerer (gerg@snapgear.com) 9 - * Copyright (C) 2002 Yoshinori Sato (ysato@users.sourceforge.jp) 10 - * Copyright (C) 2005 Hennerich Michael (hennerich@blackfin.uclinux.org) 11 - */ 12 - 13 - /****************************************************************************/ 14 - #ifndef _BLACKFIN_IDE_H 15 - #define _BLACKFIN_IDE_H 16 - /****************************************************************************/ 17 - #ifdef __KERNEL__ 18 - /****************************************************************************/ 19 - 20 - #define MAX_HWIFS 1 21 - 22 - #include <asm-generic/ide_iops.h> 23 - 24 - /****************************************************************************/ 25 - #endif /* __KERNEL__ */ 26 - #endif /* _BLACKFIN_IDE_H */ 27 - /****************************************************************************/
···
-91
include/asm-cris/arch-v10/ide.h
··· 1 - /* 2 - * linux/include/asm-cris/ide.h 3 - * 4 - * Copyright (C) 2000, 2001, 2002 Axis Communications AB 5 - * 6 - * Authors: Bjorn Wesen 7 - * 8 - */ 9 - 10 - /* 11 - * This file contains the ETRAX 100LX specific IDE code. 12 - */ 13 - 14 - #ifndef __ASMCRIS_IDE_H 15 - #define __ASMCRIS_IDE_H 16 - 17 - #ifdef __KERNEL__ 18 - 19 - #include <asm/arch/svinto.h> 20 - #include <asm/io.h> 21 - #include <asm-generic/ide_iops.h> 22 - 23 - 24 - /* ETRAX 100 can support 4 IDE busses on the same pins (serialized) */ 25 - 26 - #define MAX_HWIFS 4 27 - 28 - static inline int ide_default_irq(unsigned long base) 29 - { 30 - /* all IDE busses share the same IRQ, number 4. 31 - * this has the side-effect that ide-probe.c will cluster our 4 interfaces 32 - * together in a hwgroup, and will serialize accesses. this is good, because 33 - * we can't access more than one interface at the same time on ETRAX100. 34 - */ 35 - return 4; 36 - } 37 - 38 - static inline unsigned long ide_default_io_base(int index) 39 - { 40 - /* we have no real I/O base address per interface, since all go through the 41 - * same register. but in a bitfield in that register, we have the i/f number. 42 - * so we can use the io_base to remember that bitfield. 43 - */ 44 - static const unsigned long io_bases[MAX_HWIFS] = { 45 - IO_FIELD(R_ATA_CTRL_DATA, sel, 0), 46 - IO_FIELD(R_ATA_CTRL_DATA, sel, 1), 47 - IO_FIELD(R_ATA_CTRL_DATA, sel, 2), 48 - IO_FIELD(R_ATA_CTRL_DATA, sel, 3) 49 - }; 50 - return io_bases[index]; 51 - } 52 - 53 - /* this is called once for each interface, to setup the port addresses. data_port is the result 54 - * of the ide_default_io_base call above. ctrl_port will be 0, but that is don't care for us. 55 - */ 56 - 57 - static inline void ide_init_hwif_ports(hw_regs_t *hw, unsigned long data_port, unsigned long ctrl_port, int *irq) 58 - { 59 - int i; 60 - 61 - /* fill in ports for ATA addresses 0 to 7 */ 62 - for (i = 0; i <= 7; i++) { 63 - hw->io_ports_array[i] = data_port | 64 - IO_FIELD(R_ATA_CTRL_DATA, addr, i) | 65 - IO_STATE(R_ATA_CTRL_DATA, cs0, active); 66 - } 67 - 68 - /* the IDE control register is at ATA address 6, with CS1 active instead of CS0 */ 69 - hw->io_ports.ctl_addr = data_port | 70 - IO_FIELD(R_ATA_CTRL_DATA, addr, 6) | 71 - IO_STATE(R_ATA_CTRL_DATA, cs1, active); 72 - 73 - /* whats this for ? */ 74 - hw->io_ports.irq_addr = 0; 75 - } 76 - 77 - static inline void ide_init_default_hwifs(void) 78 - { 79 - hw_regs_t hw; 80 - int index; 81 - 82 - for(index = 0; index < MAX_HWIFS; index++) { 83 - ide_init_hwif_ports(&hw, ide_default_io_base(index), 0, NULL); 84 - hw.irq = ide_default_irq(ide_default_io_base(index)); 85 - ide_register_hw(&hw, NULL); 86 - } 87 - } 88 - 89 - #endif /* __KERNEL__ */ 90 - 91 - #endif /* __ASMCRIS_IDE_H */
···
-56
include/asm-cris/arch-v32/ide.h
··· 1 - /* 2 - * linux/include/asm-cris/ide.h 3 - * 4 - * Copyright (C) 2000-2004 Axis Communications AB 5 - * 6 - * Authors: Bjorn Wesen, Mikael Starvik 7 - * 8 - */ 9 - 10 - /* 11 - * This file contains the ETRAX FS specific IDE code. 12 - */ 13 - 14 - #ifndef __ASMCRIS_IDE_H 15 - #define __ASMCRIS_IDE_H 16 - 17 - #ifdef __KERNEL__ 18 - 19 - #include <asm/arch/hwregs/intr_vect.h> 20 - #include <asm/arch/hwregs/ata_defs.h> 21 - #include <asm/io.h> 22 - #include <asm-generic/ide_iops.h> 23 - 24 - 25 - /* ETRAX FS can support 4 IDE busses on the same pins (serialized) */ 26 - 27 - #define MAX_HWIFS 4 28 - 29 - static inline int ide_default_irq(unsigned long base) 30 - { 31 - /* all IDE busses share the same IRQ, 32 - * this has the side-effect that ide-probe.c will cluster our 4 interfaces 33 - * together in a hwgroup, and will serialize accesses. this is good, because 34 - * we can't access more than one interface at the same time on ETRAX100. 35 - */ 36 - return ATA_INTR_VECT; 37 - } 38 - 39 - static inline unsigned long ide_default_io_base(int index) 40 - { 41 - reg_ata_rw_ctrl2 ctrl2 = {.sel = index}; 42 - /* we have no real I/O base address per interface, since all go through the 43 - * same register. but in a bitfield in that register, we have the i/f number. 44 - * so we can use the io_base to remember that bitfield. 45 - */ 46 - ctrl2.sel = index; 47 - 48 - return REG_TYPE_CONV(unsigned long, reg_ata_rw_ctrl2, ctrl2); 49 - } 50 - 51 - #define IDE_ARCH_ACK_INTR 52 - #define ide_ack_intr(hwif) ((hwif)->ack_intr(hwif)) 53 - 54 - #endif /* __KERNEL__ */ 55 - 56 - #endif /* __ASMCRIS_IDE_H */
···
-1
include/asm-cris/ide.h
··· 1 - #include <asm/arch/ide.h>
···
-4
include/asm-frv/ide.h
··· 18 #include <asm/io.h> 19 #include <asm/irq.h> 20 21 - #ifndef MAX_HWIFS 22 - #define MAX_HWIFS 8 23 - #endif 24 - 25 /****************************************************************************/ 26 /* 27 * some bits needed for parts of the IDE subsystem to compile
··· 18 #include <asm/io.h> 19 #include <asm/irq.h> 20 21 /****************************************************************************/ 22 /* 23 * some bits needed for parts of the IDE subsystem to compile
-26
include/asm-h8300/ide.h
··· 1 - /****************************************************************************/ 2 - 3 - /* 4 - * linux/include/asm-h8300/ide.h 5 - * 6 - * Copyright (C) 1994-1996 Linus Torvalds & authors 7 - * Copyright (C) 2001 Lineo Inc., davidm@snapgear.com 8 - * Copyright (C) 2002 Greg Ungerer (gerg@snapgear.com) 9 - * Copyright (C) 2002 Yoshinori Sato (ysato@users.sourceforge.jp) 10 - */ 11 - 12 - /****************************************************************************/ 13 - #ifndef _H8300_IDE_H 14 - #define _H8300_IDE_H 15 - /****************************************************************************/ 16 - #ifdef __KERNEL__ 17 - /****************************************************************************/ 18 - 19 - #define MAX_HWIFS 1 20 - 21 - #include <asm-generic/ide_iops.h> 22 - 23 - /****************************************************************************/ 24 - #endif /* __KERNEL__ */ 25 - #endif /* _H8300_IDE_H */ 26 - /****************************************************************************/
···
-51
include/asm-ia64/ide.h
··· 1 - /* 2 - * linux/include/asm-ia64/ide.h 3 - * 4 - * Copyright (C) 1994-1996 Linus Torvalds & authors 5 - */ 6 - 7 - /* 8 - * This file contains the ia64 architecture specific IDE code. 9 - */ 10 - 11 - #ifndef __ASM_IA64_IDE_H 12 - #define __ASM_IA64_IDE_H 13 - 14 - #ifdef __KERNEL__ 15 - 16 - 17 - #include <linux/irq.h> 18 - 19 - static inline int ide_default_irq(unsigned long base) 20 - { 21 - switch (base) { 22 - case 0x1f0: return isa_irq_to_vector(14); 23 - case 0x170: return isa_irq_to_vector(15); 24 - case 0x1e8: return isa_irq_to_vector(11); 25 - case 0x168: return isa_irq_to_vector(10); 26 - case 0x1e0: return isa_irq_to_vector(8); 27 - case 0x160: return isa_irq_to_vector(12); 28 - default: 29 - return 0; 30 - } 31 - } 32 - 33 - static inline unsigned long ide_default_io_base(int index) 34 - { 35 - switch (index) { 36 - case 0: return 0x1f0; 37 - case 1: return 0x170; 38 - case 2: return 0x1e8; 39 - case 3: return 0x168; 40 - case 4: return 0x1e0; 41 - case 5: return 0x160; 42 - default: 43 - return 0; 44 - } 45 - } 46 - 47 - #include <asm-generic/ide_iops.h> 48 - 49 - #endif /* __KERNEL__ */ 50 - 51 - #endif /* __ASM_IA64_IDE_H */
···
-70
include/asm-m32r/ide.h
··· 1 - #ifndef _ASM_M32R_IDE_H 2 - #define _ASM_M32R_IDE_H 3 - 4 - /* 5 - * linux/include/asm-m32r/ide.h 6 - * 7 - * Copyright (C) 1994-1996 Linus Torvalds & authors 8 - */ 9 - 10 - /* 11 - * This file contains the i386 architecture specific IDE code. 12 - */ 13 - 14 - #ifdef __KERNEL__ 15 - 16 - #include <asm/m32r.h> 17 - 18 - #ifndef MAX_HWIFS 19 - # ifdef CONFIG_BLK_DEV_IDEPCI 20 - #define MAX_HWIFS 10 21 - # else 22 - #define MAX_HWIFS 2 23 - # endif 24 - #endif 25 - 26 - static __inline__ int ide_default_irq(unsigned long base) 27 - { 28 - switch (base) { 29 - #if defined(CONFIG_PLAT_M32700UT) || defined(CONFIG_PLAT_MAPPI2) \ 30 - || defined(CONFIG_PLAT_OPSPUT) 31 - case 0x1f0: return PLD_IRQ_CFIREQ; 32 - default: 33 - return 0; 34 - #elif defined(CONFIG_PLAT_MAPPI3) 35 - case 0x1f0: return PLD_IRQ_CFIREQ; 36 - case 0x170: return PLD_IRQ_IDEIREQ; 37 - default: 38 - return 0; 39 - #else 40 - case 0x1f0: return 14; 41 - case 0x170: return 15; 42 - case 0x1e8: return 11; 43 - case 0x168: return 10; 44 - case 0x1e0: return 8; 45 - case 0x160: return 12; 46 - default: 47 - return 0; 48 - #endif 49 - } 50 - } 51 - 52 - static __inline__ unsigned long ide_default_io_base(int index) 53 - { 54 - switch (index) { 55 - case 0: return 0x1f0; 56 - case 1: return 0x170; 57 - case 2: return 0x1e8; 58 - case 3: return 0x168; 59 - case 4: return 0x1e0; 60 - case 5: return 0x160; 61 - default: 62 - return 0; 63 - } 64 - } 65 - 66 - #include <asm-generic/ide_iops.h> 67 - 68 - #endif /* __KERNEL__ */ 69 - 70 - #endif /* _ASM_M32R_IDE_H */
···
-4
include/asm-m68k/ide.h
··· 45 #include <asm/macints.h> 46 #endif 47 48 - #ifndef MAX_HWIFS 49 - #define MAX_HWIFS 4 /* same as the other archs */ 50 - #endif 51 - 52 /* 53 * Get rid of defs from io.h - ide has its private and conflicting versions 54 * Since so far no single m68k platform uses ISA/PCI I/O space for IDE, we
··· 45 #include <asm/macints.h> 46 #endif 47 48 /* 49 * Get rid of defs from io.h - ide has its private and conflicting versions 50 * Since so far no single m68k platform uses ISA/PCI I/O space for IDE, we
-48
include/asm-mips/mach-generic/ide.h
··· 19 #include <linux/stddef.h> 20 #include <asm/processor.h> 21 22 - #ifndef MAX_HWIFS 23 - # ifdef CONFIG_BLK_DEV_IDEPCI 24 - #define MAX_HWIFS 10 25 - # else 26 - #define MAX_HWIFS 6 27 - # endif 28 - #endif 29 - 30 static __inline__ int ide_probe_legacy(void) 31 { 32 #ifdef CONFIG_PCI ··· 46 #else 47 return 0; 48 #endif 49 - } 50 - 51 - static __inline__ int ide_default_irq(unsigned long base) 52 - { 53 - switch (base) { 54 - case 0x1f0: return 14; 55 - case 0x170: return 15; 56 - case 0x1e8: return 11; 57 - case 0x168: return 10; 58 - case 0x1e0: return 8; 59 - case 0x160: return 12; 60 - default: 61 - return 0; 62 - } 63 - } 64 - 65 - static __inline__ unsigned long ide_default_io_base(int index) 66 - { 67 - if (!ide_probe_legacy()) 68 - return 0; 69 - /* 70 - * If PCI is present then it is not safe to poke around 71 - * the other legacy IDE ports. Only 0x1f0 and 0x170 are 72 - * defined compatibility mode ports for PCI. A user can 73 - * override this using ide= but we must default safe. 74 - */ 75 - if (no_pci_devices()) { 76 - switch (index) { 77 - case 2: return 0x1e8; 78 - case 3: return 0x168; 79 - case 4: return 0x1e0; 80 - case 5: return 0x160; 81 - } 82 - } 83 - switch (index) { 84 - case 0: return 0x1f0; 85 - case 1: return 0x170; 86 - default: 87 - return 0; 88 - } 89 } 90 91 /* MIPS port and memory-mapped I/O string operations. */
··· 19 #include <linux/stddef.h> 20 #include <asm/processor.h> 21 22 static __inline__ int ide_probe_legacy(void) 23 { 24 #ifdef CONFIG_PCI ··· 54 #else 55 return 0; 56 #endif 57 } 58 59 /* MIPS port and memory-mapped I/O string operations. */
-4
include/asm-mn10300/ide.h
··· 23 #undef SUPPORT_VLB_SYNC 24 #define SUPPORT_VLB_SYNC 0 25 26 - #ifndef MAX_HWIFS 27 - #define MAX_HWIFS 8 28 - #endif 29 - 30 /* 31 * some bits needed for parts of the IDE subsystem to compile 32 */
··· 23 #undef SUPPORT_VLB_SYNC 24 #define SUPPORT_VLB_SYNC 0 25 26 /* 27 * some bits needed for parts of the IDE subsystem to compile 28 */
-4
include/asm-parisc/ide.h
··· 13 14 #ifdef __KERNEL__ 15 16 - #ifndef MAX_HWIFS 17 - #define MAX_HWIFS 2 18 - #endif 19 - 20 #define ide_request_irq(irq,hand,flg,dev,id) request_irq((irq),(hand),(flg),(dev),(id)) 21 #define ide_free_irq(irq,dev_id) free_irq((irq), (dev_id)) 22 #define ide_request_region(from,extent,name) request_region((from), (extent), (name))
··· 13 14 #ifdef __KERNEL__ 15 16 #define ide_request_irq(irq,hand,flg,dev,id) request_irq((irq),(hand),(flg),(dev),(id)) 17 #define ide_free_irq(irq,dev_id) free_irq((irq), (dev_id)) 18 #define ide_request_region(from,extent,name) request_region((from), (extent), (name))
-26
include/asm-powerpc/ide.h
··· 14 #endif 15 #include <asm/io.h> 16 17 - #ifndef MAX_HWIFS 18 - #ifdef __powerpc64__ 19 - #define MAX_HWIFS 10 20 - #else 21 - #define MAX_HWIFS 8 22 - #endif 23 - #endif 24 - 25 #define __ide_mm_insw(p, a, c) readsw((void __iomem *)(p), (a), (c)) 26 #define __ide_mm_insl(p, a, c) readsl((void __iomem *)(p), (a), (c)) 27 #define __ide_mm_outsw(p, a, c) writesw((void __iomem *)(p), (a), (c)) ··· 32 case 0x170: return 15; 33 } 34 #endif 35 - #ifdef CONFIG_PPC_PREP 36 - switch (base) { 37 - case 0x1f0: return 13; 38 - case 0x170: return 13; 39 - case 0x1e8: return 11; 40 - case 0x168: return 10; 41 - case 0xfff0: return 14; /* MCP(N)750 ide0 */ 42 - case 0xffe0: return 15; /* MCP(N)750 ide1 */ 43 - } 44 - #endif 45 return 0; 46 } 47 ··· 42 switch (index) { 43 case 0: return 0x1f0; 44 case 1: return 0x170; 45 - } 46 - #endif 47 - #ifdef CONFIG_PPC_PREP 48 - switch (index) { 49 - case 0: return 0x1f0; 50 - case 1: return 0x170; 51 - case 2: return 0x1e8; 52 - case 3: return 0x168; 53 } 54 #endif 55 return 0;
··· 14 #endif 15 #include <asm/io.h> 16 17 #define __ide_mm_insw(p, a, c) readsw((void __iomem *)(p), (a), (c)) 18 #define __ide_mm_insl(p, a, c) readsl((void __iomem *)(p), (a), (c)) 19 #define __ide_mm_outsw(p, a, c) writesw((void __iomem *)(p), (a), (c)) ··· 40 case 0x170: return 15; 41 } 42 #endif 43 return 0; 44 } 45 ··· 60 switch (index) { 61 case 0: return 0x1f0; 62 case 1: return 0x170; 63 } 64 #endif 65 return 0;
-21
include/asm-sh/ide.h
··· 1 - /* 2 - * linux/include/asm-sh/ide.h 3 - * 4 - * Copyright (C) 1994-1996 Linus Torvalds & authors 5 - */ 6 - 7 - /* 8 - * This file contains the i386 architecture specific IDE code. 9 - * In future, SuperH code. 10 - */ 11 - 12 - #ifndef __ASM_SH_IDE_H 13 - #define __ASM_SH_IDE_H 14 - 15 - #ifdef __KERNEL__ 16 - 17 - #include <asm-generic/ide_iops.h> 18 - 19 - #endif /* __KERNEL__ */ 20 - 21 - #endif /* __ASM_SH_IDE_H */
···
-3
include/asm-sparc/ide.h
··· 21 #include <asm/psr.h> 22 #endif 23 24 - #undef MAX_HWIFS 25 - #define MAX_HWIFS 2 26 - 27 #define __ide_insl(data_reg, buffer, wcount) \ 28 __ide_insw(data_reg, buffer, (wcount)<<1) 29 #define __ide_outsl(data_reg, buffer, wcount) \
··· 21 #include <asm/psr.h> 22 #endif 23 24 #define __ide_insl(data_reg, buffer, wcount) \ 25 __ide_insw(data_reg, buffer, (wcount)<<1) 26 #define __ide_outsl(data_reg, buffer, wcount) \
-65
include/asm-x86/ide.h
··· 1 - /* 2 - * Copyright (C) 1994-1996 Linus Torvalds & authors 3 - */ 4 - 5 - /* 6 - * This file contains the i386 architecture specific IDE code. 7 - */ 8 - 9 - #ifndef __ASMi386_IDE_H 10 - #define __ASMi386_IDE_H 11 - 12 - #ifdef __KERNEL__ 13 - 14 - 15 - #ifndef MAX_HWIFS 16 - # ifdef CONFIG_BLK_DEV_IDEPCI 17 - #define MAX_HWIFS 10 18 - # else 19 - #define MAX_HWIFS 6 20 - # endif 21 - #endif 22 - 23 - static __inline__ int ide_default_irq(unsigned long base) 24 - { 25 - switch (base) { 26 - case 0x1f0: return 14; 27 - case 0x170: return 15; 28 - case 0x1e8: return 11; 29 - case 0x168: return 10; 30 - case 0x1e0: return 8; 31 - case 0x160: return 12; 32 - default: 33 - return 0; 34 - } 35 - } 36 - 37 - static __inline__ unsigned long ide_default_io_base(int index) 38 - { 39 - /* 40 - * If PCI is present then it is not safe to poke around 41 - * the other legacy IDE ports. Only 0x1f0 and 0x170 are 42 - * defined compatibility mode ports for PCI. A user can 43 - * override this using ide= but we must default safe. 44 - */ 45 - if (no_pci_devices()) { 46 - switch(index) { 47 - case 2: return 0x1e8; 48 - case 3: return 0x168; 49 - case 4: return 0x1e0; 50 - case 5: return 0x160; 51 - } 52 - } 53 - switch (index) { 54 - case 0: return 0x1f0; 55 - case 1: return 0x170; 56 - default: 57 - return 0; 58 - } 59 - } 60 - 61 - #include <asm-generic/ide_iops.h> 62 - 63 - #endif /* __KERNEL__ */ 64 - 65 - #endif /* __ASMi386_IDE_H */
···
-35
include/asm-xtensa/ide.h
··· 1 - /* 2 - * include/asm-xtensa/ide.h 3 - * 4 - * This file is subject to the terms and conditions of the GNU General Public 5 - * License. See the file "COPYING" in the main directory of this archive 6 - * for more details. 7 - * 8 - * Copyright (C) 1994 - 1996 Linus Torvalds & authors 9 - * Copyright (C) 2001 - 2005 Tensilica Inc. 10 - */ 11 - 12 - #ifndef _XTENSA_IDE_H 13 - #define _XTENSA_IDE_H 14 - 15 - #ifdef __KERNEL__ 16 - 17 - 18 - #ifndef MAX_HWIFS 19 - # define MAX_HWIFS 1 20 - #endif 21 - 22 - static __inline__ int ide_default_irq(unsigned long base) 23 - { 24 - /* Unsupported! */ 25 - return 0; 26 - } 27 - 28 - static __inline__ unsigned long ide_default_io_base(int index) 29 - { 30 - /* Unsupported! */ 31 - return 0; 32 - } 33 - 34 - #endif /* __KERNEL__ */ 35 - #endif /* _XTENSA_IDE_H */
···
+29 -3
include/linux/ide.h
··· 211 return 0; 212 } 213 214 #include <asm/ide.h> 215 216 #if !defined(MAX_HWIFS) || defined(CONFIG_EMBEDDED) 217 #undef MAX_HWIFS ··· 546 void (*dma_timeout)(struct ide_drive_s *); 547 }; 548 549 typedef struct hwif_s { 550 struct hwif_s *next; /* for linked-list in ide_hwgroup_t */ 551 struct hwif_s *mate; /* other hwif from same PCI chip */ 552 struct hwgroup_s *hwgroup; /* actually (ide_hwgroup_t *) */ 553 struct proc_dir_entry *proc; /* /proc/ide/ directory entry */ 554 555 char name[6]; /* name of interface, eg. "ide0" */ 556 ··· 644 struct ide_host { 645 ide_hwif_t *ports[MAX_HWIFS]; 646 unsigned int n_ports; 647 }; 648 649 /* ··· 894 }; 895 896 #define to_ide_driver(drv) container_of(drv, ide_driver_t, gen_driver) 897 898 int generic_ide_ioctl(ide_drive_t *, struct file *, struct block_device *, unsigned, unsigned long); 899 ··· 1206 1207 struct ide_port_info { 1208 char *name; 1209 - unsigned int (*init_chipset)(struct pci_dev *, const char *); 1210 void (*init_iops)(ide_hwif_t *); 1211 void (*init_hwif)(ide_hwif_t *); 1212 int (*init_dma)(ide_hwif_t *, ··· 1225 u8 udma_mask; 1226 }; 1227 1228 - int ide_setup_pci_device(struct pci_dev *, const struct ide_port_info *); 1229 - int ide_setup_pci_devices(struct pci_dev *, struct pci_dev *, const struct ide_port_info *); 1230 1231 void ide_map_sg(ide_drive_t *, struct request *); 1232 void ide_init_sg_cmd(ide_drive_t *, struct request *);
··· 211 return 0; 212 } 213 214 + #if defined(CONFIG_ARM) || defined(CONFIG_FRV) || defined(CONFIG_M68K) || \ 215 + defined(CONFIG_MIPS) || defined(CONFIG_MN10300) || defined(CONFIG_PARISC) \ 216 + || defined(CONFIG_PPC) || defined(CONFIG_SPARC) || defined(CONFIG_SPARC64) 217 #include <asm/ide.h> 218 + #else 219 + #include <asm-generic/ide_iops.h> 220 + #endif 221 + 222 + #ifndef MAX_HWIFS 223 + #if defined(CONFIG_BLACKFIN) || defined(CONFIG_H8300) || defined(CONFIG_XTENSA) 224 + # define MAX_HWIFS 1 225 + #else 226 + # define MAX_HWIFS 10 227 + #endif 228 + #endif 229 230 #if !defined(MAX_HWIFS) || defined(CONFIG_EMBEDDED) 231 #undef MAX_HWIFS ··· 532 void (*dma_timeout)(struct ide_drive_s *); 533 }; 534 535 + struct ide_host; 536 + 537 typedef struct hwif_s { 538 struct hwif_s *next; /* for linked-list in ide_hwgroup_t */ 539 struct hwif_s *mate; /* other hwif from same PCI chip */ 540 struct hwgroup_s *hwgroup; /* actually (ide_hwgroup_t *) */ 541 struct proc_dir_entry *proc; /* /proc/ide/ directory entry */ 542 + 543 + struct ide_host *host; 544 545 char name[6]; /* name of interface, eg. "ide0" */ 546 ··· 626 struct ide_host { 627 ide_hwif_t *ports[MAX_HWIFS]; 628 unsigned int n_ports; 629 + struct device *dev[2]; 630 + unsigned long host_flags; 631 + void *host_priv; 632 }; 633 634 /* ··· 873 }; 874 875 #define to_ide_driver(drv) container_of(drv, ide_driver_t, gen_driver) 876 + 877 + int ide_device_get(ide_drive_t *); 878 + void ide_device_put(ide_drive_t *); 879 880 int generic_ide_ioctl(ide_drive_t *, struct file *, struct block_device *, unsigned, unsigned long); 881 ··· 1182 1183 struct ide_port_info { 1184 char *name; 1185 + unsigned int (*init_chipset)(struct pci_dev *); 1186 void (*init_iops)(ide_hwif_t *); 1187 void (*init_hwif)(ide_hwif_t *); 1188 int (*init_dma)(ide_hwif_t *, ··· 1201 u8 udma_mask; 1202 }; 1203 1204 + int ide_pci_init_one(struct pci_dev *, const struct ide_port_info *, void *); 1205 + int ide_pci_init_two(struct pci_dev *, struct pci_dev *, 1206 + const struct ide_port_info *, void *); 1207 + void ide_pci_remove(struct pci_dev *); 1208 1209 void ide_map_sg(ide_drive_t *, struct request *); 1210 void ide_init_sg_cmd(ide_drive_t *, struct request *);