aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2007-10-19 22:36:05 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-10-19 22:36:05 -0400
commit5f737085beea3a5c5b6f44a16e6d3e2fd03095e0 (patch)
tree218643043a16f9af32b2b1037ddbb3ecd271c779
parente9a404580ccaeb31dd2a976f9929c4f9eb6f3540 (diff)
parent276d789e1794560d7ce53a7f2687415e2a80bb8a (diff)
Merge master.kernel.org:/pub/scm/linux/kernel/git/bart/ide-2.6
* master.kernel.org:/pub/scm/linux/kernel/git/bart/ide-2.6: (50 commits) ide: remove inclusion of non-existent io_trace.h ide-disk: add get_smart_data() helper ide: fix ->data_phase in taskfile_load_raw() ide: check drive->using_dma in flagged_taskfile() ide: check ->dma_setup() return value in flagged_taskfile() dtc2278: note on docs qd65xx: remove pointless qd_{read,write}_reg() (take 2) ide: PCI BMDMA initialization fixes (take 2) ide: remove stale comments from ide-taskfile.c ide: remove dead code from ide_driveid_update() ide: use __ide_end_request() in ide_end_dequeued_request() ide: enhance ide_setup_pci_noise() cs5530: remove needless ide_lock taking ide: take ide_lock for prefetch disable/enable in do_special() ht6560b: fix deadlock on error handling cmd640: fix deadlock on error handling slc90e66: fix deadlock on error handling opti621: fix deadlock on error handling qd65xx: fix deadlock on error handling dtc2278: fix deadlock on error handling ...
-rw-r--r--drivers/ide/Kconfig3
-rw-r--r--drivers/ide/arm/bast-ide.c2
-rw-r--r--drivers/ide/arm/icside.c62
-rw-r--r--drivers/ide/arm/ide_arm.c2
-rw-r--r--drivers/ide/arm/rapide.c37
-rw-r--r--drivers/ide/cris/ide-cris.c2
-rw-r--r--drivers/ide/h8300/ide-h8300.c3
-rw-r--r--drivers/ide/ide-acpi.c2
-rw-r--r--drivers/ide/ide-disk.c24
-rw-r--r--drivers/ide/ide-dma.c32
-rw-r--r--drivers/ide/ide-io.c59
-rw-r--r--drivers/ide/ide-iops.c26
-rw-r--r--drivers/ide/ide-pnp.c3
-rw-r--r--drivers/ide/ide-probe.c87
-rw-r--r--drivers/ide/ide-proc.c2
-rw-r--r--drivers/ide/ide-tape.c1
-rw-r--r--drivers/ide/ide-taskfile.c37
-rw-r--r--drivers/ide/ide.c73
-rw-r--r--drivers/ide/legacy/ali14xx.c13
-rw-r--r--drivers/ide/legacy/buddha.c4
-rw-r--r--drivers/ide/legacy/dtc2278.c16
-rw-r--r--drivers/ide/legacy/falconide.c2
-rw-r--r--drivers/ide/legacy/gayle.c2
-rw-r--r--drivers/ide/legacy/ht6560b.c33
-rw-r--r--drivers/ide/legacy/ide-cs.c2
-rw-r--r--drivers/ide/legacy/ide_platform.c43
-rw-r--r--drivers/ide/legacy/macide.c6
-rw-r--r--drivers/ide/legacy/q40ide.c5
-rw-r--r--drivers/ide/legacy/qd65xx.c64
-rw-r--r--drivers/ide/legacy/umc8672.c9
-rw-r--r--drivers/ide/mips/au1xxx-ide.c19
-rw-r--r--drivers/ide/mips/swarm.c14
-rw-r--r--drivers/ide/pci/aec62xx.c25
-rw-r--r--drivers/ide/pci/alim15x3.c109
-rw-r--r--drivers/ide/pci/amd74xx.c29
-rw-r--r--drivers/ide/pci/atiixp.c3
-rw-r--r--drivers/ide/pci/cmd640.c42
-rw-r--r--drivers/ide/pci/cmd64x.c6
-rw-r--r--drivers/ide/pci/cs5520.c26
-rw-r--r--drivers/ide/pci/cs5530.c10
-rw-r--r--drivers/ide/pci/cs5535.c2
-rw-r--r--drivers/ide/pci/cy82c693.c4
-rw-r--r--drivers/ide/pci/delkin_cb.c2
-rw-r--r--drivers/ide/pci/generic.c31
-rw-r--r--drivers/ide/pci/hpt34x.c4
-rw-r--r--drivers/ide/pci/hpt366.c4
-rw-r--r--drivers/ide/pci/it8213.c2
-rw-r--r--drivers/ide/pci/it821x.c2
-rw-r--r--drivers/ide/pci/jmicron.c2
-rw-r--r--drivers/ide/pci/ns87415.c2
-rw-r--r--drivers/ide/pci/opti621.c10
-rw-r--r--drivers/ide/pci/pdc202xx_new.c4
-rw-r--r--drivers/ide/pci/pdc202xx_old.c22
-rw-r--r--drivers/ide/pci/piix.c6
-rw-r--r--drivers/ide/pci/rz1000.c7
-rw-r--r--drivers/ide/pci/sc1200.c2
-rw-r--r--drivers/ide/pci/scc_pata.c11
-rw-r--r--drivers/ide/pci/serverworks.c11
-rw-r--r--drivers/ide/pci/sgiioc4.c16
-rw-r--r--drivers/ide/pci/siimage.c92
-rw-r--r--drivers/ide/pci/sis5513.c4
-rw-r--r--drivers/ide/pci/sl82c105.c14
-rw-r--r--drivers/ide/pci/slc90e66.c10
-rw-r--r--drivers/ide/pci/tc86c001.c2
-rw-r--r--drivers/ide/pci/triflex.c2
-rw-r--r--drivers/ide/pci/trm290.c4
-rw-r--r--drivers/ide/pci/via82cxxx.c81
-rw-r--r--drivers/ide/ppc/mpc8xx.c4
-rw-r--r--drivers/ide/ppc/pmac.c12
-rw-r--r--drivers/ide/setup-pci.c202
-rw-r--r--drivers/macintosh/mediabay.c2
-rw-r--r--include/asm-alpha/ide.h1
-rw-r--r--include/asm-arm/ide.h1
-rw-r--r--include/asm-blackfin/ide.h1
-rw-r--r--include/asm-cris/arch-v32/ide.h2
-rw-r--r--include/asm-ia64/ide.h1
-rw-r--r--include/asm-m32r/ide.h1
-rw-r--r--include/asm-m68k/ide.h2
-rw-r--r--include/asm-mips/mach-generic/ide.h1
-rw-r--r--include/asm-parisc/ide.h1
-rw-r--r--include/asm-powerpc/ide.h3
-rw-r--r--include/asm-sh64/ide.h1
-rw-r--r--include/asm-sparc/ide.h1
-rw-r--r--include/asm-sparc64/ide.h1
-rw-r--r--include/asm-x86/ide.h1
-rw-r--r--include/linux/ide.h109
86 files changed, 669 insertions, 970 deletions
diff --git a/drivers/ide/Kconfig b/drivers/ide/Kconfig
index 6d9fd92763f4..6eaece96524e 100644
--- a/drivers/ide/Kconfig
+++ b/drivers/ide/Kconfig
@@ -1056,6 +1056,9 @@ endif
1056config BLK_DEV_IDEDMA 1056config BLK_DEV_IDEDMA
1057 def_bool BLK_DEV_IDEDMA_PCI || BLK_DEV_IDEDMA_PMAC || BLK_DEV_IDEDMA_ICS || BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA 1057 def_bool BLK_DEV_IDEDMA_PCI || BLK_DEV_IDEDMA_PMAC || BLK_DEV_IDEDMA_ICS || BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA
1058 1058
1059config IDE_ARCH_OBSOLETE_INIT
1060 def_bool ALPHA || (ARM && !ARCH_L7200) || BLACKFIN || X86 || IA64 || M32R || MIPS || PARISC || PPC || (SUPERH64 && BLK_DEV_IDEPCI) || SPARC
1061
1059endif 1062endif
1060 1063
1061config BLK_DEV_HD_ONLY 1064config BLK_DEV_HD_ONLY
diff --git a/drivers/ide/arm/bast-ide.c b/drivers/ide/arm/bast-ide.c
index f7449d04114a..48db6167bb90 100644
--- a/drivers/ide/arm/bast-ide.c
+++ b/drivers/ide/arm/bast-ide.c
@@ -45,7 +45,7 @@ bastide_register(unsigned int base, unsigned int aux, int irq,
45 hw.io_ports[IDE_CONTROL_OFFSET] = aux + (6 * 0x20); 45 hw.io_ports[IDE_CONTROL_OFFSET] = aux + (6 * 0x20);
46 hw.irq = irq; 46 hw.irq = irq;
47 47
48 ide_register_hw(&hw, 0, hwif); 48 ide_register_hw(&hw, NULL, 0, hwif);
49 49
50 return 0; 50 return 0;
51} 51}
diff --git a/drivers/ide/arm/icside.c b/drivers/ide/arm/icside.c
index 3af33fbf1f88..410a0d13e35e 100644
--- a/drivers/ide/arm/icside.c
+++ b/drivers/ide/arm/icside.c
@@ -316,27 +316,29 @@ static int icside_dma_end(ide_drive_t *drive)
316 316
317 drive->waiting_for_dma = 0; 317 drive->waiting_for_dma = 0;
318 318
319 disable_dma(hwif->hw.dma); 319 disable_dma(state->dev->dma);
320 320
321 /* Teardown mappings after DMA has completed. */ 321 /* Teardown mappings after DMA has completed. */
322 dma_unmap_sg(state->dev, hwif->sg_table, hwif->sg_nents, 322 dma_unmap_sg(state->dev, hwif->sg_table, hwif->sg_nents,
323 hwif->sg_dma_direction); 323 hwif->sg_dma_direction);
324 324
325 return get_dma_residue(hwif->hw.dma) != 0; 325 return get_dma_residue(state->dev->dma) != 0;
326} 326}
327 327
328static void icside_dma_start(ide_drive_t *drive) 328static void icside_dma_start(ide_drive_t *drive)
329{ 329{
330 ide_hwif_t *hwif = HWIF(drive); 330 ide_hwif_t *hwif = HWIF(drive);
331 struct icside_state *state = hwif->hwif_data;
331 332
332 /* We can not enable DMA on both channels simultaneously. */ 333 /* We can not enable DMA on both channels simultaneously. */
333 BUG_ON(dma_channel_active(hwif->hw.dma)); 334 BUG_ON(dma_channel_active(state->dev->dma));
334 enable_dma(hwif->hw.dma); 335 enable_dma(state->dev->dma);
335} 336}
336 337
337static int icside_dma_setup(ide_drive_t *drive) 338static int icside_dma_setup(ide_drive_t *drive)
338{ 339{
339 ide_hwif_t *hwif = HWIF(drive); 340 ide_hwif_t *hwif = HWIF(drive);
341 struct icside_state *state = hwif->hwif_data;
340 struct request *rq = hwif->hwgroup->rq; 342 struct request *rq = hwif->hwgroup->rq;
341 unsigned int dma_mode; 343 unsigned int dma_mode;
342 344
@@ -348,7 +350,7 @@ static int icside_dma_setup(ide_drive_t *drive)
348 /* 350 /*
349 * We can not enable DMA on both channels. 351 * We can not enable DMA on both channels.
350 */ 352 */
351 BUG_ON(dma_channel_active(hwif->hw.dma)); 353 BUG_ON(dma_channel_active(state->dev->dma));
352 354
353 icside_build_sglist(drive, rq); 355 icside_build_sglist(drive, rq);
354 356
@@ -365,14 +367,14 @@ static int icside_dma_setup(ide_drive_t *drive)
365 /* 367 /*
366 * Select the correct timing for this drive. 368 * Select the correct timing for this drive.
367 */ 369 */
368 set_dma_speed(hwif->hw.dma, drive->drive_data); 370 set_dma_speed(state->dev->dma, drive->drive_data);
369 371
370 /* 372 /*
371 * Tell the DMA engine about the SG table and 373 * Tell the DMA engine about the SG table and
372 * data direction. 374 * data direction.
373 */ 375 */
374 set_dma_sg(hwif->hw.dma, hwif->sg_table, hwif->sg_nents); 376 set_dma_sg(state->dev->dma, hwif->sg_table, hwif->sg_nents);
375 set_dma_mode(hwif->hw.dma, dma_mode); 377 set_dma_mode(state->dev->dma, dma_mode);
376 378
377 drive->waiting_for_dma = 1; 379 drive->waiting_for_dma = 1;
378 380
@@ -438,40 +440,16 @@ static void icside_dma_init(ide_hwif_t *hwif)
438#define icside_dma_init(hwif) (0) 440#define icside_dma_init(hwif) (0)
439#endif 441#endif
440 442
441static ide_hwif_t *icside_find_hwif(unsigned long dataport)
442{
443 ide_hwif_t *hwif;
444 int index;
445
446 for (index = 0; index < MAX_HWIFS; ++index) {
447 hwif = &ide_hwifs[index];
448 if (hwif->io_ports[IDE_DATA_OFFSET] == dataport)
449 goto found;
450 }
451
452 for (index = 0; index < MAX_HWIFS; ++index) {
453 hwif = &ide_hwifs[index];
454 if (!hwif->io_ports[IDE_DATA_OFFSET])
455 goto found;
456 }
457
458 hwif = NULL;
459found:
460 return hwif;
461}
462
463static ide_hwif_t * 443static ide_hwif_t *
464icside_setup(void __iomem *base, struct cardinfo *info, struct expansion_card *ec) 444icside_setup(void __iomem *base, struct cardinfo *info, struct expansion_card *ec)
465{ 445{
466 unsigned long port = (unsigned long)base + info->dataoffset; 446 unsigned long port = (unsigned long)base + info->dataoffset;
467 ide_hwif_t *hwif; 447 ide_hwif_t *hwif;
468 448
469 hwif = icside_find_hwif(port); 449 hwif = ide_find_port(port);
470 if (hwif) { 450 if (hwif) {
471 int i; 451 int i;
472 452
473 memset(&hwif->hw, 0, sizeof(hw_regs_t));
474
475 /* 453 /*
476 * Ensure we're using MMIO 454 * Ensure we're using MMIO
477 */ 455 */
@@ -479,13 +457,10 @@ icside_setup(void __iomem *base, struct cardinfo *info, struct expansion_card *e
479 hwif->mmio = 1; 457 hwif->mmio = 1;
480 458
481 for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++) { 459 for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++) {
482 hwif->hw.io_ports[i] = port;
483 hwif->io_ports[i] = port; 460 hwif->io_ports[i] = port;
484 port += 1 << info->stepping; 461 port += 1 << info->stepping;
485 } 462 }
486 hwif->hw.io_ports[IDE_CONTROL_OFFSET] = (unsigned long)base + info->ctrloffset;
487 hwif->io_ports[IDE_CONTROL_OFFSET] = (unsigned long)base + info->ctrloffset; 463 hwif->io_ports[IDE_CONTROL_OFFSET] = (unsigned long)base + info->ctrloffset;
488 hwif->hw.irq = ec->irq;
489 hwif->irq = ec->irq; 464 hwif->irq = ec->irq;
490 hwif->noprobe = 0; 465 hwif->noprobe = 0;
491 hwif->chipset = ide_acorn; 466 hwif->chipset = ide_acorn;
@@ -500,6 +475,7 @@ icside_register_v5(struct icside_state *state, struct expansion_card *ec)
500{ 475{
501 ide_hwif_t *hwif; 476 ide_hwif_t *hwif;
502 void __iomem *base; 477 void __iomem *base;
478 u8 idx[4] = { 0xff, 0xff, 0xff, 0xff };
503 479
504 base = ecardm_iomap(ec, ECARD_RES_MEMC, 0, 0); 480 base = ecardm_iomap(ec, ECARD_RES_MEMC, 0, 0);
505 if (!base) 481 if (!base)
@@ -523,9 +499,9 @@ icside_register_v5(struct icside_state *state, struct expansion_card *ec)
523 499
524 state->hwif[0] = hwif; 500 state->hwif[0] = hwif;
525 501
526 probe_hwif_init(hwif); 502 idx[0] = hwif->index;
527 503
528 ide_proc_register_port(hwif); 504 ide_device_add(idx);
529 505
530 return 0; 506 return 0;
531} 507}
@@ -537,6 +513,7 @@ icside_register_v6(struct icside_state *state, struct expansion_card *ec)
537 void __iomem *ioc_base, *easi_base; 513 void __iomem *ioc_base, *easi_base;
538 unsigned int sel = 0; 514 unsigned int sel = 0;
539 int ret; 515 int ret;
516 u8 idx[4] = { 0xff, 0xff, 0xff, 0xff };
540 517
541 ioc_base = ecardm_iomap(ec, ECARD_RES_IOCFAST, 0, 0); 518 ioc_base = ecardm_iomap(ec, ECARD_RES_IOCFAST, 0, 0);
542 if (!ioc_base) { 519 if (!ioc_base) {
@@ -592,7 +569,6 @@ icside_register_v6(struct icside_state *state, struct expansion_card *ec)
592 hwif->serialized = 1; 569 hwif->serialized = 1;
593 hwif->config_data = (unsigned long)ioc_base; 570 hwif->config_data = (unsigned long)ioc_base;
594 hwif->select_data = sel; 571 hwif->select_data = sel;
595 hwif->hw.dma = ec->dma;
596 572
597 mate->maskproc = icside_maskproc; 573 mate->maskproc = icside_maskproc;
598 mate->channel = 1; 574 mate->channel = 1;
@@ -601,18 +577,16 @@ icside_register_v6(struct icside_state *state, struct expansion_card *ec)
601 mate->serialized = 1; 577 mate->serialized = 1;
602 mate->config_data = (unsigned long)ioc_base; 578 mate->config_data = (unsigned long)ioc_base;
603 mate->select_data = sel | 1; 579 mate->select_data = sel | 1;
604 mate->hw.dma = ec->dma;
605 580
606 if (ec->dma != NO_DMA && !request_dma(ec->dma, hwif->name)) { 581 if (ec->dma != NO_DMA && !request_dma(ec->dma, hwif->name)) {
607 icside_dma_init(hwif); 582 icside_dma_init(hwif);
608 icside_dma_init(mate); 583 icside_dma_init(mate);
609 } 584 }
610 585
611 probe_hwif_init(hwif); 586 idx[0] = hwif->index;
612 probe_hwif_init(mate); 587 idx[1] = mate->index;
613 588
614 ide_proc_register_port(hwif); 589 ide_device_add(idx);
615 ide_proc_register_port(mate);
616 590
617 return 0; 591 return 0;
618 592
diff --git a/drivers/ide/arm/ide_arm.c b/drivers/ide/arm/ide_arm.c
index bce2bec81413..8957cbadf5c2 100644
--- a/drivers/ide/arm/ide_arm.c
+++ b/drivers/ide/arm/ide_arm.c
@@ -31,5 +31,5 @@ void __init ide_arm_init(void)
31 memset(&hw, 0, sizeof(hw)); 31 memset(&hw, 0, sizeof(hw));
32 ide_std_init_ports(&hw, IDE_ARM_IO, IDE_ARM_IO + 0x206); 32 ide_std_init_ports(&hw, IDE_ARM_IO, IDE_ARM_IO + 0x206);
33 hw.irq = IDE_ARM_IRQ; 33 hw.irq = IDE_ARM_IRQ;
34 ide_register_hw(&hw, 1, NULL); 34 ide_register_hw(&hw, NULL, 1, NULL);
35} 35}
diff --git a/drivers/ide/arm/rapide.c b/drivers/ide/arm/rapide.c
index 83811af11610..0775a3afef48 100644
--- a/drivers/ide/arm/rapide.c
+++ b/drivers/ide/arm/rapide.c
@@ -13,42 +13,25 @@
13 13
14#include <asm/ecard.h> 14#include <asm/ecard.h>
15 15
16/*
17 * Something like this really should be in generic code, but isn't.
18 */
19static ide_hwif_t * 16static ide_hwif_t *
20rapide_locate_hwif(void __iomem *base, void __iomem *ctrl, unsigned int sz, int irq) 17rapide_locate_hwif(void __iomem *base, void __iomem *ctrl, unsigned int sz, int irq)
21{ 18{
22 unsigned long port = (unsigned long)base; 19 unsigned long port = (unsigned long)base;
23 ide_hwif_t *hwif; 20 ide_hwif_t *hwif = ide_find_port(port);
24 int index, i; 21 int i;
25
26 for (index = 0; index < MAX_HWIFS; ++index) {
27 hwif = ide_hwifs + index;
28 if (hwif->io_ports[IDE_DATA_OFFSET] == port)
29 goto found;
30 }
31
32 for (index = 0; index < MAX_HWIFS; ++index) {
33 hwif = ide_hwifs + index;
34 if (hwif->io_ports[IDE_DATA_OFFSET] == 0)
35 goto found;
36 }
37 22
38 return NULL; 23 if (hwif == NULL)
24 goto out;
39 25
40 found:
41 for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++) { 26 for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++) {
42 hwif->hw.io_ports[i] = port;
43 hwif->io_ports[i] = port; 27 hwif->io_ports[i] = port;
44 port += sz; 28 port += sz;
45 } 29 }
46 hwif->hw.io_ports[IDE_CONTROL_OFFSET] = (unsigned long)ctrl;
47 hwif->io_ports[IDE_CONTROL_OFFSET] = (unsigned long)ctrl; 30 hwif->io_ports[IDE_CONTROL_OFFSET] = (unsigned long)ctrl;
48 hwif->hw.irq = hwif->irq = irq; 31 hwif->irq = irq;
49 hwif->mmio = 1; 32 hwif->mmio = 1;
50 default_hwif_mmiops(hwif); 33 default_hwif_mmiops(hwif);
51 34out:
52 return hwif; 35 return hwif;
53} 36}
54 37
@@ -58,6 +41,7 @@ rapide_probe(struct expansion_card *ec, const struct ecard_id *id)
58 ide_hwif_t *hwif; 41 ide_hwif_t *hwif;
59 void __iomem *base; 42 void __iomem *base;
60 int ret; 43 int ret;
44 u8 idx[4] = { 0xff, 0xff, 0xff, 0xff };
61 45
62 ret = ecard_request_resources(ec); 46 ret = ecard_request_resources(ec);
63 if (ret) 47 if (ret)
@@ -74,8 +58,11 @@ rapide_probe(struct expansion_card *ec, const struct ecard_id *id)
74 hwif->hwif_data = base; 58 hwif->hwif_data = base;
75 hwif->gendev.parent = &ec->dev; 59 hwif->gendev.parent = &ec->dev;
76 hwif->noprobe = 0; 60 hwif->noprobe = 0;
77 probe_hwif_init(hwif); 61
78 ide_proc_register_port(hwif); 62 idx[0] = hwif->index;
63
64 ide_device_add(idx);
65
79 ecard_set_drvdata(ec, hwif); 66 ecard_set_drvdata(ec, hwif);
80 goto out; 67 goto out;
81 } 68 }
diff --git a/drivers/ide/cris/ide-cris.c b/drivers/ide/cris/ide-cris.c
index 9a96a10ba9d3..ff20377b4c82 100644
--- a/drivers/ide/cris/ide-cris.c
+++ b/drivers/ide/cris/ide-cris.c
@@ -782,7 +782,7 @@ init_e100_ide (void)
782 ide_offsets, 782 ide_offsets,
783 0, 0, cris_ide_ack_intr, 783 0, 0, cris_ide_ack_intr,
784 ide_default_irq(0)); 784 ide_default_irq(0));
785 ide_register_hw(&hw, 1, &hwif); 785 ide_register_hw(&hw, NULL, 1, &hwif);
786 hwif->mmio = 1; 786 hwif->mmio = 1;
787 hwif->chipset = ide_etrax100; 787 hwif->chipset = ide_etrax100;
788 hwif->set_pio_mode = &cris_set_pio_mode; 788 hwif->set_pio_mode = &cris_set_pio_mode;
diff --git a/drivers/ide/h8300/ide-h8300.c b/drivers/ide/h8300/ide-h8300.c
index 6d26ad7360d5..4a49b5c59acb 100644
--- a/drivers/ide/h8300/ide-h8300.c
+++ b/drivers/ide/h8300/ide-h8300.c
@@ -68,7 +68,6 @@ static inline void hw_setup(hw_regs_t *hw)
68 hw->io_ports[i] = CONFIG_H8300_IDE_BASE + H8300_IDE_GAP*i; 68 hw->io_ports[i] = CONFIG_H8300_IDE_BASE + H8300_IDE_GAP*i;
69 hw->io_ports[IDE_CONTROL_OFFSET] = CONFIG_H8300_IDE_ALT; 69 hw->io_ports[IDE_CONTROL_OFFSET] = CONFIG_H8300_IDE_ALT;
70 hw->irq = EXT_IRQ0 + CONFIG_H8300_IDE_IRQ; 70 hw->irq = EXT_IRQ0 + CONFIG_H8300_IDE_IRQ;
71 hw->dma = NO_DMA;
72 hw->chipset = ide_generic; 71 hw->chipset = ide_generic;
73} 72}
74 73
@@ -101,7 +100,7 @@ void __init h8300_ide_init(void)
101 hw_setup(&hw); 100 hw_setup(&hw);
102 101
103 /* register if */ 102 /* register if */
104 idx = ide_register_hw(&hw, 1, &hwif); 103 idx = ide_register_hw(&hw, NULL, 1, &hwif);
105 if (idx == -1) { 104 if (idx == -1) {
106 printk(KERN_ERR "ide-h8300: IDE I/F register failed\n"); 105 printk(KERN_ERR "ide-h8300: IDE I/F register failed\n");
107 return; 106 return;
diff --git a/drivers/ide/ide-acpi.c b/drivers/ide/ide-acpi.c
index 1d5f6823101c..89df48fdc69d 100644
--- a/drivers/ide/ide-acpi.c
+++ b/drivers/ide/ide-acpi.c
@@ -350,7 +350,7 @@ static int taskfile_load_raw(ide_drive_t *drive,
350 350
351 memset(&args, 0, sizeof(ide_task_t)); 351 memset(&args, 0, sizeof(ide_task_t));
352 args.command_type = IDE_DRIVE_TASK_NO_DATA; 352 args.command_type = IDE_DRIVE_TASK_NO_DATA;
353 args.data_phase = TASKFILE_IN; 353 args.data_phase = TASKFILE_NO_DATA;
354 args.handler = &task_no_data_intr; 354 args.handler = &task_no_data_intr;
355 355
356 /* convert gtf to IDE Taskfile */ 356 /* convert gtf to IDE Taskfile */
diff --git a/drivers/ide/ide-disk.c b/drivers/ide/ide-disk.c
index 2722d9165b6b..00123d99527a 100644
--- a/drivers/ide/ide-disk.c
+++ b/drivers/ide/ide-disk.c
@@ -593,28 +593,12 @@ static int smart_enable(ide_drive_t *drive)
593 return ide_raw_taskfile(drive, &args, NULL); 593 return ide_raw_taskfile(drive, &args, NULL);
594} 594}
595 595
596static int get_smart_values(ide_drive_t *drive, u8 *buf) 596static int get_smart_data(ide_drive_t *drive, u8 *buf, u8 sub_cmd)
597{ 597{
598 ide_task_t args; 598 ide_task_t args;
599 599
600 memset(&args, 0, sizeof(ide_task_t)); 600 memset(&args, 0, sizeof(ide_task_t));
601 args.tfRegister[IDE_FEATURE_OFFSET] = SMART_READ_VALUES; 601 args.tfRegister[IDE_FEATURE_OFFSET] = sub_cmd;
602 args.tfRegister[IDE_NSECTOR_OFFSET] = 0x01;
603 args.tfRegister[IDE_LCYL_OFFSET] = SMART_LCYL_PASS;
604 args.tfRegister[IDE_HCYL_OFFSET] = SMART_HCYL_PASS;
605 args.tfRegister[IDE_COMMAND_OFFSET] = WIN_SMART;
606 args.command_type = IDE_DRIVE_TASK_IN;
607 args.data_phase = TASKFILE_IN;
608 args.handler = &task_in_intr;
609 (void) smart_enable(drive);
610 return ide_raw_taskfile(drive, &args, buf);
611}
612
613static int get_smart_thresholds(ide_drive_t *drive, u8 *buf)
614{
615 ide_task_t args;
616 memset(&args, 0, sizeof(ide_task_t));
617 args.tfRegister[IDE_FEATURE_OFFSET] = SMART_READ_THRESHOLDS;
618 args.tfRegister[IDE_NSECTOR_OFFSET] = 0x01; 602 args.tfRegister[IDE_NSECTOR_OFFSET] = 0x01;
619 args.tfRegister[IDE_LCYL_OFFSET] = SMART_LCYL_PASS; 603 args.tfRegister[IDE_LCYL_OFFSET] = SMART_LCYL_PASS;
620 args.tfRegister[IDE_HCYL_OFFSET] = SMART_HCYL_PASS; 604 args.tfRegister[IDE_HCYL_OFFSET] = SMART_HCYL_PASS;
@@ -656,7 +640,7 @@ static int proc_idedisk_read_smart_thresholds
656 ide_drive_t *drive = (ide_drive_t *)data; 640 ide_drive_t *drive = (ide_drive_t *)data;
657 int len = 0, i = 0; 641 int len = 0, i = 0;
658 642
659 if (!get_smart_thresholds(drive, page)) { 643 if (get_smart_data(drive, page, SMART_READ_THRESHOLDS) == 0) {
660 unsigned short *val = (unsigned short *) page; 644 unsigned short *val = (unsigned short *) page;
661 char *out = ((char *)val) + (SECTOR_WORDS * 4); 645 char *out = ((char *)val) + (SECTOR_WORDS * 4);
662 page = out; 646 page = out;
@@ -675,7 +659,7 @@ static int proc_idedisk_read_smart_values
675 ide_drive_t *drive = (ide_drive_t *)data; 659 ide_drive_t *drive = (ide_drive_t *)data;
676 int len = 0, i = 0; 660 int len = 0, i = 0;
677 661
678 if (!get_smart_values(drive, page)) { 662 if (get_smart_data(drive, page, SMART_READ_VALUES) == 0) {
679 unsigned short *val = (unsigned short *) page; 663 unsigned short *val = (unsigned short *) page;
680 char *out = ((char *)val) + (SECTOR_WORDS * 4); 664 char *out = ((char *)val) + (SECTOR_WORDS * 4);
681 page = out; 665 page = out;
diff --git a/drivers/ide/ide-dma.c b/drivers/ide/ide-dma.c
index 80b4f17f3941..428f7a8a00b6 100644
--- a/drivers/ide/ide-dma.c
+++ b/drivers/ide/ide-dma.c
@@ -901,10 +901,7 @@ void ide_dma_timeout (ide_drive_t *drive)
901 901
902EXPORT_SYMBOL(ide_dma_timeout); 902EXPORT_SYMBOL(ide_dma_timeout);
903 903
904/* 904static void ide_release_dma_engine(ide_hwif_t *hwif)
905 * Needed for allowing full modular support of ide-driver
906 */
907static int ide_release_dma_engine(ide_hwif_t *hwif)
908{ 905{
909 if (hwif->dmatable_cpu) { 906 if (hwif->dmatable_cpu) {
910 pci_free_consistent(hwif->pci_dev, 907 pci_free_consistent(hwif->pci_dev,
@@ -913,7 +910,6 @@ static int ide_release_dma_engine(ide_hwif_t *hwif)
913 hwif->dmatable_dma); 910 hwif->dmatable_dma);
914 hwif->dmatable_cpu = NULL; 911 hwif->dmatable_cpu = NULL;
915 } 912 }
916 return 1;
917} 913}
918 914
919static int ide_release_iomio_dma(ide_hwif_t *hwif) 915static int ide_release_iomio_dma(ide_hwif_t *hwif)
@@ -956,12 +952,6 @@ static int ide_mapped_mmio_dma(ide_hwif_t *hwif, unsigned long base, unsigned in
956{ 952{
957 printk(KERN_INFO " %s: MMIO-DMA ", hwif->name); 953 printk(KERN_INFO " %s: MMIO-DMA ", hwif->name);
958 954
959 hwif->dma_base = base;
960
961 if(hwif->mate)
962 hwif->dma_master = (hwif->channel) ? hwif->mate->dma_base : base;
963 else
964 hwif->dma_master = base;
965 return 0; 955 return 0;
966} 956}
967 957
@@ -975,8 +965,6 @@ static int ide_iomio_dma(ide_hwif_t *hwif, unsigned long base, unsigned int port
975 return 1; 965 return 1;
976 } 966 }
977 967
978 hwif->dma_base = base;
979
980 if (hwif->cds->extra) { 968 if (hwif->cds->extra) {
981 hwif->extra_base = base + (hwif->channel ? 8 : 16); 969 hwif->extra_base = base + (hwif->channel ? 8 : 16);
982 970
@@ -991,10 +979,6 @@ static int ide_iomio_dma(ide_hwif_t *hwif, unsigned long base, unsigned int port
991 } 979 }
992 } 980 }
993 981
994 if(hwif->mate)
995 hwif->dma_master = (hwif->channel) ? hwif->mate->dma_base:base;
996 else
997 hwif->dma_master = base;
998 return 0; 982 return 0;
999} 983}
1000 984
@@ -1006,12 +990,9 @@ static int ide_dma_iobase(ide_hwif_t *hwif, unsigned long base, unsigned int por
1006 return ide_iomio_dma(hwif, base, ports); 990 return ide_iomio_dma(hwif, base, ports);
1007} 991}
1008 992
1009/* 993void ide_setup_dma(ide_hwif_t *hwif, unsigned long base, unsigned num_ports)
1010 * This can be called for a dynamically installed interface. Don't __init it
1011 */
1012void ide_setup_dma (ide_hwif_t *hwif, unsigned long dma_base, unsigned int num_ports)
1013{ 994{
1014 if (ide_dma_iobase(hwif, dma_base, num_ports)) 995 if (ide_dma_iobase(hwif, base, num_ports))
1015 return; 996 return;
1016 997
1017 if (ide_allocate_dma_engine(hwif)) { 998 if (ide_allocate_dma_engine(hwif)) {
@@ -1019,6 +1000,13 @@ void ide_setup_dma (ide_hwif_t *hwif, unsigned long dma_base, unsigned int num_p
1019 return; 1000 return;
1020 } 1001 }
1021 1002
1003 hwif->dma_base = base;
1004
1005 if (hwif->mate)
1006 hwif->dma_master = hwif->channel ? hwif->mate->dma_base : base;
1007 else
1008 hwif->dma_master = base;
1009
1022 if (!(hwif->dma_command)) 1010 if (!(hwif->dma_command))
1023 hwif->dma_command = hwif->dma_base; 1011 hwif->dma_command = hwif->dma_base;
1024 if (!(hwif->dma_vendor1)) 1012 if (!(hwif->dma_vendor1))
diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c
index 32eaa3f80515..c89f0d3058e9 100644
--- a/drivers/ide/ide-io.c
+++ b/drivers/ide/ide-io.c
@@ -55,7 +55,7 @@
55#include <asm/io.h> 55#include <asm/io.h>
56 56
57static int __ide_end_request(ide_drive_t *drive, struct request *rq, 57static int __ide_end_request(ide_drive_t *drive, struct request *rq,
58 int uptodate, unsigned int nr_bytes) 58 int uptodate, unsigned int nr_bytes, int dequeue)
59{ 59{
60 int ret = 1; 60 int ret = 1;
61 61
@@ -80,9 +80,11 @@ static int __ide_end_request(ide_drive_t *drive, struct request *rq,
80 80
81 if (!end_that_request_chunk(rq, uptodate, nr_bytes)) { 81 if (!end_that_request_chunk(rq, uptodate, nr_bytes)) {
82 add_disk_randomness(rq->rq_disk); 82 add_disk_randomness(rq->rq_disk);
83 if (!list_empty(&rq->queuelist)) 83 if (dequeue) {
84 blkdev_dequeue_request(rq); 84 if (!list_empty(&rq->queuelist))
85 HWGROUP(drive)->rq = NULL; 85 blkdev_dequeue_request(rq);
86 HWGROUP(drive)->rq = NULL;
87 }
86 end_that_request_last(rq, uptodate); 88 end_that_request_last(rq, uptodate);
87 ret = 0; 89 ret = 0;
88 } 90 }
@@ -122,7 +124,7 @@ int ide_end_request (ide_drive_t *drive, int uptodate, int nr_sectors)
122 nr_bytes = rq->hard_cur_sectors << 9; 124 nr_bytes = rq->hard_cur_sectors << 9;
123 } 125 }
124 126
125 ret = __ide_end_request(drive, rq, uptodate, nr_bytes); 127 ret = __ide_end_request(drive, rq, uptodate, nr_bytes, 1);
126 128
127 spin_unlock_irqrestore(&ide_lock, flags); 129 spin_unlock_irqrestore(&ide_lock, flags);
128 return ret; 130 return ret;
@@ -255,39 +257,13 @@ int ide_end_dequeued_request(ide_drive_t *drive, struct request *rq,
255 int uptodate, int nr_sectors) 257 int uptodate, int nr_sectors)
256{ 258{
257 unsigned long flags; 259 unsigned long flags;
258 int ret = 1; 260 int ret;
259 261
260 spin_lock_irqsave(&ide_lock, flags); 262 spin_lock_irqsave(&ide_lock, flags);
261
262 BUG_ON(!blk_rq_started(rq)); 263 BUG_ON(!blk_rq_started(rq));
263 264 ret = __ide_end_request(drive, rq, uptodate, nr_sectors << 9, 0);
264 /*
265 * if failfast is set on a request, override number of sectors and
266 * complete the whole request right now
267 */
268 if (blk_noretry_request(rq) && end_io_error(uptodate))
269 nr_sectors = rq->hard_nr_sectors;
270
271 if (!blk_fs_request(rq) && end_io_error(uptodate) && !rq->errors)
272 rq->errors = -EIO;
273
274 /*
275 * decide whether to reenable DMA -- 3 is a random magic for now,
276 * if we DMA timeout more than 3 times, just stay in PIO
277 */
278 if (drive->state == DMA_PIO_RETRY && drive->retry_pio <= 3) {
279 drive->state = 0;
280 HWGROUP(drive)->hwif->ide_dma_on(drive);
281 }
282
283 if (!end_that_request_first(rq, uptodate, nr_sectors)) {
284 add_disk_randomness(rq->rq_disk);
285 if (blk_rq_tagged(rq))
286 blk_queue_end_tag(drive->queue, rq);
287 end_that_request_last(rq, uptodate);
288 ret = 0;
289 }
290 spin_unlock_irqrestore(&ide_lock, flags); 265 spin_unlock_irqrestore(&ide_lock, flags);
266
291 return ret; 267 return ret;
292} 268}
293EXPORT_SYMBOL_GPL(ide_end_dequeued_request); 269EXPORT_SYMBOL_GPL(ide_end_dequeued_request);
@@ -800,7 +776,20 @@ static ide_startstop_t do_special (ide_drive_t *drive)
800 s->b.set_tune = 0; 776 s->b.set_tune = 0;
801 777
802 if (set_pio_mode_abuse(drive->hwif, req_pio)) { 778 if (set_pio_mode_abuse(drive->hwif, req_pio)) {
803 if (hwif->set_pio_mode) 779
780 if (hwif->set_pio_mode == NULL)
781 return ide_stopped;
782
783 /*
784 * take ide_lock for drive->[no_]unmask/[no_]io_32bit
785 */
786 if (req_pio == 8 || req_pio == 9) {
787 unsigned long flags;
788
789 spin_lock_irqsave(&ide_lock, flags);
790 hwif->set_pio_mode(drive, req_pio);
791 spin_unlock_irqrestore(&ide_lock, flags);
792 } else
804 hwif->set_pio_mode(drive, req_pio); 793 hwif->set_pio_mode(drive, req_pio);
805 } else { 794 } else {
806 int keep_dma = drive->using_dma; 795 int keep_dma = drive->using_dma;
diff --git a/drivers/ide/ide-iops.c b/drivers/ide/ide-iops.c
index d4d790f91f91..95168833d069 100644
--- a/drivers/ide/ide-iops.c
+++ b/drivers/ide/ide-iops.c
@@ -693,35 +693,16 @@ static u8 ide_auto_reduce_xfer (ide_drive_t *drive)
693} 693}
694#endif /* CONFIG_BLK_DEV_IDEDMA */ 694#endif /* CONFIG_BLK_DEV_IDEDMA */
695 695
696/* 696int ide_driveid_update(ide_drive_t *drive)
697 * Update the
698 */
699int ide_driveid_update (ide_drive_t *drive)
700{ 697{
701 ide_hwif_t *hwif = HWIF(drive); 698 ide_hwif_t *hwif = drive->hwif;
702 struct hd_driveid *id; 699 struct hd_driveid *id;
703#if 0 700 unsigned long timeout, flags;
704 id = kmalloc(SECTOR_WORDS*4, GFP_ATOMIC);
705 if (!id)
706 return 0;
707
708 taskfile_lib_get_identify(drive, (char *)&id);
709 701
710 ide_fix_driveid(id);
711 if (id) {
712 drive->id->dma_ultra = id->dma_ultra;
713 drive->id->dma_mword = id->dma_mword;
714 drive->id->dma_1word = id->dma_1word;
715 /* anything more ? */
716 kfree(id);
717 }
718 return 1;
719#else
720 /* 702 /*
721 * Re-read drive->id for possible DMA mode 703 * Re-read drive->id for possible DMA mode
722 * change (copied from ide-probe.c) 704 * change (copied from ide-probe.c)
723 */ 705 */
724 unsigned long timeout, flags;
725 706
726 SELECT_MASK(drive, 1); 707 SELECT_MASK(drive, 1);
727 if (IDE_CONTROL_REG) 708 if (IDE_CONTROL_REG)
@@ -763,7 +744,6 @@ int ide_driveid_update (ide_drive_t *drive)
763 } 744 }
764 745
765 return 1; 746 return 1;
766#endif
767} 747}
768 748
769int ide_config_drive_speed(ide_drive_t *drive, u8 speed) 749int ide_config_drive_speed(ide_drive_t *drive, u8 speed)
diff --git a/drivers/ide/ide-pnp.c b/drivers/ide/ide-pnp.c
index 2b8009c50e91..e245521af7b5 100644
--- a/drivers/ide/ide-pnp.c
+++ b/drivers/ide/ide-pnp.c
@@ -40,9 +40,8 @@ static int idepnp_probe(struct pnp_dev * dev, const struct pnp_device_id *dev_id
40 ide_std_init_ports(&hw, pnp_port_start(dev, 0), 40 ide_std_init_ports(&hw, pnp_port_start(dev, 0),
41 pnp_port_start(dev, 1)); 41 pnp_port_start(dev, 1));
42 hw.irq = pnp_irq(dev, 0); 42 hw.irq = pnp_irq(dev, 0);
43 hw.dma = NO_DMA;
44 43
45 index = ide_register_hw(&hw, 1, &hwif); 44 index = ide_register_hw(&hw, NULL, 1, &hwif);
46 45
47 if (index != -1) { 46 if (index != -1) {
48 printk(KERN_INFO "ide%d: generic PnP IDE interface\n", index); 47 printk(KERN_INFO "ide%d: generic PnP IDE interface\n", index);
diff --git a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c
index e294c7415c27..d5146c57e5b3 100644
--- a/drivers/ide/ide-probe.c
+++ b/drivers/ide/ide-probe.c
@@ -717,7 +717,7 @@ EXPORT_SYMBOL_GPL(ide_undecoded_slave);
717 * This routine only knows how to look for drive units 0 and 1 717 * This routine only knows how to look for drive units 0 and 1
718 * on an interface, so any setting of MAX_DRIVES > 2 won't work here. 718 * on an interface, so any setting of MAX_DRIVES > 2 won't work here.
719 */ 719 */
720static void probe_hwif(ide_hwif_t *hwif, void (*fixup)(ide_hwif_t *hwif)) 720static void probe_hwif(ide_hwif_t *hwif)
721{ 721{
722 unsigned long flags; 722 unsigned long flags;
723 unsigned int irqd; 723 unsigned int irqd;
@@ -819,8 +819,8 @@ static void probe_hwif(ide_hwif_t *hwif, void (*fixup)(ide_hwif_t *hwif))
819 return; 819 return;
820 } 820 }
821 821
822 if (fixup) 822 if (hwif->fixup)
823 fixup(hwif); 823 hwif->fixup(hwif);
824 824
825 for (unit = 0; unit < MAX_DRIVES; ++unit) { 825 for (unit = 0; unit < MAX_DRIVES; ++unit) {
826 ide_drive_t *drive = &hwif->drives[unit]; 826 ide_drive_t *drive = &hwif->drives[unit];
@@ -859,10 +859,11 @@ static void probe_hwif(ide_hwif_t *hwif, void (*fixup)(ide_hwif_t *hwif))
859} 859}
860 860
861static int hwif_init(ide_hwif_t *hwif); 861static int hwif_init(ide_hwif_t *hwif);
862static void hwif_register_devices(ide_hwif_t *hwif);
862 863
863int probe_hwif_init_with_fixup(ide_hwif_t *hwif, void (*fixup)(ide_hwif_t *hwif)) 864static int probe_hwif_init(ide_hwif_t *hwif)
864{ 865{
865 probe_hwif(hwif, fixup); 866 probe_hwif(hwif);
866 867
867 if (!hwif_init(hwif)) { 868 if (!hwif_init(hwif)) {
868 printk(KERN_INFO "%s: failed to initialize IDE interface\n", 869 printk(KERN_INFO "%s: failed to initialize IDE interface\n",
@@ -870,34 +871,12 @@ int probe_hwif_init_with_fixup(ide_hwif_t *hwif, void (*fixup)(ide_hwif_t *hwif)
870 return -1; 871 return -1;
871 } 872 }
872 873
873 if (hwif->present) { 874 if (hwif->present)
874 u16 unit = 0; 875 hwif_register_devices(hwif);
875 int ret;
876 876
877 for (unit = 0; unit < MAX_DRIVES; ++unit) {
878 ide_drive_t *drive = &hwif->drives[unit];
879 /* For now don't attach absent drives, we may
880 want them on default or a new "empty" class
881 for hotplug reprobing ? */
882 if (drive->present) {
883 ret = device_register(&drive->gendev);
884 if (ret < 0)
885 printk(KERN_WARNING "IDE: %s: "
886 "device_register error: %d\n",
887 __FUNCTION__, ret);
888 }
889 }
890 }
891 return 0; 877 return 0;
892} 878}
893 879
894int probe_hwif_init(ide_hwif_t *hwif)
895{
896 return probe_hwif_init_with_fixup(hwif, NULL);
897}
898
899EXPORT_SYMBOL(probe_hwif_init);
900
901#if MAX_HWIFS > 1 880#if MAX_HWIFS > 1
902/* 881/*
903 * save_match() is used to simplify logic in init_irq() below. 882 * save_match() is used to simplify logic in init_irq() below.
@@ -1379,6 +1358,24 @@ out:
1379 return 0; 1358 return 0;
1380} 1359}
1381 1360
1361static void hwif_register_devices(ide_hwif_t *hwif)
1362{
1363 unsigned int i;
1364
1365 for (i = 0; i < MAX_DRIVES; i++) {
1366 ide_drive_t *drive = &hwif->drives[i];
1367
1368 if (drive->present) {
1369 int ret = device_register(&drive->gendev);
1370
1371 if (ret < 0)
1372 printk(KERN_WARNING "IDE: %s: "
1373 "device_register error: %d\n",
1374 __FUNCTION__, ret);
1375 }
1376 }
1377}
1378
1382int ideprobe_init (void) 1379int ideprobe_init (void)
1383{ 1380{
1384 unsigned int index; 1381 unsigned int index;
@@ -1390,27 +1387,18 @@ int ideprobe_init (void)
1390 1387
1391 for (index = 0; index < MAX_HWIFS; ++index) 1388 for (index = 0; index < MAX_HWIFS; ++index)
1392 if (probe[index]) 1389 if (probe[index])
1393 probe_hwif(&ide_hwifs[index], NULL); 1390 probe_hwif(&ide_hwifs[index]);
1394 for (index = 0; index < MAX_HWIFS; ++index) 1391 for (index = 0; index < MAX_HWIFS; ++index)
1395 if (probe[index]) 1392 if (probe[index])
1396 hwif_init(&ide_hwifs[index]); 1393 hwif_init(&ide_hwifs[index]);
1397 for (index = 0; index < MAX_HWIFS; ++index) { 1394 for (index = 0; index < MAX_HWIFS; ++index) {
1398 if (probe[index]) { 1395 if (probe[index]) {
1399 ide_hwif_t *hwif = &ide_hwifs[index]; 1396 ide_hwif_t *hwif = &ide_hwifs[index];
1400 int unit;
1401 if (!hwif->present) 1397 if (!hwif->present)
1402 continue; 1398 continue;
1403 if (hwif->chipset == ide_unknown || hwif->chipset == ide_forced) 1399 if (hwif->chipset == ide_unknown || hwif->chipset == ide_forced)
1404 hwif->chipset = ide_generic; 1400 hwif->chipset = ide_generic;
1405 for (unit = 0; unit < MAX_DRIVES; ++unit) 1401 hwif_register_devices(hwif);
1406 if (hwif->drives[unit].present) {
1407 int ret = device_register(
1408 &hwif->drives[unit].gendev);
1409 if (ret < 0)
1410 printk(KERN_WARNING "IDE: %s: "
1411 "device_register error: %d\n",
1412 __FUNCTION__, ret);
1413 }
1414 } 1402 }
1415 } 1403 }
1416 for (index = 0; index < MAX_HWIFS; ++index) 1404 for (index = 0; index < MAX_HWIFS; ++index)
@@ -1420,3 +1408,22 @@ int ideprobe_init (void)
1420} 1408}
1421 1409
1422EXPORT_SYMBOL_GPL(ideprobe_init); 1410EXPORT_SYMBOL_GPL(ideprobe_init);
1411
1412int ide_device_add(u8 idx[4])
1413{
1414 int i, rc = 0;
1415
1416 for (i = 0; i < 4; i++) {
1417 if (idx[i] != 0xff)
1418 rc |= probe_hwif_init(&ide_hwifs[idx[i]]);
1419 }
1420
1421 for (i = 0; i < 4; i++) {
1422 if (idx[i] != 0xff)
1423 ide_proc_register_port(&ide_hwifs[idx[i]]);
1424 }
1425
1426 return rc;
1427}
1428
1429EXPORT_SYMBOL_GPL(ide_device_add);
diff --git a/drivers/ide/ide-proc.c b/drivers/ide/ide-proc.c
index fc1d8ae6a803..a4007d30da52 100644
--- a/drivers/ide/ide-proc.c
+++ b/drivers/ide/ide-proc.c
@@ -804,8 +804,6 @@ void ide_proc_register_port(ide_hwif_t *hwif)
804 create_proc_ide_drives(hwif); 804 create_proc_ide_drives(hwif);
805} 805}
806 806
807EXPORT_SYMBOL_GPL(ide_proc_register_port);
808
809#ifdef CONFIG_BLK_DEV_IDEPCI 807#ifdef CONFIG_BLK_DEV_IDEPCI
810void ide_pci_create_host_proc(const char *name, get_info_t *get_info) 808void ide_pci_create_host_proc(const char *name, get_info_t *get_info)
811{ 809{
diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c
index 1fa57947bca0..e5a86a962b26 100644
--- a/drivers/ide/ide-tape.c
+++ b/drivers/ide/ide-tape.c
@@ -621,7 +621,6 @@ typedef struct os_dat_s {
621 */ 621 */
622#define USE_IOTRACE 0 622#define USE_IOTRACE 0
623#if USE_IOTRACE 623#if USE_IOTRACE
624#include <linux/io_trace.h>
625#define IO_IDETAPE_FIFO 500 624#define IO_IDETAPE_FIFO 500
626#endif 625#endif
627 626
diff --git a/drivers/ide/ide-taskfile.c b/drivers/ide/ide-taskfile.c
index 2a3c8d498343..73ef6bf5fbcc 100644
--- a/drivers/ide/ide-taskfile.c
+++ b/drivers/ide/ide-taskfile.c
@@ -8,23 +8,6 @@
8 * Copyright (C) 2003-2004 Bartlomiej Zolnierkiewicz 8 * Copyright (C) 2003-2004 Bartlomiej Zolnierkiewicz
9 * 9 *
10 * The big the bad and the ugly. 10 * The big the bad and the ugly.
11 *
12 * Problems to be fixed because of BH interface or the lack therefore.
13 *
14 * Fill me in stupid !!!
15 *
16 * HOST:
17 * General refers to the Controller and Driver "pair".
18 * DATA HANDLER:
19 * Under the context of Linux it generally refers to an interrupt handler.
20 * However, it correctly describes the 'HOST'
21 * DATA BLOCK:
22 * The amount of data needed to be transfered as predefined in the
23 * setup of the device.
24 * STORAGE ATOMIC:
25 * The 'DATA BLOCK' associated to the 'DATA HANDLER', and can be as
26 * small as a single sector or as large as the entire command block
27 * request.
28 */ 11 */
29 12
30#include <linux/module.h> 13#include <linux/module.h>
@@ -695,9 +678,6 @@ int ide_wait_cmd (ide_drive_t *drive, u8 cmd, u8 nsect, u8 feature, u8 sectors,
695 return ide_do_drive_cmd(drive, &rq, ide_wait); 678 return ide_do_drive_cmd(drive, &rq, ide_wait);
696} 679}
697 680
698/*
699 * FIXME : this needs to map into at taskfile. <andre@linux-ide.org>
700 */
701int ide_cmd_ioctl (ide_drive_t *drive, unsigned int cmd, unsigned long arg) 681int ide_cmd_ioctl (ide_drive_t *drive, unsigned int cmd, unsigned long arg)
702{ 682{
703 int err = 0; 683 int err = 0;
@@ -761,9 +741,6 @@ static int ide_wait_cmd_task(ide_drive_t *drive, u8 *buf)
761 return ide_do_drive_cmd(drive, &rq, ide_wait); 741 return ide_do_drive_cmd(drive, &rq, ide_wait);
762} 742}
763 743
764/*
765 * FIXME : this needs to map into at taskfile. <andre@linux-ide.org>
766 */
767int ide_task_ioctl (ide_drive_t *drive, unsigned int cmd, unsigned long arg) 744int ide_task_ioctl (ide_drive_t *drive, unsigned int cmd, unsigned long arg)
768{ 745{
769 void __user *p = (void __user *)arg; 746 void __user *p = (void __user *)arg;
@@ -860,9 +837,14 @@ ide_startstop_t flagged_taskfile (ide_drive_t *drive, ide_task_t *task)
860 case TASKFILE_OUT_DMA: 837 case TASKFILE_OUT_DMA:
861 case TASKFILE_IN_DMAQ: 838 case TASKFILE_IN_DMAQ:
862 case TASKFILE_IN_DMA: 839 case TASKFILE_IN_DMA:
863 hwif->dma_setup(drive); 840 if (!drive->using_dma)
864 hwif->dma_exec_cmd(drive, taskfile->command); 841 break;
865 hwif->dma_start(drive); 842
843 if (!hwif->dma_setup(drive)) {
844 hwif->dma_exec_cmd(drive, taskfile->command);
845 hwif->dma_start(drive);
846 return ide_started;
847 }
866 break; 848 break;
867 849
868 default: 850 default:
@@ -876,7 +858,8 @@ ide_startstop_t flagged_taskfile (ide_drive_t *drive, ide_task_t *task)
876 return task->prehandler(drive, task->rq); 858 return task->prehandler(drive, task->rq);
877 } 859 }
878 ide_execute_command(drive, taskfile->command, task->handler, WAIT_WORSTCASE, NULL); 860 ide_execute_command(drive, taskfile->command, task->handler, WAIT_WORSTCASE, NULL);
861 return ide_started;
879 } 862 }
880 863
881 return ide_started; 864 return ide_stopped;
882} 865}
diff --git a/drivers/ide/ide.c b/drivers/ide/ide.c
index 961e6c897286..674a65c1a130 100644
--- a/drivers/ide/ide.c
+++ b/drivers/ide/ide.c
@@ -168,7 +168,6 @@ static void init_hwif_default(ide_hwif_t *hwif, unsigned int index)
168 168
169 ide_init_hwif_ports(&hw, ide_default_io_base(index), 0, &hwif->irq); 169 ide_init_hwif_ports(&hw, ide_default_io_base(index), 0, &hwif->irq);
170 170
171 memcpy(&hwif->hw, &hw, sizeof(hw));
172 memcpy(hwif->io_ports, hw.io_ports, sizeof(hw.io_ports)); 171 memcpy(hwif->io_ports, hw.io_ports, sizeof(hw.io_ports));
173 172
174 hwif->noprobe = !hwif->io_ports[IDE_DATA_OFFSET]; 173 hwif->noprobe = !hwif->io_ports[IDE_DATA_OFFSET];
@@ -214,7 +213,7 @@ static void __init init_ide_data (void)
214 init_hwif_data(hwif, index); 213 init_hwif_data(hwif, index);
215 init_hwif_default(hwif, index); 214 init_hwif_default(hwif, index);
216#if !defined(CONFIG_PPC32) || !defined(CONFIG_PCI) 215#if !defined(CONFIG_PPC32) || !defined(CONFIG_PCI)
217 hwif->irq = hwif->hw.irq = 216 hwif->irq =
218 ide_init_default_irq(hwif->io_ports[IDE_DATA_OFFSET]); 217 ide_init_default_irq(hwif->io_ports[IDE_DATA_OFFSET]);
219#endif 218#endif
220 } 219 }
@@ -265,6 +264,30 @@ static int ide_system_bus_speed(void)
265 return system_bus_speed; 264 return system_bus_speed;
266} 265}
267 266
267ide_hwif_t * ide_find_port(unsigned long base)
268{
269 ide_hwif_t *hwif;
270 int i;
271
272 for (i = 0; i < MAX_HWIFS; i++) {
273 hwif = &ide_hwifs[i];
274 if (hwif->io_ports[IDE_DATA_OFFSET] == base)
275 goto found;
276 }
277
278 for (i = 0; i < MAX_HWIFS; i++) {
279 hwif = &ide_hwifs[i];
280 if (hwif->io_ports[IDE_DATA_OFFSET] == 0)
281 goto found;
282 }
283
284 hwif = NULL;
285found:
286 return hwif;
287}
288
289EXPORT_SYMBOL_GPL(ide_find_port);
290
268static struct resource* hwif_request_region(ide_hwif_t *hwif, 291static struct resource* hwif_request_region(ide_hwif_t *hwif,
269 unsigned long addr, int num) 292 unsigned long addr, int num)
270{ 293{
@@ -391,6 +414,8 @@ static void ide_hwif_restore(ide_hwif_t *hwif, ide_hwif_t *tmp_hwif)
391 hwif->cds = tmp_hwif->cds; 414 hwif->cds = tmp_hwif->cds;
392#endif 415#endif
393 416
417 hwif->fixup = tmp_hwif->fixup;
418
394 hwif->set_pio_mode = tmp_hwif->set_pio_mode; 419 hwif->set_pio_mode = tmp_hwif->set_pio_mode;
395 hwif->set_dma_mode = tmp_hwif->set_dma_mode; 420 hwif->set_dma_mode = tmp_hwif->set_dma_mode;
396 hwif->mdma_filter = tmp_hwif->mdma_filter; 421 hwif->mdma_filter = tmp_hwif->mdma_filter;
@@ -652,7 +677,6 @@ void ide_setup_ports ( hw_regs_t *hw,
652 } 677 }
653 } 678 }
654 hw->irq = irq; 679 hw->irq = irq;
655 hw->dma = NO_DMA;
656 hw->ack_intr = ack_intr; 680 hw->ack_intr = ack_intr;
657/* 681/*
658 * hw->iops = iops; 682 * hw->iops = iops;
@@ -660,11 +684,11 @@ void ide_setup_ports ( hw_regs_t *hw,
660} 684}
661 685
662/** 686/**
663 * ide_register_hw_with_fixup - register IDE interface 687 * ide_register_hw - register IDE interface
664 * @hw: hardware registers 688 * @hw: hardware registers
689 * @fixup: fixup function
665 * @initializing: set while initializing built-in drivers 690 * @initializing: set while initializing built-in drivers
666 * @hwifp: pointer to returned hwif 691 * @hwifp: pointer to returned hwif
667 * @fixup: fixup function
668 * 692 *
669 * Register an IDE interface, specifying exactly the registers etc. 693 * Register an IDE interface, specifying exactly the registers etc.
670 * Set init=1 iff calling before probes have taken place. 694 * Set init=1 iff calling before probes have taken place.
@@ -672,9 +696,8 @@ void ide_setup_ports ( hw_regs_t *hw,
672 * Returns -1 on error. 696 * Returns -1 on error.
673 */ 697 */
674 698
675int ide_register_hw_with_fixup(hw_regs_t *hw, int initializing, 699int ide_register_hw(hw_regs_t *hw, void (*fixup)(ide_hwif_t *),
676 ide_hwif_t **hwifp, 700 int initializing, ide_hwif_t **hwifp)
677 void(*fixup)(ide_hwif_t *hwif))
678{ 701{
679 int index, retry = 1; 702 int index, retry = 1;
680 ide_hwif_t *hwif; 703 ide_hwif_t *hwif;
@@ -682,7 +705,7 @@ int ide_register_hw_with_fixup(hw_regs_t *hw, int initializing,
682 do { 705 do {
683 for (index = 0; index < MAX_HWIFS; ++index) { 706 for (index = 0; index < MAX_HWIFS; ++index) {
684 hwif = &ide_hwifs[index]; 707 hwif = &ide_hwifs[index];
685 if (hwif->hw.io_ports[IDE_DATA_OFFSET] == hw->io_ports[IDE_DATA_OFFSET]) 708 if (hwif->io_ports[IDE_DATA_OFFSET] == hw->io_ports[IDE_DATA_OFFSET])
686 goto found; 709 goto found;
687 } 710 }
688 for (index = 0; index < MAX_HWIFS; ++index) { 711 for (index = 0; index < MAX_HWIFS; ++index) {
@@ -690,7 +713,7 @@ int ide_register_hw_with_fixup(hw_regs_t *hw, int initializing,
690 if (hwif->hold) 713 if (hwif->hold)
691 continue; 714 continue;
692 if ((!hwif->present && !hwif->mate && !initializing) || 715 if ((!hwif->present && !hwif->mate && !initializing) ||
693 (!hwif->hw.io_ports[IDE_DATA_OFFSET] && initializing)) 716 (!hwif->io_ports[IDE_DATA_OFFSET] && initializing))
694 goto found; 717 goto found;
695 } 718 }
696 for (index = 0; index < MAX_HWIFS; index++) 719 for (index = 0; index < MAX_HWIFS; index++)
@@ -706,16 +729,18 @@ found:
706 } 729 }
707 if (hwif->present) 730 if (hwif->present)
708 return -1; 731 return -1;
709 memcpy(&hwif->hw, hw, sizeof(*hw)); 732 memcpy(hwif->io_ports, hw->io_ports, sizeof(hwif->io_ports));
710 memcpy(hwif->io_ports, hwif->hw.io_ports, sizeof(hwif->hw.io_ports));
711 hwif->irq = hw->irq; 733 hwif->irq = hw->irq;
712 hwif->noprobe = 0; 734 hwif->noprobe = 0;
735 hwif->fixup = fixup;
713 hwif->chipset = hw->chipset; 736 hwif->chipset = hw->chipset;
714 hwif->gendev.parent = hw->dev; 737 hwif->gendev.parent = hw->dev;
738 hwif->ack_intr = hw->ack_intr;
739
740 if (initializing == 0) {
741 u8 idx[4] = { index, 0xff, 0xff, 0xff };
715 742
716 if (!initializing) { 743 ide_device_add(idx);
717 probe_hwif_init_with_fixup(hwif, fixup);
718 ide_proc_register_port(hwif);
719 } 744 }
720 745
721 if (hwifp) 746 if (hwifp)
@@ -724,13 +749,6 @@ found:
724 return (initializing || hwif->present) ? index : -1; 749 return (initializing || hwif->present) ? index : -1;
725} 750}
726 751
727EXPORT_SYMBOL(ide_register_hw_with_fixup);
728
729int ide_register_hw(hw_regs_t *hw, int initializing, ide_hwif_t **hwifp)
730{
731 return ide_register_hw_with_fixup(hw, initializing, hwifp, NULL);
732}
733
734EXPORT_SYMBOL(ide_register_hw); 752EXPORT_SYMBOL(ide_register_hw);
735 753
736/* 754/*
@@ -1046,7 +1064,7 @@ int generic_ide_ioctl(ide_drive_t *drive, struct file *file, struct block_device
1046 ide_init_hwif_ports(&hw, (unsigned long) args[0], 1064 ide_init_hwif_ports(&hw, (unsigned long) args[0],
1047 (unsigned long) args[1], NULL); 1065 (unsigned long) args[1], NULL);
1048 hw.irq = args[2]; 1066 hw.irq = args[2];
1049 if (ide_register_hw(&hw, 0, NULL) == -1) 1067 if (ide_register_hw(&hw, NULL, 0, NULL) == -1)
1050 return -EIO; 1068 return -EIO;
1051 return 0; 1069 return 0;
1052 } 1070 }
@@ -1397,6 +1415,9 @@ static int __init ide_setup(char *s)
1397 "reset", "minus6", "ata66", "minus8", "minus9", 1415 "reset", "minus6", "ata66", "minus8", "minus9",
1398 "minus10", "four", "qd65xx", "ht6560b", "cmd640_vlb", 1416 "minus10", "four", "qd65xx", "ht6560b", "cmd640_vlb",
1399 "dtc2278", "umc8672", "ali14xx", NULL }; 1417 "dtc2278", "umc8672", "ali14xx", NULL };
1418
1419 hw_regs_t hwregs;
1420
1400 hw = s[3] - '0'; 1421 hw = s[3] - '0';
1401 hwif = &ide_hwifs[hw]; 1422 hwif = &ide_hwifs[hw];
1402 i = match_parm(&s[4], ide_words, vals, 3); 1423 i = match_parm(&s[4], ide_words, vals, 3);
@@ -1506,9 +1527,9 @@ static int __init ide_setup(char *s)
1506 case 2: /* base,ctl */ 1527 case 2: /* base,ctl */
1507 vals[2] = 0; /* default irq = probe for it */ 1528 vals[2] = 0; /* default irq = probe for it */
1508 case 3: /* base,ctl,irq */ 1529 case 3: /* base,ctl,irq */
1509 hwif->hw.irq = vals[2]; 1530 memset(&hwregs, 0, sizeof(hwregs));
1510 ide_init_hwif_ports(&hwif->hw, (unsigned long) vals[0], (unsigned long) vals[1], &hwif->irq); 1531 ide_init_hwif_ports(&hwregs, vals[0], vals[1], &hwif->irq);
1511 memcpy(hwif->io_ports, hwif->hw.io_ports, sizeof(hwif->io_ports)); 1532 memcpy(hwif->io_ports, hwregs.io_ports, sizeof(hwif->io_ports));
1512 hwif->irq = vals[2]; 1533 hwif->irq = vals[2];
1513 hwif->noprobe = 0; 1534 hwif->noprobe = 0;
1514 hwif->chipset = ide_forced; 1535 hwif->chipset = ide_forced;
diff --git a/drivers/ide/legacy/ali14xx.c b/drivers/ide/legacy/ali14xx.c
index 2f0ef9b44033..10311ecc674a 100644
--- a/drivers/ide/legacy/ali14xx.c
+++ b/drivers/ide/legacy/ali14xx.c
@@ -102,6 +102,8 @@ static void outReg (u8 data, u8 reg)
102 outb_p(data, dataPort); 102 outb_p(data, dataPort);
103} 103}
104 104
105static DEFINE_SPINLOCK(ali14xx_lock);
106
105/* 107/*
106 * Set PIO mode for the specified drive. 108 * Set PIO mode for the specified drive.
107 * This function computes timing parameters 109 * This function computes timing parameters
@@ -129,14 +131,14 @@ static void ali14xx_set_pio_mode(ide_drive_t *drive, const u8 pio)
129 131
130 /* stuff timing parameters into controller registers */ 132 /* stuff timing parameters into controller registers */
131 driveNum = (HWIF(drive)->index << 1) + drive->select.b.unit; 133 driveNum = (HWIF(drive)->index << 1) + drive->select.b.unit;
132 spin_lock_irqsave(&ide_lock, flags); 134 spin_lock_irqsave(&ali14xx_lock, flags);
133 outb_p(regOn, basePort); 135 outb_p(regOn, basePort);
134 outReg(param1, regTab[driveNum].reg1); 136 outReg(param1, regTab[driveNum].reg1);
135 outReg(param2, regTab[driveNum].reg2); 137 outReg(param2, regTab[driveNum].reg2);
136 outReg(param3, regTab[driveNum].reg3); 138 outReg(param3, regTab[driveNum].reg3);
137 outReg(param4, regTab[driveNum].reg4); 139 outReg(param4, regTab[driveNum].reg4);
138 outb_p(regOff, basePort); 140 outb_p(regOff, basePort);
139 spin_unlock_irqrestore(&ide_lock, flags); 141 spin_unlock_irqrestore(&ali14xx_lock, flags);
140} 142}
141 143
142/* 144/*
@@ -193,6 +195,7 @@ static int __init initRegisters (void) {
193static int __init ali14xx_probe(void) 195static int __init ali14xx_probe(void)
194{ 196{
195 ide_hwif_t *hwif, *mate; 197 ide_hwif_t *hwif, *mate;
198 static u8 idx[4] = { 0, 1, 0xff, 0xff };
196 199
197 printk(KERN_DEBUG "ali14xx: base=0x%03x, regOn=0x%02x.\n", 200 printk(KERN_DEBUG "ali14xx: base=0x%03x, regOn=0x%02x.\n",
198 basePort, regOn); 201 basePort, regOn);
@@ -217,11 +220,7 @@ static int __init ali14xx_probe(void)
217 mate->mate = hwif; 220 mate->mate = hwif;
218 mate->channel = 1; 221 mate->channel = 1;
219 222
220 probe_hwif_init(hwif); 223 ide_device_add(idx);
221 probe_hwif_init(mate);
222
223 ide_proc_register_port(hwif);
224 ide_proc_register_port(mate);
225 224
226 return 0; 225 return 0;
227} 226}
diff --git a/drivers/ide/legacy/buddha.c b/drivers/ide/legacy/buddha.c
index 101aee1711c4..4a0be251a05f 100644
--- a/drivers/ide/legacy/buddha.c
+++ b/drivers/ide/legacy/buddha.c
@@ -212,8 +212,8 @@ fail_base2:
212// xsurf_iops, 212// xsurf_iops,
213 IRQ_AMIGA_PORTS); 213 IRQ_AMIGA_PORTS);
214 } 214 }
215 215
216 index = ide_register_hw(&hw, 1, &hwif); 216 index = ide_register_hw(&hw, NULL, 1, &hwif);
217 if (index != -1) { 217 if (index != -1) {
218 hwif->mmio = 1; 218 hwif->mmio = 1;
219 printk("ide%d: ", index); 219 printk("ide%d: ", index);
diff --git a/drivers/ide/legacy/dtc2278.c b/drivers/ide/legacy/dtc2278.c
index f16521254867..24a845d45bd2 100644
--- a/drivers/ide/legacy/dtc2278.c
+++ b/drivers/ide/legacy/dtc2278.c
@@ -67,20 +67,24 @@ static void sub22 (char b, char c)
67 } 67 }
68} 68}
69 69
70static DEFINE_SPINLOCK(dtc2278_lock);
71
70static void dtc2278_set_pio_mode(ide_drive_t *drive, const u8 pio) 72static void dtc2278_set_pio_mode(ide_drive_t *drive, const u8 pio)
71{ 73{
72 unsigned long flags; 74 unsigned long flags;
73 75
74 if (pio >= 3) { 76 if (pio >= 3) {
75 spin_lock_irqsave(&ide_lock, flags); 77 spin_lock_irqsave(&dtc2278_lock, flags);
76 /* 78 /*
77 * This enables PIO mode4 (3?) on the first interface 79 * This enables PIO mode4 (3?) on the first interface
78 */ 80 */
79 sub22(1,0xc3); 81 sub22(1,0xc3);
80 sub22(0,0xa0); 82 sub22(0,0xa0);
81 spin_unlock_irqrestore(&ide_lock, flags); 83 spin_unlock_irqrestore(&dtc2278_lock, flags);
82 } else { 84 } else {
83 /* we don't know how to set it back again.. */ 85 /* we don't know how to set it back again.. */
86 /* Actually we do - there is a data sheet available for the
87 Winbond but does anyone actually care */
84 } 88 }
85 89
86 /* 90 /*
@@ -94,6 +98,7 @@ static int __init dtc2278_probe(void)
94{ 98{
95 unsigned long flags; 99 unsigned long flags;
96 ide_hwif_t *hwif, *mate; 100 ide_hwif_t *hwif, *mate;
101 static u8 idx[4] = { 0, 1, 0xff, 0xff };
97 102
98 hwif = &ide_hwifs[0]; 103 hwif = &ide_hwifs[0];
99 mate = &ide_hwifs[1]; 104 mate = &ide_hwifs[1];
@@ -129,16 +134,13 @@ static int __init dtc2278_probe(void)
129 134
130 mate->serialized = 1; 135 mate->serialized = 1;
131 mate->chipset = ide_dtc2278; 136 mate->chipset = ide_dtc2278;
137 mate->pio_mask = ATA_PIO4;
132 mate->drives[0].no_unmask = 1; 138 mate->drives[0].no_unmask = 1;
133 mate->drives[1].no_unmask = 1; 139 mate->drives[1].no_unmask = 1;
134 mate->mate = hwif; 140 mate->mate = hwif;
135 mate->channel = 1; 141 mate->channel = 1;
136 142
137 probe_hwif_init(hwif); 143 ide_device_add(idx);
138 probe_hwif_init(mate);
139
140 ide_proc_register_port(hwif);
141 ide_proc_register_port(mate);
142 144
143 return 0; 145 return 0;
144} 146}
diff --git a/drivers/ide/legacy/falconide.c b/drivers/ide/legacy/falconide.c
index f0829b83e970..7d7936f1b900 100644
--- a/drivers/ide/legacy/falconide.c
+++ b/drivers/ide/legacy/falconide.c
@@ -72,7 +72,7 @@ void __init falconide_init(void)
72 0, 0, NULL, 72 0, 0, NULL,
73// falconide_iops, 73// falconide_iops,
74 IRQ_MFP_IDE); 74 IRQ_MFP_IDE);
75 index = ide_register_hw(&hw, 1, NULL); 75 index = ide_register_hw(&hw, NULL, 1, NULL);
76 76
77 if (index != -1) 77 if (index != -1)
78 printk("ide%d: Falcon IDE interface\n", index); 78 printk("ide%d: Falcon IDE interface\n", index);
diff --git a/drivers/ide/legacy/gayle.c b/drivers/ide/legacy/gayle.c
index 0830a021bbb6..53331ee1e957 100644
--- a/drivers/ide/legacy/gayle.c
+++ b/drivers/ide/legacy/gayle.c
@@ -165,7 +165,7 @@ found:
165// &gayle_iops, 165// &gayle_iops,
166 IRQ_AMIGA_PORTS); 166 IRQ_AMIGA_PORTS);
167 167
168 index = ide_register_hw(&hw, 1, &hwif); 168 index = ide_register_hw(&hw, NULL, 1, &hwif);
169 if (index != -1) { 169 if (index != -1) {
170 hwif->mmio = 1; 170 hwif->mmio = 1;
171 switch (i) { 171 switch (i) {
diff --git a/drivers/ide/legacy/ht6560b.c b/drivers/ide/legacy/ht6560b.c
index 2e5a9cc5c0f7..a4245d13f11b 100644
--- a/drivers/ide/legacy/ht6560b.c
+++ b/drivers/ide/legacy/ht6560b.c
@@ -247,6 +247,8 @@ static u8 ht_pio2timings(ide_drive_t *drive, const u8 pio)
247 } 247 }
248} 248}
249 249
250static DEFINE_SPINLOCK(ht6560b_lock);
251
250/* 252/*
251 * Enable/Disable so called prefetch mode 253 * Enable/Disable so called prefetch mode
252 */ 254 */
@@ -254,9 +256,9 @@ static void ht_set_prefetch(ide_drive_t *drive, u8 state)
254{ 256{
255 unsigned long flags; 257 unsigned long flags;
256 int t = HT_PREFETCH_MODE << 8; 258 int t = HT_PREFETCH_MODE << 8;
257 259
258 spin_lock_irqsave(&ide_lock, flags); 260 spin_lock_irqsave(&ht6560b_lock, flags);
259 261
260 /* 262 /*
261 * Prefetch mode and unmask irq seems to conflict 263 * Prefetch mode and unmask irq seems to conflict
262 */ 264 */
@@ -268,9 +270,9 @@ static void ht_set_prefetch(ide_drive_t *drive, u8 state)
268 drive->drive_data &= ~t; /* disable prefetch mode */ 270 drive->drive_data &= ~t; /* disable prefetch mode */
269 drive->no_unmask = 0; 271 drive->no_unmask = 0;
270 } 272 }
271 273
272 spin_unlock_irqrestore(&ide_lock, flags); 274 spin_unlock_irqrestore(&ht6560b_lock, flags);
273 275
274#ifdef DEBUG 276#ifdef DEBUG
275 printk("ht6560b: drive %s prefetch mode %sabled\n", drive->name, (state ? "en" : "dis")); 277 printk("ht6560b: drive %s prefetch mode %sabled\n", drive->name, (state ? "en" : "dis"));
276#endif 278#endif
@@ -287,16 +289,14 @@ static void ht6560b_set_pio_mode(ide_drive_t *drive, const u8 pio)
287 ht_set_prefetch(drive, pio & 1); 289 ht_set_prefetch(drive, pio & 1);
288 return; 290 return;
289 } 291 }
290 292
291 timing = ht_pio2timings(drive, pio); 293 timing = ht_pio2timings(drive, pio);
292 294
293 spin_lock_irqsave(&ide_lock, flags); 295 spin_lock_irqsave(&ht6560b_lock, flags);
294
295 drive->drive_data &= 0xff00; 296 drive->drive_data &= 0xff00;
296 drive->drive_data |= timing; 297 drive->drive_data |= timing;
297 298 spin_unlock_irqrestore(&ht6560b_lock, flags);
298 spin_unlock_irqrestore(&ide_lock, flags); 299
299
300#ifdef DEBUG 300#ifdef DEBUG
301 printk("ht6560b: drive %s tuned to pio mode %#x timing=%#x\n", drive->name, pio, timing); 301 printk("ht6560b: drive %s tuned to pio mode %#x timing=%#x\n", drive->name, pio, timing);
302#endif 302#endif
@@ -311,6 +311,7 @@ MODULE_PARM_DESC(probe, "probe for HT6560B chipset");
311int __init ht6560b_init(void) 311int __init ht6560b_init(void)
312{ 312{
313 ide_hwif_t *hwif, *mate; 313 ide_hwif_t *hwif, *mate;
314 static u8 idx[4] = { 0, 1, 0xff, 0xff };
314 int t; 315 int t;
315 316
316 if (probe_ht6560b == 0) 317 if (probe_ht6560b == 0)
@@ -359,11 +360,7 @@ int __init ht6560b_init(void)
359 mate->drives[0].drive_data = t; 360 mate->drives[0].drive_data = t;
360 mate->drives[1].drive_data = t; 361 mate->drives[1].drive_data = t;
361 362
362 probe_hwif_init(hwif); 363 ide_device_add(idx);
363 probe_hwif_init(mate);
364
365 ide_proc_register_port(hwif);
366 ide_proc_register_port(mate);
367 364
368 return 0; 365 return 0;
369 366
diff --git a/drivers/ide/legacy/ide-cs.c b/drivers/ide/legacy/ide-cs.c
index e8e360c2619d..03715c058664 100644
--- a/drivers/ide/legacy/ide-cs.c
+++ b/drivers/ide/legacy/ide-cs.c
@@ -153,7 +153,7 @@ static int idecs_register(unsigned long io, unsigned long ctl, unsigned long irq
153 hw.irq = irq; 153 hw.irq = irq;
154 hw.chipset = ide_pci; 154 hw.chipset = ide_pci;
155 hw.dev = &handle->dev; 155 hw.dev = &handle->dev;
156 return ide_register_hw_with_fixup(&hw, 0, NULL, ide_undecoded_slave); 156 return ide_register_hw(&hw, &ide_undecoded_slave, 0, NULL);
157} 157}
158 158
159/*====================================================================== 159/*======================================================================
diff --git a/drivers/ide/legacy/ide_platform.c b/drivers/ide/legacy/ide_platform.c
index b992b2b91fe2..7bb79f53dac8 100644
--- a/drivers/ide/legacy/ide_platform.c
+++ b/drivers/ide/legacy/ide_platform.c
@@ -33,39 +33,24 @@ static ide_hwif_t *__devinit plat_ide_locate_hwif(void __iomem *base,
33 int mmio) 33 int mmio)
34{ 34{
35 unsigned long port = (unsigned long)base; 35 unsigned long port = (unsigned long)base;
36 ide_hwif_t *hwif; 36 ide_hwif_t *hwif = ide_find_port(port);
37 int index, i; 37 int i;
38
39 for (index = 0; index < MAX_HWIFS; ++index) {
40 hwif = ide_hwifs + index;
41 if (hwif->io_ports[IDE_DATA_OFFSET] == port)
42 goto found;
43 }
44
45 for (index = 0; index < MAX_HWIFS; ++index) {
46 hwif = ide_hwifs + index;
47 if (hwif->io_ports[IDE_DATA_OFFSET] == 0)
48 goto found;
49 }
50 38
51 return NULL; 39 if (hwif == NULL)
52 40 goto out;
53found:
54 41
55 hwif->hw.io_ports[IDE_DATA_OFFSET] = port; 42 hwif->io_ports[IDE_DATA_OFFSET] = port;
56 43
57 port += (1 << pdata->ioport_shift); 44 port += (1 << pdata->ioport_shift);
58 for (i = IDE_ERROR_OFFSET; i <= IDE_STATUS_OFFSET; 45 for (i = IDE_ERROR_OFFSET; i <= IDE_STATUS_OFFSET;
59 i++, port += (1 << pdata->ioport_shift)) 46 i++, port += (1 << pdata->ioport_shift))
60 hwif->hw.io_ports[i] = port; 47 hwif->io_ports[i] = port;
61 48
62 hwif->hw.io_ports[IDE_CONTROL_OFFSET] = (unsigned long)ctrl; 49 hwif->io_ports[IDE_CONTROL_OFFSET] = (unsigned long)ctrl;
63 50
64 memcpy(hwif->io_ports, hwif->hw.io_ports, sizeof(hwif->hw.io_ports)); 51 hwif->irq = irq;
65 hwif->hw.irq = hwif->irq = irq;
66 52
67 hwif->hw.dma = NO_DMA; 53 hwif->chipset = ide_generic;
68 hwif->chipset = hwif->hw.chipset = ide_generic;
69 54
70 if (mmio) { 55 if (mmio) {
71 hwif->mmio = 1; 56 hwif->mmio = 1;
@@ -73,8 +58,8 @@ found:
73 } 58 }
74 59
75 hwif_prop.hwif = hwif; 60 hwif_prop.hwif = hwif;
76 hwif_prop.index = index; 61 hwif_prop.index = hwif->index;
77 62out:
78 return hwif; 63 return hwif;
79} 64}
80 65
@@ -83,6 +68,7 @@ static int __devinit plat_ide_probe(struct platform_device *pdev)
83 struct resource *res_base, *res_alt, *res_irq; 68 struct resource *res_base, *res_alt, *res_irq;
84 ide_hwif_t *hwif; 69 ide_hwif_t *hwif;
85 struct pata_platform_info *pdata; 70 struct pata_platform_info *pdata;
71 u8 idx[4] = { 0xff, 0xff, 0xff, 0xff };
86 int ret = 0; 72 int ret = 0;
87 int mmio = 0; 73 int mmio = 0;
88 74
@@ -130,10 +116,11 @@ static int __devinit plat_ide_probe(struct platform_device *pdev)
130 hwif->gendev.parent = &pdev->dev; 116 hwif->gendev.parent = &pdev->dev;
131 hwif->noprobe = 0; 117 hwif->noprobe = 0;
132 118
133 probe_hwif_init(hwif); 119 idx[0] = hwif->index;
120
121 ide_device_add(idx);
134 122
135 platform_set_drvdata(pdev, hwif); 123 platform_set_drvdata(pdev, hwif);
136 ide_proc_register_port(hwif);
137 124
138 return 0; 125 return 0;
139 126
diff --git a/drivers/ide/legacy/macide.c b/drivers/ide/legacy/macide.c
index b557c45a5a9d..e87cd2f16430 100644
--- a/drivers/ide/legacy/macide.c
+++ b/drivers/ide/legacy/macide.c
@@ -93,21 +93,21 @@ void macide_init(void)
93 0, 0, macide_ack_intr, 93 0, 0, macide_ack_intr,
94// quadra_ide_iops, 94// quadra_ide_iops,
95 IRQ_NUBUS_F); 95 IRQ_NUBUS_F);
96 index = ide_register_hw(&hw, 1, &hwif); 96 index = ide_register_hw(&hw, NULL, 1, &hwif);
97 break; 97 break;
98 case MAC_IDE_PB: 98 case MAC_IDE_PB:
99 ide_setup_ports(&hw, IDE_BASE, macide_offsets, 99 ide_setup_ports(&hw, IDE_BASE, macide_offsets,
100 0, 0, macide_ack_intr, 100 0, 0, macide_ack_intr,
101// macide_pb_iops, 101// macide_pb_iops,
102 IRQ_NUBUS_C); 102 IRQ_NUBUS_C);
103 index = ide_register_hw(&hw, 1, &hwif); 103 index = ide_register_hw(&hw, NULL, 1, &hwif);
104 break; 104 break;
105 case MAC_IDE_BABOON: 105 case MAC_IDE_BABOON:
106 ide_setup_ports(&hw, BABOON_BASE, macide_offsets, 106 ide_setup_ports(&hw, BABOON_BASE, macide_offsets,
107 0, 0, NULL, 107 0, 0, NULL,
108// macide_baboon_iops, 108// macide_baboon_iops,
109 IRQ_BABOON_1); 109 IRQ_BABOON_1);
110 index = ide_register_hw(&hw, 1, &hwif); 110 index = ide_register_hw(&hw, NULL, 1, &hwif);
111 if (index == -1) break; 111 if (index == -1) break;
112 if (macintosh_config->ident == MAC_MODEL_PB190) { 112 if (macintosh_config->ident == MAC_MODEL_PB190) {
113 113
diff --git a/drivers/ide/legacy/q40ide.c b/drivers/ide/legacy/q40ide.c
index e628a983ce33..44cdb745a6ff 100644
--- a/drivers/ide/legacy/q40ide.c
+++ b/drivers/ide/legacy/q40ide.c
@@ -89,9 +89,8 @@ void q40_ide_setup_ports ( hw_regs_t *hw,
89 else 89 else
90 hw->io_ports[i] = Q40_ISA_IO_B(base + offsets[i]); 90 hw->io_ports[i] = Q40_ISA_IO_B(base + offsets[i]);
91 } 91 }
92 92
93 hw->irq = irq; 93 hw->irq = irq;
94 hw->dma = NO_DMA;
95 hw->ack_intr = ack_intr; 94 hw->ack_intr = ack_intr;
96/* 95/*
97 * hw->iops = iops; 96 * hw->iops = iops;
@@ -142,7 +141,7 @@ void q40ide_init(void)
142 0, NULL, 141 0, NULL,
143// m68kide_iops, 142// m68kide_iops,
144 q40ide_default_irq(pcide_bases[i])); 143 q40ide_default_irq(pcide_bases[i]));
145 index = ide_register_hw(&hw, 1, &hwif); 144 index = ide_register_hw(&hw, NULL, 1, &hwif);
146 // **FIXME** 145 // **FIXME**
147 if (index != -1) 146 if (index != -1)
148 hwif->mmio = 1; 147 hwif->mmio = 1;
diff --git a/drivers/ide/legacy/qd65xx.c b/drivers/ide/legacy/qd65xx.c
index 0c81d2d0b941..912e73853faa 100644
--- a/drivers/ide/legacy/qd65xx.c
+++ b/drivers/ide/legacy/qd65xx.c
@@ -89,26 +89,6 @@
89 89
90static int timings[4]={-1,-1,-1,-1}; /* stores current timing for each timer */ 90static int timings[4]={-1,-1,-1,-1}; /* stores current timing for each timer */
91 91
92static void qd_write_reg (u8 content, unsigned long reg)
93{
94 unsigned long flags;
95
96 spin_lock_irqsave(&ide_lock, flags);
97 outb(content,reg);
98 spin_unlock_irqrestore(&ide_lock, flags);
99}
100
101static u8 __init qd_read_reg (unsigned long reg)
102{
103 unsigned long flags;
104 u8 read;
105
106 spin_lock_irqsave(&ide_lock, flags);
107 read = inb(reg);
108 spin_unlock_irqrestore(&ide_lock, flags);
109 return read;
110}
111
112/* 92/*
113 * qd_select: 93 * qd_select:
114 * 94 *
@@ -121,7 +101,7 @@ static void qd_select (ide_drive_t *drive)
121 (QD_TIMREG(drive) & 0x02); 101 (QD_TIMREG(drive) & 0x02);
122 102
123 if (timings[index] != QD_TIMING(drive)) 103 if (timings[index] != QD_TIMING(drive))
124 qd_write_reg(timings[index] = QD_TIMING(drive), QD_TIMREG(drive)); 104 outb(timings[index] = QD_TIMING(drive), QD_TIMREG(drive));
125} 105}
126 106
127/* 107/*
@@ -284,7 +264,7 @@ static void qd6580_set_pio_mode(ide_drive_t *drive, const u8 pio)
284 } 264 }
285 265
286 if (!HWIF(drive)->channel && drive->media != ide_disk) { 266 if (!HWIF(drive)->channel && drive->media != ide_disk) {
287 qd_write_reg(0x5f, QD_CONTROL_PORT); 267 outb(0x5f, QD_CONTROL_PORT);
288 printk(KERN_WARNING "%s: ATAPI: disabled read-ahead FIFO " 268 printk(KERN_WARNING "%s: ATAPI: disabled read-ahead FIFO "
289 "and post-write buffer on %s.\n", 269 "and post-write buffer on %s.\n",
290 drive->name, HWIF(drive)->name); 270 drive->name, HWIF(drive)->name);
@@ -301,16 +281,15 @@ static void qd6580_set_pio_mode(ide_drive_t *drive, const u8 pio)
301 281
302static int __init qd_testreg(int port) 282static int __init qd_testreg(int port)
303{ 283{
304 u8 savereg;
305 u8 readreg;
306 unsigned long flags; 284 unsigned long flags;
285 u8 savereg, readreg;
307 286
308 spin_lock_irqsave(&ide_lock, flags); 287 local_irq_save(flags);
309 savereg = inb_p(port); 288 savereg = inb_p(port);
310 outb_p(QD_TESTVAL, port); /* safe value */ 289 outb_p(QD_TESTVAL, port); /* safe value */
311 readreg = inb_p(port); 290 readreg = inb_p(port);
312 outb(savereg, port); 291 outb(savereg, port);
313 spin_unlock_irqrestore(&ide_lock, flags); 292 local_irq_restore(flags);
314 293
315 if (savereg == QD_TESTVAL) { 294 if (savereg == QD_TESTVAL) {
316 printk(KERN_ERR "Outch ! the probe for qd65xx isn't reliable !\n"); 295 printk(KERN_ERR "Outch ! the probe for qd65xx isn't reliable !\n");
@@ -364,13 +343,13 @@ static void __exit qd_unsetup(ide_hwif_t *hwif)
364 343
365 if (set_pio_mode == (void *)qd6500_set_pio_mode) { 344 if (set_pio_mode == (void *)qd6500_set_pio_mode) {
366 // will do it for both 345 // will do it for both
367 qd_write_reg(QD6500_DEF_DATA, QD_TIMREG(&hwif->drives[0])); 346 outb(QD6500_DEF_DATA, QD_TIMREG(&hwif->drives[0]));
368 } else if (set_pio_mode == (void *)qd6580_set_pio_mode) { 347 } else if (set_pio_mode == (void *)qd6580_set_pio_mode) {
369 if (QD_CONTROL(hwif) & QD_CONTR_SEC_DISABLED) { 348 if (QD_CONTROL(hwif) & QD_CONTR_SEC_DISABLED) {
370 qd_write_reg(QD6580_DEF_DATA, QD_TIMREG(&hwif->drives[0])); 349 outb(QD6580_DEF_DATA, QD_TIMREG(&hwif->drives[0]));
371 qd_write_reg(QD6580_DEF_DATA2, QD_TIMREG(&hwif->drives[1])); 350 outb(QD6580_DEF_DATA2, QD_TIMREG(&hwif->drives[1]));
372 } else { 351 } else {
373 qd_write_reg(hwif->channel ? QD6580_DEF_DATA2 : QD6580_DEF_DATA, QD_TIMREG(&hwif->drives[0])); 352 outb(hwif->channel ? QD6580_DEF_DATA2 : QD6580_DEF_DATA, QD_TIMREG(&hwif->drives[0]));
374 } 353 }
375 } else { 354 } else {
376 printk(KERN_WARNING "Unknown qd65xx tuning fonction !\n"); 355 printk(KERN_WARNING "Unknown qd65xx tuning fonction !\n");
@@ -389,10 +368,11 @@ static void __exit qd_unsetup(ide_hwif_t *hwif)
389static int __init qd_probe(int base) 368static int __init qd_probe(int base)
390{ 369{
391 ide_hwif_t *hwif; 370 ide_hwif_t *hwif;
371 u8 idx[4] = { 0xff, 0xff, 0xff, 0xff };
392 u8 config; 372 u8 config;
393 u8 unit; 373 u8 unit;
394 374
395 config = qd_read_reg(QD_CONFIG_PORT); 375 config = inb(QD_CONFIG_PORT);
396 376
397 if (! ((config & QD_CONFIG_BASEPORT) >> 1 == (base == 0xb0)) ) 377 if (! ((config & QD_CONFIG_BASEPORT) >> 1 == (base == 0xb0)) )
398 return 1; 378 return 1;
@@ -419,9 +399,9 @@ static int __init qd_probe(int base)
419 399
420 hwif->set_pio_mode = &qd6500_set_pio_mode; 400 hwif->set_pio_mode = &qd6500_set_pio_mode;
421 401
422 probe_hwif_init(hwif); 402 idx[0] = unit;
423 403
424 ide_proc_register_port(hwif); 404 ide_device_add(idx);
425 405
426 return 1; 406 return 1;
427 } 407 }
@@ -436,7 +416,7 @@ static int __init qd_probe(int base)
436 416
437 /* qd6580 found */ 417 /* qd6580 found */
438 418
439 control = qd_read_reg(QD_CONTROL_PORT); 419 control = inb(QD_CONTROL_PORT);
440 420
441 printk(KERN_NOTICE "qd6580 at %#x\n", base); 421 printk(KERN_NOTICE "qd6580 at %#x\n", base);
442 printk(KERN_DEBUG "qd6580: config=%#x, control=%#x, ID3=%u\n", 422 printk(KERN_DEBUG "qd6580: config=%#x, control=%#x, ID3=%u\n",
@@ -453,11 +433,11 @@ static int __init qd_probe(int base)
453 433
454 hwif->set_pio_mode = &qd6580_set_pio_mode; 434 hwif->set_pio_mode = &qd6580_set_pio_mode;
455 435
456 probe_hwif_init(hwif); 436 idx[0] = unit;
457 437
458 qd_write_reg(QD_DEF_CONTR,QD_CONTROL_PORT); 438 ide_device_add(idx);
459 439
460 ide_proc_register_port(hwif); 440 outb(QD_DEF_CONTR, QD_CONTROL_PORT);
461 441
462 return 1; 442 return 1;
463 } else { 443 } else {
@@ -474,19 +454,17 @@ static int __init qd_probe(int base)
474 454
475 hwif->set_pio_mode = &qd6580_set_pio_mode; 455 hwif->set_pio_mode = &qd6580_set_pio_mode;
476 456
477 probe_hwif_init(hwif);
478
479 qd_setup(mate, base, config | (control << 8), 457 qd_setup(mate, base, config | (control << 8),
480 QD6580_DEF_DATA2, QD6580_DEF_DATA2); 458 QD6580_DEF_DATA2, QD6580_DEF_DATA2);
481 459
482 mate->set_pio_mode = &qd6580_set_pio_mode; 460 mate->set_pio_mode = &qd6580_set_pio_mode;
483 461
484 probe_hwif_init(mate); 462 idx[0] = 0;
463 idx[1] = 1;
485 464
486 qd_write_reg(QD_DEF_CONTR,QD_CONTROL_PORT); 465 ide_device_add(idx);
487 466
488 ide_proc_register_port(hwif); 467 outb(QD_DEF_CONTR, QD_CONTROL_PORT);
489 ide_proc_register_port(mate);
490 468
491 return 0; /* no other qd65xx possible */ 469 return 0; /* no other qd65xx possible */
492 } 470 }
diff --git a/drivers/ide/legacy/umc8672.c b/drivers/ide/legacy/umc8672.c
index 1151c92dd531..79577b916874 100644
--- a/drivers/ide/legacy/umc8672.c
+++ b/drivers/ide/legacy/umc8672.c
@@ -124,8 +124,9 @@ static void umc_set_pio_mode(ide_drive_t *drive, const u8 pio)
124 124
125static int __init umc8672_probe(void) 125static int __init umc8672_probe(void)
126{ 126{
127 unsigned long flags;
128 ide_hwif_t *hwif, *mate; 127 ide_hwif_t *hwif, *mate;
128 unsigned long flags;
129 static u8 idx[4] = { 0, 1, 0xff, 0xff };
129 130
130 if (!request_region(0x108, 2, "umc8672")) { 131 if (!request_region(0x108, 2, "umc8672")) {
131 printk(KERN_ERR "umc8672: ports 0x108-0x109 already in use.\n"); 132 printk(KERN_ERR "umc8672: ports 0x108-0x109 already in use.\n");
@@ -158,11 +159,7 @@ static int __init umc8672_probe(void)
158 mate->mate = hwif; 159 mate->mate = hwif;
159 mate->channel = 1; 160 mate->channel = 1;
160 161
161 probe_hwif_init(hwif); 162 ide_device_add(idx);
162 probe_hwif_init(mate);
163
164 ide_proc_register_port(hwif);
165 ide_proc_register_port(mate);
166 163
167 return 0; 164 return 0;
168} 165}
diff --git a/drivers/ide/mips/au1xxx-ide.c b/drivers/ide/mips/au1xxx-ide.c
index 2f322d7e881b..1de58566e5b6 100644
--- a/drivers/ide/mips/au1xxx-ide.c
+++ b/drivers/ide/mips/au1xxx-ide.c
@@ -601,8 +601,9 @@ static int au_ide_probe(struct device *dev)
601 _auide_hwif *ahwif = &auide_hwif; 601 _auide_hwif *ahwif = &auide_hwif;
602 ide_hwif_t *hwif; 602 ide_hwif_t *hwif;
603 struct resource *res; 603 struct resource *res;
604 hw_regs_t *hw;
605 int ret = 0; 604 int ret = 0;
605 u8 idx[4] = { 0xff, 0xff, 0xff, 0xff };
606 hw_regs_t hw;
606 607
607#if defined(CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA) 608#if defined(CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA)
608 char *mode = "MWDMA2"; 609 char *mode = "MWDMA2";
@@ -644,12 +645,12 @@ static int au_ide_probe(struct device *dev)
644 /* FIXME: This might possibly break PCMCIA IDE devices */ 645 /* FIXME: This might possibly break PCMCIA IDE devices */
645 646
646 hwif = &ide_hwifs[pdev->id]; 647 hwif = &ide_hwifs[pdev->id];
647 hw = &hwif->hw; 648 hwif->irq = ahwif->irq;
648 hwif->irq = hw->irq = ahwif->irq;
649 hwif->chipset = ide_au1xxx; 649 hwif->chipset = ide_au1xxx;
650 650
651 auide_setup_ports(hw, ahwif); 651 memset(&hw, 0, sizeof(hw));
652 memcpy(hwif->io_ports, hw->io_ports, sizeof(hwif->io_ports)); 652 auide_setup_ports(&hw, ahwif);
653 memcpy(hwif->io_ports, hw.io_ports, sizeof(hwif->io_ports));
653 654
654 hwif->ultra_mask = 0x0; /* Disable Ultra DMA */ 655 hwif->ultra_mask = 0x0; /* Disable Ultra DMA */
655#ifdef CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA 656#ifdef CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA
@@ -706,8 +707,10 @@ static int au_ide_probe(struct device *dev)
706 hwif->config_data = 0; /* no chipset-specific code */ 707 hwif->config_data = 0; /* no chipset-specific code */
707 708
708 hwif->drives[0].autotune = 1; /* 1=autotune, 2=noautotune, 0=default */ 709 hwif->drives[0].autotune = 1; /* 1=autotune, 2=noautotune, 0=default */
710 hwif->drives[1].autotune = 1;
709#endif 711#endif
710 hwif->drives[0].no_io_32bit = 1; 712 hwif->drives[0].no_io_32bit = 1;
713 hwif->drives[1].no_io_32bit = 1;
711 714
712 auide_hwif.hwif = hwif; 715 auide_hwif.hwif = hwif;
713 hwif->hwif_data = &auide_hwif; 716 hwif->hwif_data = &auide_hwif;
@@ -717,9 +720,9 @@ static int au_ide_probe(struct device *dev)
717 dbdma_init_done = 1; 720 dbdma_init_done = 1;
718#endif 721#endif
719 722
720 probe_hwif_init(hwif); 723 idx[0] = hwif->index;
721 724
722 ide_proc_register_port(hwif); 725 ide_device_add(idx);
723 726
724 dev_set_drvdata(dev, hwif); 727 dev_set_drvdata(dev, hwif);
725 728
diff --git a/drivers/ide/mips/swarm.c b/drivers/ide/mips/swarm.c
index c2e29571b007..521edd41b572 100644
--- a/drivers/ide/mips/swarm.c
+++ b/drivers/ide/mips/swarm.c
@@ -71,6 +71,7 @@ static int __devinit swarm_ide_probe(struct device *dev)
71 u8 __iomem *base; 71 u8 __iomem *base;
72 phys_t offset, size; 72 phys_t offset, size;
73 int i; 73 int i;
74 u8 idx[4] = { 0xff, 0xff, 0xff, 0xff };
74 75
75 if (!SIBYTE_HAVE_IDE) 76 if (!SIBYTE_HAVE_IDE)
76 return -ENODEV; 77 return -ENODEV;
@@ -119,18 +120,15 @@ static int __devinit swarm_ide_probe(struct device *dev)
119 hwif->noprobe = 0; 120 hwif->noprobe = 0;
120 121
121 for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++) 122 for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++)
122 hwif->hw.io_ports[i] = 123 hwif->io_ports[i] =
123 (unsigned long)(base + ((0x1f0 + i) << 5)); 124 (unsigned long)(base + ((0x1f0 + i) << 5));
124 hwif->hw.io_ports[IDE_CONTROL_OFFSET] = 125 hwif->io_ports[IDE_CONTROL_OFFSET] =
125 (unsigned long)(base + (0x3f6 << 5)); 126 (unsigned long)(base + (0x3f6 << 5));
126 hwif->hw.irq = K_INT_GB_IDE; 127 hwif->irq = K_INT_GB_IDE;
127 128
128 memcpy(hwif->io_ports, hwif->hw.io_ports, sizeof(hwif->io_ports)); 129 idx[0] = hwif->index;
129 hwif->irq = hwif->hw.irq;
130 130
131 probe_hwif_init(hwif); 131 ide_device_add(idx);
132
133 ide_proc_register_port(hwif);
134 132
135 dev_set_drvdata(dev, hwif); 133 dev_set_drvdata(dev, hwif);
136 134
diff --git a/drivers/ide/pci/aec62xx.c b/drivers/ide/pci/aec62xx.c
index b3dc12a70d51..19ec421f7b9f 100644
--- a/drivers/ide/pci/aec62xx.c
+++ b/drivers/ide/pci/aec62xx.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * linux/drivers/ide/pci/aec62xx.c Version 0.26 Sep 1, 2007 2 * linux/drivers/ide/pci/aec62xx.c Version 0.27 Sep 16, 2007
3 * 3 *
4 * Copyright (C) 1999-2002 Andre Hedrick <andre@linux-ide.org> 4 * Copyright (C) 1999-2002 Andre Hedrick <andre@linux-ide.org>
5 * Copyright (C) 2007 MontaVista Software, Inc. <source@mvista.com> 5 * Copyright (C) 2007 MontaVista Software, Inc. <source@mvista.com>
@@ -141,19 +141,6 @@ static void aec_set_pio_mode(ide_drive_t *drive, const u8 pio)
141 drive->hwif->set_dma_mode(drive, pio + XFER_PIO_0); 141 drive->hwif->set_dma_mode(drive, pio + XFER_PIO_0);
142} 142}
143 143
144static void aec62xx_dma_lost_irq (ide_drive_t *drive)
145{
146 switch (HWIF(drive)->pci_dev->device) {
147 case PCI_DEVICE_ID_ARTOP_ATP860:
148 case PCI_DEVICE_ID_ARTOP_ATP860R:
149 case PCI_DEVICE_ID_ARTOP_ATP865:
150 case PCI_DEVICE_ID_ARTOP_ATP865R:
151 printk(" AEC62XX time out ");
152 default:
153 break;
154 }
155}
156
157static unsigned int __devinit init_chipset_aec62xx(struct pci_dev *dev, const char *name) 144static unsigned int __devinit init_chipset_aec62xx(struct pci_dev *dev, const char *name)
158{ 145{
159 int bus_speed = system_bus_clock(); 146 int bus_speed = system_bus_clock();
@@ -195,8 +182,6 @@ static void __devinit init_hwif_aec62xx(ide_hwif_t *hwif)
195 if (hwif->dma_base == 0) 182 if (hwif->dma_base == 0)
196 return; 183 return;
197 184
198 hwif->dma_lost_irq = &aec62xx_dma_lost_irq;
199
200 if (dev->device == PCI_DEVICE_ID_ARTOP_ATP850UF) 185 if (dev->device == PCI_DEVICE_ID_ARTOP_ATP850UF)
201 return; 186 return;
202 187
@@ -209,7 +194,7 @@ static void __devinit init_hwif_aec62xx(ide_hwif_t *hwif)
209 } 194 }
210} 195}
211 196
212static ide_pci_device_t aec62xx_chipsets[] __devinitdata = { 197static const struct ide_port_info aec62xx_chipsets[] __devinitdata = {
213 { /* 0 */ 198 { /* 0 */
214 .name = "AEC6210", 199 .name = "AEC6210",
215 .init_chipset = init_chipset_aec62xx, 200 .init_chipset = init_chipset_aec62xx,
@@ -268,12 +253,12 @@ static ide_pci_device_t aec62xx_chipsets[] __devinitdata = {
268 * finds a device matching our IDE device tables. 253 * finds a device matching our IDE device tables.
269 * 254 *
270 * NOTE: since we're going to modify the 'name' field for AEC-6[26]80[R] 255 * NOTE: since we're going to modify the 'name' field for AEC-6[26]80[R]
271 * chips, pass a local copy of 'struct pci_device_id' down the call chain. 256 * chips, pass a local copy of 'struct ide_port_info' down the call chain.
272 */ 257 */
273 258
274static int __devinit aec62xx_init_one(struct pci_dev *dev, const struct pci_device_id *id) 259static int __devinit aec62xx_init_one(struct pci_dev *dev, const struct pci_device_id *id)
275{ 260{
276 ide_pci_device_t d; 261 struct ide_port_info d;
277 u8 idx = id->driver_data; 262 u8 idx = id->driver_data;
278 263
279 d = aec62xx_chipsets[idx]; 264 d = aec62xx_chipsets[idx];
diff --git a/drivers/ide/pci/alim15x3.c b/drivers/ide/pci/alim15x3.c
index 8ee2b48d105d..a607dd31a64c 100644
--- a/drivers/ide/pci/alim15x3.c
+++ b/drivers/ide/pci/alim15x3.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * linux/drivers/ide/pci/alim15x3.c Version 0.27 Aug 27 2007 2 * linux/drivers/ide/pci/alim15x3.c Version 0.29 Sep 16 2007
3 * 3 *
4 * Copyright (C) 1998-2000 Michel Aubry, Maintainer 4 * Copyright (C) 1998-2000 Michel Aubry, Maintainer
5 * Copyright (C) 1998-2000 Andrzej Krzysztofowicz, Maintainer 5 * Copyright (C) 1998-2000 Andrzej Krzysztofowicz, Maintainer
@@ -492,6 +492,13 @@ static unsigned int __devinit init_chipset_ali15x3 (struct pci_dev *dev, const c
492 * clear bit 7 492 * clear bit 7
493 */ 493 */
494 pci_write_config_byte(dev, 0x4b, tmpbyte & 0x7F); 494 pci_write_config_byte(dev, 0x4b, tmpbyte & 0x7F);
495 /*
496 * check m1533, 0x5e, bit 1~4 == 1001 => & 00011110 = 00010010
497 */
498 if (m5229_revision >= 0x20 && isa_dev) {
499 pci_read_config_byte(isa_dev, 0x5e, &tmpbyte);
500 chip_is_1543c_e = ((tmpbyte & 0x1e) == 0x12) ? 1: 0;
501 }
495 goto out; 502 goto out;
496 } 503 }
497 504
@@ -537,7 +544,30 @@ static unsigned int __devinit init_chipset_ali15x3 (struct pci_dev *dev, const c
537 pci_write_config_byte(isa_dev, 0x79, tmpbyte | 0x02); 544 pci_write_config_byte(isa_dev, 0x79, tmpbyte | 0x02);
538 } 545 }
539 } 546 }
547
540out: 548out:
549 /*
550 * CD_ROM DMA on (m5229, 0x53, bit0)
551 * Enable this bit even if we want to use PIO.
552 * PIO FIFO off (m5229, 0x53, bit1)
553 * The hardware will use 0x54h and 0x55h to control PIO FIFO.
554 * (Not on later devices it seems)
555 *
556 * 0x53 changes meaning on later revs - we must no touch
557 * bit 1 on them. Need to check if 0x20 is the right break.
558 */
559 if (m5229_revision >= 0x20) {
560 pci_read_config_byte(dev, 0x53, &tmpbyte);
561
562 if (m5229_revision <= 0x20)
563 tmpbyte = (tmpbyte & (~0x02)) | 0x01;
564 else if (m5229_revision == 0xc7 || m5229_revision == 0xc8)
565 tmpbyte |= 0x03;
566 else
567 tmpbyte |= 0x01;
568
569 pci_write_config_byte(dev, 0x53, tmpbyte);
570 }
541 pci_dev_put(north); 571 pci_dev_put(north);
542 pci_dev_put(isa_dev); 572 pci_dev_put(isa_dev);
543 local_irq_restore(flags); 573 local_irq_restore(flags);
@@ -616,36 +646,8 @@ static u8 __devinit ata66_ali15x3(ide_hwif_t *hwif)
616 if ((tmpbyte & (1 << hwif->channel)) == 0) 646 if ((tmpbyte & (1 << hwif->channel)) == 0)
617 cbl = ATA_CBL_PATA80; 647 cbl = ATA_CBL_PATA80;
618 } 648 }
619 } else {
620 /*
621 * check m1533, 0x5e, bit 1~4 == 1001 => & 00011110 = 00010010
622 */
623 pci_read_config_byte(isa_dev, 0x5e, &tmpbyte);
624 chip_is_1543c_e = ((tmpbyte & 0x1e) == 0x12) ? 1: 0;
625 } 649 }
626 650
627 /*
628 * CD_ROM DMA on (m5229, 0x53, bit0)
629 * Enable this bit even if we want to use PIO
630 * PIO FIFO off (m5229, 0x53, bit1)
631 * The hardware will use 0x54h and 0x55h to control PIO FIFO
632 * (Not on later devices it seems)
633 *
634 * 0x53 changes meaning on later revs - we must no touch
635 * bit 1 on them. Need to check if 0x20 is the right break
636 */
637
638 pci_read_config_byte(dev, 0x53, &tmpbyte);
639
640 if(m5229_revision <= 0x20)
641 tmpbyte = (tmpbyte & (~0x02)) | 0x01;
642 else if (m5229_revision == 0xc7 || m5229_revision == 0xc8)
643 tmpbyte |= 0x03;
644 else
645 tmpbyte |= 0x01;
646
647 pci_write_config_byte(dev, 0x53, tmpbyte);
648
649 local_irq_restore(flags); 651 local_irq_restore(flags);
650 652
651 return cbl; 653 return cbl;
@@ -664,31 +666,9 @@ static void __devinit init_hwif_common_ali15x3 (ide_hwif_t *hwif)
664 hwif->set_dma_mode = &ali_set_dma_mode; 666 hwif->set_dma_mode = &ali_set_dma_mode;
665 hwif->udma_filter = &ali_udma_filter; 667 hwif->udma_filter = &ali_udma_filter;
666 668
667 /* don't use LBA48 DMA on ALi devices before rev 0xC5 */
668 if (m5229_revision <= 0xC4)
669 hwif->host_flags |= IDE_HFLAG_NO_LBA48_DMA;
670
671 if (hwif->dma_base == 0) 669 if (hwif->dma_base == 0)
672 return; 670 return;
673 671
674 /*
675 * check in ->init_dma guarantees m5229_revision >= 0x20 here
676 */
677
678 if (m5229_revision == 0x20)
679 hwif->host_flags |= IDE_HFLAG_NO_ATAPI_DMA;
680
681 if (m5229_revision <= 0x20)
682 hwif->ultra_mask = 0x00; /* no udma */
683 else if (m5229_revision < 0xC2)
684 hwif->ultra_mask = ATA_UDMA2;
685 else if (m5229_revision == 0xC2 || m5229_revision == 0xC3)
686 hwif->ultra_mask = ATA_UDMA4;
687 else if (m5229_revision == 0xC4)
688 hwif->ultra_mask = ATA_UDMA5;
689 else
690 hwif->ultra_mask = ATA_UDMA6;
691
692 hwif->dma_setup = &ali15x3_dma_setup; 672 hwif->dma_setup = &ali15x3_dma_setup;
693 673
694 if (hwif->cbl != ATA_CBL_PATA40_SHORT) 674 if (hwif->cbl != ATA_CBL_PATA40_SHORT)
@@ -766,7 +746,7 @@ static void __devinit init_dma_ali15x3 (ide_hwif_t *hwif, unsigned long dmabase)
766 ide_setup_dma(hwif, dmabase, 8); 746 ide_setup_dma(hwif, dmabase, 8);
767} 747}
768 748
769static ide_pci_device_t ali15x3_chipset __devinitdata = { 749static const struct ide_port_info ali15x3_chipset __devinitdata = {
770 .name = "ALI15X3", 750 .name = "ALI15X3",
771 .init_chipset = init_chipset_ali15x3, 751 .init_chipset = init_chipset_ali15x3,
772 .init_hwif = init_hwif_ali15x3, 752 .init_hwif = init_hwif_ali15x3,
@@ -792,15 +772,34 @@ static int __devinit alim15x3_init_one(struct pci_dev *dev, const struct pci_dev
792 { }, 772 { },
793 }; 773 };
794 774
795 ide_pci_device_t *d = &ali15x3_chipset; 775 struct ide_port_info d = ali15x3_chipset;
776 u8 rev = dev->revision;
796 777
797 if (pci_dev_present(ati_rs100)) 778 if (pci_dev_present(ati_rs100))
798 printk(KERN_WARNING "alim15x3: ATI Radeon IGP Northbridge is not yet fully tested.\n"); 779 printk(KERN_WARNING "alim15x3: ATI Radeon IGP Northbridge is not yet fully tested.\n");
799 780
781 /* don't use LBA48 DMA on ALi devices before rev 0xC5 */
782 if (rev <= 0xC4)
783 d.host_flags |= IDE_HFLAG_NO_LBA48_DMA;
784
785 if (rev >= 0x20) {
786 if (rev == 0x20)
787 d.host_flags |= IDE_HFLAG_NO_ATAPI_DMA;
788
789 if (rev < 0xC2)
790 d.udma_mask = ATA_UDMA2;
791 else if (rev == 0xC2 || rev == 0xC3)
792 d.udma_mask = ATA_UDMA4;
793 else if (rev == 0xC4)
794 d.udma_mask = ATA_UDMA5;
795 else
796 d.udma_mask = ATA_UDMA6;
797 }
798
800#if defined(CONFIG_SPARC64) 799#if defined(CONFIG_SPARC64)
801 d->init_hwif = init_hwif_common_ali15x3; 800 d.init_hwif = init_hwif_common_ali15x3;
802#endif /* CONFIG_SPARC64 */ 801#endif /* CONFIG_SPARC64 */
803 return ide_setup_pci_device(dev, d); 802 return ide_setup_pci_device(dev, &d);
804} 803}
805 804
806 805
diff --git a/drivers/ide/pci/amd74xx.c b/drivers/ide/pci/amd74xx.c
index 7cafefbf6c1b..8d4125ec252c 100644
--- a/drivers/ide/pci/amd74xx.c
+++ b/drivers/ide/pci/amd74xx.c
@@ -77,7 +77,7 @@ static struct amd_ide_chip {
77}; 77};
78 78
79static struct amd_ide_chip *amd_config; 79static struct amd_ide_chip *amd_config;
80static ide_pci_device_t *amd_chipset; 80static const struct ide_port_info *amd_chipset;
81static unsigned int amd_80w; 81static unsigned int amd_80w;
82static unsigned int amd_clock; 82static unsigned int amd_clock;
83 83
@@ -242,19 +242,12 @@ static unsigned int __devinit init_chipset_amd74xx(struct pci_dev *dev, const ch
242 242
243static void __devinit init_hwif_amd74xx(ide_hwif_t *hwif) 243static void __devinit init_hwif_amd74xx(ide_hwif_t *hwif)
244{ 244{
245 int i;
246
247 if (hwif->irq == 0) /* 0 is bogus but will do for now */ 245 if (hwif->irq == 0) /* 0 is bogus but will do for now */
248 hwif->irq = pci_get_legacy_ide_irq(hwif->pci_dev, hwif->channel); 246 hwif->irq = pci_get_legacy_ide_irq(hwif->pci_dev, hwif->channel);
249 247
250 hwif->set_pio_mode = &amd_set_pio_mode; 248 hwif->set_pio_mode = &amd_set_pio_mode;
251 hwif->set_dma_mode = &amd_set_drive; 249 hwif->set_dma_mode = &amd_set_drive;
252 250
253 for (i = 0; i < 2; i++) {
254 hwif->drives[i].io_32bit = 1;
255 hwif->drives[i].unmask = 1;
256 }
257
258 if (!hwif->dma_base) 251 if (!hwif->dma_base)
259 return; 252 return;
260 253
@@ -270,16 +263,21 @@ static void __devinit init_hwif_amd74xx(ide_hwif_t *hwif)
270 } 263 }
271} 264}
272 265
266#define IDE_HFLAGS_AMD \
267 (IDE_HFLAG_PIO_NO_BLACKLIST | \
268 IDE_HFLAG_PIO_NO_DOWNGRADE | \
269 IDE_HFLAG_POST_SET_MODE | \
270 IDE_HFLAG_IO_32BIT | \
271 IDE_HFLAG_UNMASK_IRQS | \
272 IDE_HFLAG_BOOTABLE)
273
273#define DECLARE_AMD_DEV(name_str) \ 274#define DECLARE_AMD_DEV(name_str) \
274 { \ 275 { \
275 .name = name_str, \ 276 .name = name_str, \
276 .init_chipset = init_chipset_amd74xx, \ 277 .init_chipset = init_chipset_amd74xx, \
277 .init_hwif = init_hwif_amd74xx, \ 278 .init_hwif = init_hwif_amd74xx, \
278 .enablebits = {{0x40,0x02,0x02}, {0x40,0x01,0x01}}, \ 279 .enablebits = {{0x40,0x02,0x02}, {0x40,0x01,0x01}}, \
279 .host_flags = IDE_HFLAG_PIO_NO_BLACKLIST | \ 280 .host_flags = IDE_HFLAGS_AMD, \
280 IDE_HFLAG_PIO_NO_DOWNGRADE | \
281 IDE_HFLAG_POST_SET_MODE | \
282 IDE_HFLAG_BOOTABLE, \
283 .pio_mask = ATA_PIO5, \ 281 .pio_mask = ATA_PIO5, \
284 .swdma_mask = ATA_SWDMA2, \ 282 .swdma_mask = ATA_SWDMA2, \
285 .mwdma_mask = ATA_MWDMA2, \ 283 .mwdma_mask = ATA_MWDMA2, \
@@ -291,16 +289,13 @@ static void __devinit init_hwif_amd74xx(ide_hwif_t *hwif)
291 .init_chipset = init_chipset_amd74xx, \ 289 .init_chipset = init_chipset_amd74xx, \
292 .init_hwif = init_hwif_amd74xx, \ 290 .init_hwif = init_hwif_amd74xx, \
293 .enablebits = {{0x50,0x02,0x02}, {0x50,0x01,0x01}}, \ 291 .enablebits = {{0x50,0x02,0x02}, {0x50,0x01,0x01}}, \
294 .host_flags = IDE_HFLAG_PIO_NO_BLACKLIST | \ 292 .host_flags = IDE_HFLAGS_AMD, \
295 IDE_HFLAG_PIO_NO_DOWNGRADE | \
296 IDE_HFLAG_POST_SET_MODE | \
297 IDE_HFLAG_BOOTABLE, \
298 .pio_mask = ATA_PIO5, \ 293 .pio_mask = ATA_PIO5, \
299 .swdma_mask = ATA_SWDMA2, \ 294 .swdma_mask = ATA_SWDMA2, \
300 .mwdma_mask = ATA_MWDMA2, \ 295 .mwdma_mask = ATA_MWDMA2, \
301 } 296 }
302 297
303static ide_pci_device_t amd74xx_chipsets[] __devinitdata = { 298static const struct ide_port_info amd74xx_chipsets[] __devinitdata = {
304 /* 0 */ DECLARE_AMD_DEV("AMD7401"), 299 /* 0 */ DECLARE_AMD_DEV("AMD7401"),
305 /* 1 */ DECLARE_AMD_DEV("AMD7409"), 300 /* 1 */ DECLARE_AMD_DEV("AMD7409"),
306 /* 2 */ DECLARE_AMD_DEV("AMD7411"), 301 /* 2 */ DECLARE_AMD_DEV("AMD7411"),
diff --git a/drivers/ide/pci/atiixp.c b/drivers/ide/pci/atiixp.c
index 307843053078..ef8e0164ef7a 100644
--- a/drivers/ide/pci/atiixp.c
+++ b/drivers/ide/pci/atiixp.c
@@ -189,8 +189,7 @@ static void __devinit init_hwif_atiixp(ide_hwif_t *hwif)
189 hwif->dma_host_off = &atiixp_dma_host_off; 189 hwif->dma_host_off = &atiixp_dma_host_off;
190} 190}
191 191
192 192static const struct ide_port_info atiixp_pci_info[] __devinitdata = {
193static ide_pci_device_t atiixp_pci_info[] __devinitdata = {
194 { /* 0 */ 193 { /* 0 */
195 .name = "ATIIXP", 194 .name = "ATIIXP",
196 .init_hwif = init_hwif_atiixp, 195 .init_hwif = init_hwif_atiixp,
diff --git a/drivers/ide/pci/cmd640.c b/drivers/ide/pci/cmd640.c
index f369645e4d16..4aa48104e0c1 100644
--- a/drivers/ide/pci/cmd640.c
+++ b/drivers/ide/pci/cmd640.c
@@ -185,6 +185,8 @@ static u8 recovery_counts[4] = {16, 16, 16, 16}; /* Recovery count (encoded) */
185 185
186#endif /* CONFIG_BLK_DEV_CMD640_ENHANCED */ 186#endif /* CONFIG_BLK_DEV_CMD640_ENHANCED */
187 187
188static DEFINE_SPINLOCK(cmd640_lock);
189
188/* 190/*
189 * These are initialized to point at the devices we control 191 * These are initialized to point at the devices we control
190 */ 192 */
@@ -258,12 +260,12 @@ static u8 get_cmd640_reg_vlb (u16 reg)
258 260
259static u8 get_cmd640_reg(u16 reg) 261static u8 get_cmd640_reg(u16 reg)
260{ 262{
261 u8 b;
262 unsigned long flags; 263 unsigned long flags;
264 u8 b;
263 265
264 spin_lock_irqsave(&ide_lock, flags); 266 spin_lock_irqsave(&cmd640_lock, flags);
265 b = __get_cmd640_reg(reg); 267 b = __get_cmd640_reg(reg);
266 spin_unlock_irqrestore(&ide_lock, flags); 268 spin_unlock_irqrestore(&cmd640_lock, flags);
267 return b; 269 return b;
268} 270}
269 271
@@ -271,9 +273,9 @@ static void put_cmd640_reg(u16 reg, u8 val)
271{ 273{
272 unsigned long flags; 274 unsigned long flags;
273 275
274 spin_lock_irqsave(&ide_lock, flags); 276 spin_lock_irqsave(&cmd640_lock, flags);
275 __put_cmd640_reg(reg,val); 277 __put_cmd640_reg(reg,val);
276 spin_unlock_irqrestore(&ide_lock, flags); 278 spin_unlock_irqrestore(&cmd640_lock, flags);
277} 279}
278 280
279static int __init match_pci_cmd640_device (void) 281static int __init match_pci_cmd640_device (void)
@@ -351,7 +353,7 @@ static int __init secondary_port_responding (void)
351{ 353{
352 unsigned long flags; 354 unsigned long flags;
353 355
354 spin_lock_irqsave(&ide_lock, flags); 356 spin_lock_irqsave(&cmd640_lock, flags);
355 357
356 outb_p(0x0a, 0x170 + IDE_SELECT_OFFSET); /* select drive0 */ 358 outb_p(0x0a, 0x170 + IDE_SELECT_OFFSET); /* select drive0 */
357 udelay(100); 359 udelay(100);
@@ -359,11 +361,11 @@ static int __init secondary_port_responding (void)
359 outb_p(0x1a, 0x170 + IDE_SELECT_OFFSET); /* select drive1 */ 361 outb_p(0x1a, 0x170 + IDE_SELECT_OFFSET); /* select drive1 */
360 udelay(100); 362 udelay(100);
361 if ((inb_p(0x170 + IDE_SELECT_OFFSET) & 0x1f) != 0x1a) { 363 if ((inb_p(0x170 + IDE_SELECT_OFFSET) & 0x1f) != 0x1a) {
362 spin_unlock_irqrestore(&ide_lock, flags); 364 spin_unlock_irqrestore(&cmd640_lock, flags);
363 return 0; /* nothing responded */ 365 return 0; /* nothing responded */
364 } 366 }
365 } 367 }
366 spin_unlock_irqrestore(&ide_lock, flags); 368 spin_unlock_irqrestore(&cmd640_lock, flags);
367 return 1; /* success */ 369 return 1; /* success */
368} 370}
369 371
@@ -440,11 +442,11 @@ static void __init setup_device_ptrs (void)
440static void set_prefetch_mode (unsigned int index, int mode) 442static void set_prefetch_mode (unsigned int index, int mode)
441{ 443{
442 ide_drive_t *drive = cmd_drives[index]; 444 ide_drive_t *drive = cmd_drives[index];
445 unsigned long flags;
443 int reg = prefetch_regs[index]; 446 int reg = prefetch_regs[index];
444 u8 b; 447 u8 b;
445 unsigned long flags;
446 448
447 spin_lock_irqsave(&ide_lock, flags); 449 spin_lock_irqsave(&cmd640_lock, flags);
448 b = __get_cmd640_reg(reg); 450 b = __get_cmd640_reg(reg);
449 if (mode) { /* want prefetch on? */ 451 if (mode) { /* want prefetch on? */
450#if CMD640_PREFETCH_MASKS 452#if CMD640_PREFETCH_MASKS
@@ -460,7 +462,7 @@ static void set_prefetch_mode (unsigned int index, int mode)
460 b |= prefetch_masks[index]; /* disable prefetch */ 462 b |= prefetch_masks[index]; /* disable prefetch */
461 } 463 }
462 __put_cmd640_reg(reg, b); 464 __put_cmd640_reg(reg, b);
463 spin_unlock_irqrestore(&ide_lock, flags); 465 spin_unlock_irqrestore(&cmd640_lock, flags);
464} 466}
465 467
466/* 468/*
@@ -561,7 +563,7 @@ static void program_drive_counts (unsigned int index)
561 /* 563 /*
562 * Now that everything is ready, program the new timings 564 * Now that everything is ready, program the new timings
563 */ 565 */
564 spin_lock_irqsave(&ide_lock, flags); 566 spin_lock_irqsave(&cmd640_lock, flags);
565 /* 567 /*
566 * Program the address_setup clocks into ARTTIM reg, 568 * Program the address_setup clocks into ARTTIM reg,
567 * and then the active/recovery counts into the DRWTIM reg 569 * and then the active/recovery counts into the DRWTIM reg
@@ -570,7 +572,7 @@ static void program_drive_counts (unsigned int index)
570 setup_count |= __get_cmd640_reg(arttim_regs[index]) & 0x3f; 572 setup_count |= __get_cmd640_reg(arttim_regs[index]) & 0x3f;
571 __put_cmd640_reg(arttim_regs[index], setup_count); 573 __put_cmd640_reg(arttim_regs[index], setup_count);
572 __put_cmd640_reg(drwtim_regs[index], pack_nibbles(active_count, recovery_count)); 574 __put_cmd640_reg(drwtim_regs[index], pack_nibbles(active_count, recovery_count));
573 spin_unlock_irqrestore(&ide_lock, flags); 575 spin_unlock_irqrestore(&cmd640_lock, flags);
574} 576}
575 577
576/* 578/*
@@ -670,20 +672,20 @@ static void cmd640_set_pio_mode(ide_drive_t *drive, const u8 pio)
670 672
671static int pci_conf1(void) 673static int pci_conf1(void)
672{ 674{
673 u32 tmp;
674 unsigned long flags; 675 unsigned long flags;
676 u32 tmp;
675 677
676 spin_lock_irqsave(&ide_lock, flags); 678 spin_lock_irqsave(&cmd640_lock, flags);
677 outb(0x01, 0xCFB); 679 outb(0x01, 0xCFB);
678 tmp = inl(0xCF8); 680 tmp = inl(0xCF8);
679 outl(0x80000000, 0xCF8); 681 outl(0x80000000, 0xCF8);
680 if (inl(0xCF8) == 0x80000000) { 682 if (inl(0xCF8) == 0x80000000) {
681 outl(tmp, 0xCF8); 683 outl(tmp, 0xCF8);
682 spin_unlock_irqrestore(&ide_lock, flags); 684 spin_unlock_irqrestore(&cmd640_lock, flags);
683 return 1; 685 return 1;
684 } 686 }
685 outl(tmp, 0xCF8); 687 outl(tmp, 0xCF8);
686 spin_unlock_irqrestore(&ide_lock, flags); 688 spin_unlock_irqrestore(&cmd640_lock, flags);
687 return 0; 689 return 0;
688} 690}
689 691
@@ -691,15 +693,15 @@ static int pci_conf2(void)
691{ 693{
692 unsigned long flags; 694 unsigned long flags;
693 695
694 spin_lock_irqsave(&ide_lock, flags); 696 spin_lock_irqsave(&cmd640_lock, flags);
695 outb(0x00, 0xCFB); 697 outb(0x00, 0xCFB);
696 outb(0x00, 0xCF8); 698 outb(0x00, 0xCF8);
697 outb(0x00, 0xCFA); 699 outb(0x00, 0xCFA);
698 if (inb(0xCF8) == 0x00 && inb(0xCF8) == 0x00) { 700 if (inb(0xCF8) == 0x00 && inb(0xCF8) == 0x00) {
699 spin_unlock_irqrestore(&ide_lock, flags); 701 spin_unlock_irqrestore(&cmd640_lock, flags);
700 return 1; 702 return 1;
701 } 703 }
702 spin_unlock_irqrestore(&ide_lock, flags); 704 spin_unlock_irqrestore(&cmd640_lock, flags);
703 return 0; 705 return 0;
704} 706}
705 707
diff --git a/drivers/ide/pci/cmd64x.c b/drivers/ide/pci/cmd64x.c
index adee2ef6fd71..ea0143ef5fe5 100644
--- a/drivers/ide/pci/cmd64x.c
+++ b/drivers/ide/pci/cmd64x.c
@@ -535,7 +535,6 @@ static void __devinit init_hwif_cmd64x(ide_hwif_t *hwif)
535 hwif->ide_dma_test_irq = &cmd648_ide_dma_test_irq; 535 hwif->ide_dma_test_irq = &cmd648_ide_dma_test_irq;
536 break; 536 break;
537 case PCI_DEVICE_ID_CMD_646: 537 case PCI_DEVICE_ID_CMD_646:
538 hwif->chipset = ide_cmd646;
539 if (dev->revision == 0x01) { 538 if (dev->revision == 0x01) {
540 hwif->ide_dma_end = &cmd646_1_ide_dma_end; 539 hwif->ide_dma_end = &cmd646_1_ide_dma_end;
541 break; 540 break;
@@ -549,7 +548,7 @@ static void __devinit init_hwif_cmd64x(ide_hwif_t *hwif)
549 } 548 }
550} 549}
551 550
552static ide_pci_device_t cmd64x_chipsets[] __devinitdata = { 551static const struct ide_port_info cmd64x_chipsets[] __devinitdata = {
553 { /* 0 */ 552 { /* 0 */
554 .name = "CMD643", 553 .name = "CMD643",
555 .init_chipset = init_chipset_cmd64x, 554 .init_chipset = init_chipset_cmd64x,
@@ -573,6 +572,7 @@ static ide_pci_device_t cmd64x_chipsets[] __devinitdata = {
573 .init_chipset = init_chipset_cmd64x, 572 .init_chipset = init_chipset_cmd64x,
574 .init_hwif = init_hwif_cmd64x, 573 .init_hwif = init_hwif_cmd64x,
575 .enablebits = {{0x51,0x04,0x04}, {0x51,0x08,0x08}}, 574 .enablebits = {{0x51,0x04,0x04}, {0x51,0x08,0x08}},
575 .chipset = ide_cmd646,
576 .host_flags = IDE_HFLAG_ABUSE_PREFETCH | IDE_HFLAG_BOOTABLE, 576 .host_flags = IDE_HFLAG_ABUSE_PREFETCH | IDE_HFLAG_BOOTABLE,
577 .pio_mask = ATA_PIO5, 577 .pio_mask = ATA_PIO5,
578 .mwdma_mask = ATA_MWDMA2, 578 .mwdma_mask = ATA_MWDMA2,
@@ -591,7 +591,7 @@ static ide_pci_device_t cmd64x_chipsets[] __devinitdata = {
591 591
592static int __devinit cmd64x_init_one(struct pci_dev *dev, const struct pci_device_id *id) 592static int __devinit cmd64x_init_one(struct pci_dev *dev, const struct pci_device_id *id)
593{ 593{
594 ide_pci_device_t d; 594 struct ide_port_info d;
595 u8 idx = id->driver_data; 595 u8 idx = id->driver_data;
596 596
597 d = cmd64x_chipsets[idx]; 597 d = cmd64x_chipsets[idx];
diff --git a/drivers/ide/pci/cs5520.c b/drivers/ide/pci/cs5520.c
index aa98e817d385..0466462fd21b 100644
--- a/drivers/ide/pci/cs5520.c
+++ b/drivers/ide/pci/cs5520.c
@@ -141,7 +141,7 @@ static void __devinit init_hwif_cs5520(ide_hwif_t *hwif)
141 .pio_mask = ATA_PIO4, \ 141 .pio_mask = ATA_PIO4, \
142 } 142 }
143 143
144static ide_pci_device_t cyrix_chipsets[] __devinitdata = { 144static const struct ide_port_info cyrix_chipsets[] __devinitdata = {
145 /* 0 */ DECLARE_CS_DEV("Cyrix 5510"), 145 /* 0 */ DECLARE_CS_DEV("Cyrix 5510"),
146 /* 1 */ DECLARE_CS_DEV("Cyrix 5520") 146 /* 1 */ DECLARE_CS_DEV("Cyrix 5520")
147}; 147};
@@ -154,9 +154,8 @@ static ide_pci_device_t cyrix_chipsets[] __devinitdata = {
154 154
155static int __devinit cs5520_init_one(struct pci_dev *dev, const struct pci_device_id *id) 155static int __devinit cs5520_init_one(struct pci_dev *dev, const struct pci_device_id *id)
156{ 156{
157 ide_hwif_t *hwif = NULL, *mate = NULL; 157 const struct ide_port_info *d = &cyrix_chipsets[id->driver_data];
158 ata_index_t index; 158 u8 idx[4] = { 0xff, 0xff, 0xff, 0xff };
159 ide_pci_device_t *d = &cyrix_chipsets[id->driver_data];
160 159
161 ide_setup_pci_noise(dev, d); 160 ide_setup_pci_noise(dev, d);
162 161
@@ -172,29 +171,14 @@ static int __devinit cs5520_init_one(struct pci_dev *dev, const struct pci_devic
172 return -ENODEV; 171 return -ENODEV;
173 } 172 }
174 173
175 index.all = 0xf0f0;
176
177 /* 174 /*
178 * Now the chipset is configured we can let the core 175 * Now the chipset is configured we can let the core
179 * do all the device setup for us 176 * do all the device setup for us
180 */ 177 */
181 178
182 ide_pci_setup_ports(dev, d, 14, &index); 179 ide_pci_setup_ports(dev, d, 14, &idx[0]);
183
184 if ((index.b.low & 0xf0) != 0xf0)
185 hwif = &ide_hwifs[index.b.low];
186 if ((index.b.high & 0xf0) != 0xf0)
187 mate = &ide_hwifs[index.b.high];
188
189 if (hwif)
190 probe_hwif_init(hwif);
191 if (mate)
192 probe_hwif_init(mate);
193 180
194 if (hwif) 181 ide_device_add(idx);
195 ide_proc_register_port(hwif);
196 if (mate)
197 ide_proc_register_port(mate);
198 182
199 return 0; 183 return 0;
200} 184}
diff --git a/drivers/ide/pci/cs5530.c b/drivers/ide/pci/cs5530.c
index ba0c6eba024b..599408952bd4 100644
--- a/drivers/ide/pci/cs5530.c
+++ b/drivers/ide/pci/cs5530.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * linux/drivers/ide/pci/cs5530.c Version 0.76 Aug 3 2007 2 * linux/drivers/ide/pci/cs5530.c Version 0.77 Sep 24 2007
3 * 3 *
4 * Copyright (C) 2000 Andre Hedrick <andre@linux-ide.org> 4 * Copyright (C) 2000 Andre Hedrick <andre@linux-ide.org>
5 * Copyright (C) 2000 Mark Lord <mlord@pobox.com> 5 * Copyright (C) 2000 Mark Lord <mlord@pobox.com>
@@ -146,7 +146,6 @@ static void cs5530_set_dma_mode(ide_drive_t *drive, const u8 mode)
146static unsigned int __devinit init_chipset_cs5530 (struct pci_dev *dev, const char *name) 146static unsigned int __devinit init_chipset_cs5530 (struct pci_dev *dev, const char *name)
147{ 147{
148 struct pci_dev *master_0 = NULL, *cs5530_0 = NULL; 148 struct pci_dev *master_0 = NULL, *cs5530_0 = NULL;
149 unsigned long flags;
150 149
151 if (pci_resource_start(dev, 4) == 0) 150 if (pci_resource_start(dev, 4) == 0)
152 return -EFAULT; 151 return -EFAULT;
@@ -171,9 +170,6 @@ static unsigned int __devinit init_chipset_cs5530 (struct pci_dev *dev, const ch
171 goto out; 170 goto out;
172 } 171 }
173 172
174 spin_lock_irqsave(&ide_lock, flags);
175 /* all CPUs (there should only be one CPU with this chipset) */
176
177 /* 173 /*
178 * Enable BusMaster and MemoryWriteAndInvalidate for the cs5530: 174 * Enable BusMaster and MemoryWriteAndInvalidate for the cs5530:
179 * --> OR 0x14 into 16-bit PCI COMMAND reg of function 0 of the cs5530 175 * --> OR 0x14 into 16-bit PCI COMMAND reg of function 0 of the cs5530
@@ -224,8 +220,6 @@ static unsigned int __devinit init_chipset_cs5530 (struct pci_dev *dev, const ch
224 pci_write_config_byte(master_0, 0x42, 0x00); 220 pci_write_config_byte(master_0, 0x42, 0x00);
225 pci_write_config_byte(master_0, 0x43, 0xc1); 221 pci_write_config_byte(master_0, 0x43, 0xc1);
226 222
227 spin_unlock_irqrestore(&ide_lock, flags);
228
229out: 223out:
230 pci_dev_put(master_0); 224 pci_dev_put(master_0);
231 pci_dev_put(cs5530_0); 225 pci_dev_put(cs5530_0);
@@ -261,7 +255,7 @@ static void __devinit init_hwif_cs5530 (ide_hwif_t *hwif)
261 hwif->udma_filter = cs5530_udma_filter; 255 hwif->udma_filter = cs5530_udma_filter;
262} 256}
263 257
264static ide_pci_device_t cs5530_chipset __devinitdata = { 258static const struct ide_port_info cs5530_chipset __devinitdata = {
265 .name = "CS5530", 259 .name = "CS5530",
266 .init_chipset = init_chipset_cs5530, 260 .init_chipset = init_chipset_cs5530,
267 .init_hwif = init_hwif_cs5530, 261 .init_hwif = init_hwif_cs5530,
diff --git a/drivers/ide/pci/cs5535.c b/drivers/ide/pci/cs5535.c
index 5ac82ffa5c09..9094916e3780 100644
--- a/drivers/ide/pci/cs5535.c
+++ b/drivers/ide/pci/cs5535.c
@@ -186,7 +186,7 @@ static void __devinit init_hwif_cs5535(ide_hwif_t *hwif)
186 hwif->cbl = cs5535_cable_detect(hwif->pci_dev); 186 hwif->cbl = cs5535_cable_detect(hwif->pci_dev);
187} 187}
188 188
189static ide_pci_device_t cs5535_chipset __devinitdata = { 189static const struct ide_port_info cs5535_chipset __devinitdata = {
190 .name = "CS5535", 190 .name = "CS5535",
191 .init_hwif = init_hwif_cs5535, 191 .init_hwif = init_hwif_cs5535,
192 .host_flags = IDE_HFLAG_SINGLE | IDE_HFLAG_POST_SET_MODE | 192 .host_flags = IDE_HFLAG_SINGLE | IDE_HFLAG_POST_SET_MODE |
diff --git a/drivers/ide/pci/cy82c693.c b/drivers/ide/pci/cy82c693.c
index efc20bd97fd5..3ef4fc10fe2c 100644
--- a/drivers/ide/pci/cy82c693.c
+++ b/drivers/ide/pci/cy82c693.c
@@ -428,7 +428,6 @@ static unsigned int __devinit init_chipset_cy82c693(struct pci_dev *dev, const c
428 */ 428 */
429static void __devinit init_hwif_cy82c693(ide_hwif_t *hwif) 429static void __devinit init_hwif_cy82c693(ide_hwif_t *hwif)
430{ 430{
431 hwif->chipset = ide_cy82c693;
432 hwif->set_pio_mode = &cy82c693_set_pio_mode; 431 hwif->set_pio_mode = &cy82c693_set_pio_mode;
433 432
434 if (hwif->dma_base == 0) 433 if (hwif->dma_base == 0)
@@ -449,11 +448,12 @@ static void __devinit init_iops_cy82c693(ide_hwif_t *hwif)
449 } 448 }
450} 449}
451 450
452static ide_pci_device_t cy82c693_chipset __devinitdata = { 451static const struct ide_port_info cy82c693_chipset __devinitdata = {
453 .name = "CY82C693", 452 .name = "CY82C693",
454 .init_chipset = init_chipset_cy82c693, 453 .init_chipset = init_chipset_cy82c693,
455 .init_iops = init_iops_cy82c693, 454 .init_iops = init_iops_cy82c693,
456 .init_hwif = init_hwif_cy82c693, 455 .init_hwif = init_hwif_cy82c693,
456 .chipset = ide_cy82c693,
457 .host_flags = IDE_HFLAG_SINGLE | IDE_HFLAG_TRUST_BIOS_FOR_DMA | 457 .host_flags = IDE_HFLAG_SINGLE | IDE_HFLAG_TRUST_BIOS_FOR_DMA |
458 IDE_HFLAG_BOOTABLE, 458 IDE_HFLAG_BOOTABLE,
459 .pio_mask = ATA_PIO4, 459 .pio_mask = ATA_PIO4,
diff --git a/drivers/ide/pci/delkin_cb.c b/drivers/ide/pci/delkin_cb.c
index 46f4a888c037..83829081640a 100644
--- a/drivers/ide/pci/delkin_cb.c
+++ b/drivers/ide/pci/delkin_cb.c
@@ -80,7 +80,7 @@ delkin_cb_probe (struct pci_dev *dev, const struct pci_device_id *id)
80 hw.irq = dev->irq; 80 hw.irq = dev->irq;
81 hw.chipset = ide_pci; /* this enables IRQ sharing */ 81 hw.chipset = ide_pci; /* this enables IRQ sharing */
82 82
83 rc = ide_register_hw_with_fixup(&hw, 0, &hwif, ide_undecoded_slave); 83 rc = ide_register_hw(&hw, &ide_undecoded_slave, 0, &hwif);
84 if (rc < 0) { 84 if (rc < 0) {
85 printk(KERN_ERR "delkin_cb: ide_register_hw failed (%d)\n", rc); 85 printk(KERN_ERR "delkin_cb: ide_register_hw failed (%d)\n", rc);
86 pci_disable_device(dev); 86 pci_disable_device(dev);
diff --git a/drivers/ide/pci/generic.c b/drivers/ide/pci/generic.c
index 51165832e7f2..f44d70852c3c 100644
--- a/drivers/ide/pci/generic.c
+++ b/drivers/ide/pci/generic.c
@@ -54,37 +54,24 @@ __setup("all-generic-ide", ide_generic_all_on);
54module_param_named(all_generic_ide, ide_generic_all, bool, 0444); 54module_param_named(all_generic_ide, ide_generic_all, bool, 0444);
55MODULE_PARM_DESC(all_generic_ide, "IDE generic will claim all unknown PCI IDE storage controllers."); 55MODULE_PARM_DESC(all_generic_ide, "IDE generic will claim all unknown PCI IDE storage controllers.");
56 56
57static void __devinit init_hwif_generic (ide_hwif_t *hwif) 57#define IDE_HFLAGS_UMC (IDE_HFLAG_NO_DMA | IDE_HFLAG_FORCE_LEGACY_IRQS)
58{
59 switch(hwif->pci_dev->device) {
60 case PCI_DEVICE_ID_UMC_UM8673F:
61 case PCI_DEVICE_ID_UMC_UM8886A:
62 case PCI_DEVICE_ID_UMC_UM8886BF:
63 hwif->irq = hwif->channel ? 15 : 14;
64 break;
65 default:
66 break;
67 }
68}
69 58
70#define DECLARE_GENERIC_PCI_DEV(name_str, dma_setting) \ 59#define DECLARE_GENERIC_PCI_DEV(name_str, extra_flags) \
71 { \ 60 { \
72 .name = name_str, \ 61 .name = name_str, \
73 .init_hwif = init_hwif_generic, \
74 .host_flags = IDE_HFLAG_TRUST_BIOS_FOR_DMA | \ 62 .host_flags = IDE_HFLAG_TRUST_BIOS_FOR_DMA | \
75 dma_setting | \ 63 extra_flags | \
76 IDE_HFLAG_BOOTABLE, \ 64 IDE_HFLAG_BOOTABLE, \
77 .swdma_mask = ATA_SWDMA2, \ 65 .swdma_mask = ATA_SWDMA2, \
78 .mwdma_mask = ATA_MWDMA2, \ 66 .mwdma_mask = ATA_MWDMA2, \
79 .udma_mask = ATA_UDMA6, \ 67 .udma_mask = ATA_UDMA6, \
80 } 68 }
81 69
82static ide_pci_device_t generic_chipsets[] __devinitdata = { 70static const struct ide_port_info generic_chipsets[] __devinitdata = {
83 /* 0 */ DECLARE_GENERIC_PCI_DEV("Unknown", 0), 71 /* 0 */ DECLARE_GENERIC_PCI_DEV("Unknown", 0),
84 72
85 { /* 1 */ 73 { /* 1 */
86 .name = "NS87410", 74 .name = "NS87410",
87 .init_hwif = init_hwif_generic,
88 .enablebits = {{0x43,0x08,0x08}, {0x47,0x08,0x08}}, 75 .enablebits = {{0x43,0x08,0x08}, {0x47,0x08,0x08}},
89 .host_flags = IDE_HFLAG_TRUST_BIOS_FOR_DMA | 76 .host_flags = IDE_HFLAG_TRUST_BIOS_FOR_DMA |
90 IDE_HFLAG_BOOTABLE, 77 IDE_HFLAG_BOOTABLE,
@@ -95,16 +82,15 @@ static ide_pci_device_t generic_chipsets[] __devinitdata = {
95 82
96 /* 2 */ DECLARE_GENERIC_PCI_DEV("SAMURAI", 0), 83 /* 2 */ DECLARE_GENERIC_PCI_DEV("SAMURAI", 0),
97 /* 3 */ DECLARE_GENERIC_PCI_DEV("HT6565", 0), 84 /* 3 */ DECLARE_GENERIC_PCI_DEV("HT6565", 0),
98 /* 4 */ DECLARE_GENERIC_PCI_DEV("UM8673F", IDE_HFLAG_NO_DMA), 85 /* 4 */ DECLARE_GENERIC_PCI_DEV("UM8673F", IDE_HFLAGS_UMC),
99 /* 5 */ DECLARE_GENERIC_PCI_DEV("UM8886A", IDE_HFLAG_NO_DMA), 86 /* 5 */ DECLARE_GENERIC_PCI_DEV("UM8886A", IDE_HFLAGS_UMC),
100 /* 6 */ DECLARE_GENERIC_PCI_DEV("UM8886BF", IDE_HFLAG_NO_DMA), 87 /* 6 */ DECLARE_GENERIC_PCI_DEV("UM8886BF", IDE_HFLAGS_UMC),
101 /* 7 */ DECLARE_GENERIC_PCI_DEV("HINT_IDE", 0), 88 /* 7 */ DECLARE_GENERIC_PCI_DEV("HINT_IDE", 0),
102 /* 8 */ DECLARE_GENERIC_PCI_DEV("VIA_IDE", IDE_HFLAG_NO_AUTODMA), 89 /* 8 */ DECLARE_GENERIC_PCI_DEV("VIA_IDE", IDE_HFLAG_NO_AUTODMA),
103 /* 9 */ DECLARE_GENERIC_PCI_DEV("OPTI621V", IDE_HFLAG_NO_AUTODMA), 90 /* 9 */ DECLARE_GENERIC_PCI_DEV("OPTI621V", IDE_HFLAG_NO_AUTODMA),
104 91
105 { /* 10 */ 92 { /* 10 */
106 .name = "VIA8237SATA", 93 .name = "VIA8237SATA",
107 .init_hwif = init_hwif_generic,
108 .host_flags = IDE_HFLAG_TRUST_BIOS_FOR_DMA | 94 .host_flags = IDE_HFLAG_TRUST_BIOS_FOR_DMA |
109 IDE_HFLAG_OFF_BOARD, 95 IDE_HFLAG_OFF_BOARD,
110 .swdma_mask = ATA_SWDMA2, 96 .swdma_mask = ATA_SWDMA2,
@@ -118,7 +104,6 @@ static ide_pci_device_t generic_chipsets[] __devinitdata = {
118 104
119 { /* 14 */ 105 { /* 14 */
120 .name = "Revolution", 106 .name = "Revolution",
121 .init_hwif = init_hwif_generic,
122 .host_flags = IDE_HFLAG_TRUST_BIOS_FOR_DMA | 107 .host_flags = IDE_HFLAG_TRUST_BIOS_FOR_DMA |
123 IDE_HFLAG_OFF_BOARD, 108 IDE_HFLAG_OFF_BOARD,
124 .swdma_mask = ATA_SWDMA2, 109 .swdma_mask = ATA_SWDMA2,
@@ -138,7 +123,7 @@ static ide_pci_device_t generic_chipsets[] __devinitdata = {
138 123
139static int __devinit generic_init_one(struct pci_dev *dev, const struct pci_device_id *id) 124static int __devinit generic_init_one(struct pci_dev *dev, const struct pci_device_id *id)
140{ 125{
141 ide_pci_device_t *d = &generic_chipsets[id->driver_data]; 126 const struct ide_port_info *d = &generic_chipsets[id->driver_data];
142 int ret = -ENODEV; 127 int ret = -ENODEV;
143 128
144 /* Don't use the generic entry unless instructed to do so */ 129 /* Don't use the generic entry unless instructed to do so */
diff --git a/drivers/ide/pci/hpt34x.c b/drivers/ide/pci/hpt34x.c
index 67af1a7dde30..ae6307fae4f9 100644
--- a/drivers/ide/pci/hpt34x.c
+++ b/drivers/ide/pci/hpt34x.c
@@ -129,7 +129,7 @@ static void __devinit init_hwif_hpt34x(ide_hwif_t *hwif)
129 hwif->set_dma_mode = &hpt34x_set_mode; 129 hwif->set_dma_mode = &hpt34x_set_mode;
130} 130}
131 131
132static ide_pci_device_t hpt34x_chipsets[] __devinitdata = { 132static const struct ide_port_info hpt34x_chipsets[] __devinitdata = {
133 { /* 0 */ 133 { /* 0 */
134 .name = "HPT343", 134 .name = "HPT343",
135 .init_chipset = init_chipset_hpt34x, 135 .init_chipset = init_chipset_hpt34x,
@@ -158,7 +158,7 @@ static ide_pci_device_t hpt34x_chipsets[] __devinitdata = {
158 158
159static int __devinit hpt34x_init_one(struct pci_dev *dev, const struct pci_device_id *id) 159static int __devinit hpt34x_init_one(struct pci_dev *dev, const struct pci_device_id *id)
160{ 160{
161 ide_pci_device_t *d; 161 const struct ide_port_info *d;
162 u16 pcicmd = 0; 162 u16 pcicmd = 0;
163 163
164 pci_read_config_word(dev, PCI_COMMAND, &pcicmd); 164 pci_read_config_word(dev, PCI_COMMAND, &pcicmd);
diff --git a/drivers/ide/pci/hpt366.c b/drivers/ide/pci/hpt366.c
index 18f5b7ddaee6..612b795241bf 100644
--- a/drivers/ide/pci/hpt366.c
+++ b/drivers/ide/pci/hpt366.c
@@ -1425,7 +1425,7 @@ static int __devinit hpt36x_init(struct pci_dev *dev, struct pci_dev *dev2)
1425 return 0; 1425 return 0;
1426} 1426}
1427 1427
1428static ide_pci_device_t hpt366_chipsets[] __devinitdata = { 1428static const struct ide_port_info hpt366_chipsets[] __devinitdata = {
1429 { /* 0 */ 1429 { /* 0 */
1430 .name = "HPT36x", 1430 .name = "HPT36x",
1431 .init_chipset = init_chipset_hpt366, 1431 .init_chipset = init_chipset_hpt366,
@@ -1510,7 +1510,7 @@ static int __devinit hpt366_init_one(struct pci_dev *dev, const struct pci_devic
1510{ 1510{
1511 struct hpt_info *info = NULL; 1511 struct hpt_info *info = NULL;
1512 struct pci_dev *dev2 = NULL; 1512 struct pci_dev *dev2 = NULL;
1513 ide_pci_device_t d; 1513 struct ide_port_info d;
1514 u8 idx = id->driver_data; 1514 u8 idx = id->driver_data;
1515 u8 rev = dev->revision; 1515 u8 rev = dev->revision;
1516 1516
diff --git a/drivers/ide/pci/it8213.c b/drivers/ide/pci/it8213.c
index dfbe605120cb..90b52ed37bfc 100644
--- a/drivers/ide/pci/it8213.c
+++ b/drivers/ide/pci/it8213.c
@@ -193,7 +193,7 @@ static void __devinit init_hwif_it8213(ide_hwif_t *hwif)
193 .udma_mask = ATA_UDMA6, \ 193 .udma_mask = ATA_UDMA6, \
194 } 194 }
195 195
196static ide_pci_device_t it8213_chipsets[] __devinitdata = { 196static const struct ide_port_info it8213_chipsets[] __devinitdata = {
197 /* 0 */ DECLARE_ITE_DEV("IT8213"), 197 /* 0 */ DECLARE_ITE_DEV("IT8213"),
198}; 198};
199 199
diff --git a/drivers/ide/pci/it821x.c b/drivers/ide/pci/it821x.c
index ec45b7247209..1a7ddd12e65c 100644
--- a/drivers/ide/pci/it821x.c
+++ b/drivers/ide/pci/it821x.c
@@ -638,7 +638,7 @@ static unsigned int __devinit init_chipset_it821x(struct pci_dev *dev, const cha
638 .pio_mask = ATA_PIO4, \ 638 .pio_mask = ATA_PIO4, \
639 } 639 }
640 640
641static ide_pci_device_t it821x_chipsets[] __devinitdata = { 641static const struct ide_port_info it821x_chipsets[] __devinitdata = {
642 /* 0 */ DECLARE_ITE_DEV("IT8212"), 642 /* 0 */ DECLARE_ITE_DEV("IT8212"),
643}; 643};
644 644
diff --git a/drivers/ide/pci/jmicron.c b/drivers/ide/pci/jmicron.c
index 2eeff670d9a6..bdf64d997708 100644
--- a/drivers/ide/pci/jmicron.c
+++ b/drivers/ide/pci/jmicron.c
@@ -118,7 +118,7 @@ static void __devinit init_hwif_jmicron(ide_hwif_t *hwif)
118 hwif->cbl = ata66_jmicron(hwif); 118 hwif->cbl = ata66_jmicron(hwif);
119} 119}
120 120
121static ide_pci_device_t jmicron_chipset __devinitdata = { 121static const struct ide_port_info jmicron_chipset __devinitdata = {
122 .name = "JMB", 122 .name = "JMB",
123 .init_hwif = init_hwif_jmicron, 123 .init_hwif = init_hwif_jmicron,
124 .host_flags = IDE_HFLAG_BOOTABLE, 124 .host_flags = IDE_HFLAG_BOOTABLE,
diff --git a/drivers/ide/pci/ns87415.c b/drivers/ide/pci/ns87415.c
index d21b58923829..d4df4642dbb5 100644
--- a/drivers/ide/pci/ns87415.c
+++ b/drivers/ide/pci/ns87415.c
@@ -260,7 +260,7 @@ static void __devinit init_hwif_ns87415 (ide_hwif_t *hwif)
260 hwif->ide_dma_end = &ns87415_ide_dma_end; 260 hwif->ide_dma_end = &ns87415_ide_dma_end;
261} 261}
262 262
263static ide_pci_device_t ns87415_chipset __devinitdata = { 263static const struct ide_port_info ns87415_chipset __devinitdata = {
264 .name = "NS87415", 264 .name = "NS87415",
265#ifdef CONFIG_SUPERIO 265#ifdef CONFIG_SUPERIO
266 .init_iops = init_iops_ns87415, 266 .init_iops = init_iops_ns87415,
diff --git a/drivers/ide/pci/opti621.c b/drivers/ide/pci/opti621.c
index 3573ffeaaa34..8953d9c3926f 100644
--- a/drivers/ide/pci/opti621.c
+++ b/drivers/ide/pci/opti621.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * linux/drivers/ide/pci/opti621.c Version 0.8 Aug 27, 2007 2 * linux/drivers/ide/pci/opti621.c Version 0.9 Sep 24, 2007
3 * 3 *
4 * Copyright (C) 1996-1998 Linus Torvalds & authors (see below) 4 * Copyright (C) 1996-1998 Linus Torvalds & authors (see below)
5 */ 5 */
@@ -133,6 +133,8 @@ static int reg_base;
133#define PIO_NOT_EXIST 254 133#define PIO_NOT_EXIST 254
134#define PIO_DONT_KNOW 255 134#define PIO_DONT_KNOW 255
135 135
136static DEFINE_SPINLOCK(opti621_lock);
137
136/* there are stored pio numbers from other calls of opti621_set_pio_mode */ 138/* there are stored pio numbers from other calls of opti621_set_pio_mode */
137static void compute_pios(ide_drive_t *drive, const u8 pio) 139static void compute_pios(ide_drive_t *drive, const u8 pio)
138/* Store values into drive->drive_data 140/* Store values into drive->drive_data
@@ -278,7 +280,7 @@ static void opti621_set_pio_mode(ide_drive_t *drive, const u8 pio)
278 second.recovery_time, drdy); 280 second.recovery_time, drdy);
279#endif 281#endif
280 282
281 spin_lock_irqsave(&ide_lock, flags); 283 spin_lock_irqsave(&opti621_lock, flags);
282 284
283 reg_base = hwif->io_ports[IDE_DATA_OFFSET]; 285 reg_base = hwif->io_ports[IDE_DATA_OFFSET];
284 286
@@ -317,7 +319,7 @@ static void opti621_set_pio_mode(ide_drive_t *drive, const u8 pio)
317 /* and read prefetch for both drives */ 319 /* and read prefetch for both drives */
318 write_reg(misc, MISC_REG); 320 write_reg(misc, MISC_REG);
319 321
320 spin_unlock_irqrestore(&ide_lock, flags); 322 spin_unlock_irqrestore(&opti621_lock, flags);
321} 323}
322 324
323/* 325/*
@@ -331,7 +333,7 @@ static void __devinit init_hwif_opti621 (ide_hwif_t *hwif)
331 hwif->set_pio_mode = &opti621_set_pio_mode; 333 hwif->set_pio_mode = &opti621_set_pio_mode;
332} 334}
333 335
334static ide_pci_device_t opti621_chipsets[] __devinitdata = { 336static const struct ide_port_info opti621_chipsets[] __devinitdata = {
335 { /* 0 */ 337 { /* 0 */
336 .name = "OPTI621", 338 .name = "OPTI621",
337 .init_hwif = init_hwif_opti621, 339 .init_hwif = init_hwif_opti621,
diff --git a/drivers/ide/pci/pdc202xx_new.c b/drivers/ide/pci/pdc202xx_new.c
index d1e7823454f3..4234efeba606 100644
--- a/drivers/ide/pci/pdc202xx_new.c
+++ b/drivers/ide/pci/pdc202xx_new.c
@@ -513,7 +513,7 @@ static struct pci_dev * __devinit pdc20270_get_dev2(struct pci_dev *dev)
513 .udma_mask = udma, \ 513 .udma_mask = udma, \
514 } 514 }
515 515
516static ide_pci_device_t pdcnew_chipsets[] __devinitdata = { 516static const struct ide_port_info pdcnew_chipsets[] __devinitdata = {
517 /* 0 */ DECLARE_PDCNEW_DEV("PDC20268", ATA_UDMA5), 517 /* 0 */ DECLARE_PDCNEW_DEV("PDC20268", ATA_UDMA5),
518 /* 1 */ DECLARE_PDCNEW_DEV("PDC20269", ATA_UDMA6), 518 /* 1 */ DECLARE_PDCNEW_DEV("PDC20269", ATA_UDMA6),
519 /* 2 */ DECLARE_PDCNEW_DEV("PDC20270", ATA_UDMA5), 519 /* 2 */ DECLARE_PDCNEW_DEV("PDC20270", ATA_UDMA5),
@@ -534,7 +534,7 @@ static ide_pci_device_t pdcnew_chipsets[] __devinitdata = {
534 534
535static int __devinit pdc202new_init_one(struct pci_dev *dev, const struct pci_device_id *id) 535static int __devinit pdc202new_init_one(struct pci_dev *dev, const struct pci_device_id *id)
536{ 536{
537 ide_pci_device_t *d; 537 const struct ide_port_info *d;
538 struct pci_dev *bridge = dev->bus->self; 538 struct pci_dev *bridge = dev->bus->self;
539 u8 idx = id->driver_data; 539 u8 idx = id->driver_data;
540 540
diff --git a/drivers/ide/pci/pdc202xx_old.c b/drivers/ide/pci/pdc202xx_old.c
index 29306121dc4a..e09742e2ba59 100644
--- a/drivers/ide/pci/pdc202xx_old.c
+++ b/drivers/ide/pci/pdc202xx_old.c
@@ -302,13 +302,6 @@ static unsigned int __devinit init_chipset_pdc202xx(struct pci_dev *dev,
302 302
303static void __devinit init_hwif_pdc202xx(ide_hwif_t *hwif) 303static void __devinit init_hwif_pdc202xx(ide_hwif_t *hwif)
304{ 304{
305 struct pci_dev *dev = hwif->pci_dev;
306
307 /* PDC20265 has problems with large LBA48 requests */
308 if ((dev->device == PCI_DEVICE_ID_PROMISE_20267) ||
309 (dev->device == PCI_DEVICE_ID_PROMISE_20265))
310 hwif->rqsize = 256;
311
312 hwif->set_pio_mode = &pdc202xx_set_pio_mode; 305 hwif->set_pio_mode = &pdc202xx_set_pio_mode;
313 hwif->set_dma_mode = &pdc202xx_set_mode; 306 hwif->set_dma_mode = &pdc202xx_set_mode;
314 307
@@ -382,7 +375,7 @@ static void __devinit pdc202ata4_fixup_irq(struct pci_dev *dev,
382 } 375 }
383} 376}
384 377
385#define DECLARE_PDC2026X_DEV(name_str, udma) \ 378#define DECLARE_PDC2026X_DEV(name_str, udma, extra_flags) \
386 { \ 379 { \
387 .name = name_str, \ 380 .name = name_str, \
388 .init_chipset = init_chipset_pdc202xx, \ 381 .init_chipset = init_chipset_pdc202xx, \
@@ -390,13 +383,14 @@ static void __devinit pdc202ata4_fixup_irq(struct pci_dev *dev,
390 .init_dma = init_dma_pdc202xx, \ 383 .init_dma = init_dma_pdc202xx, \
391 .extra = 48, \ 384 .extra = 48, \
392 .host_flags = IDE_HFLAG_ERROR_STOPS_FIFO | \ 385 .host_flags = IDE_HFLAG_ERROR_STOPS_FIFO | \
386 extra_flags | \
393 IDE_HFLAG_OFF_BOARD, \ 387 IDE_HFLAG_OFF_BOARD, \
394 .pio_mask = ATA_PIO4, \ 388 .pio_mask = ATA_PIO4, \
395 .mwdma_mask = ATA_MWDMA2, \ 389 .mwdma_mask = ATA_MWDMA2, \
396 .udma_mask = udma, \ 390 .udma_mask = udma, \
397 } 391 }
398 392
399static ide_pci_device_t pdc202xx_chipsets[] __devinitdata = { 393static const struct ide_port_info pdc202xx_chipsets[] __devinitdata = {
400 { /* 0 */ 394 { /* 0 */
401 .name = "PDC20246", 395 .name = "PDC20246",
402 .init_chipset = init_chipset_pdc202xx, 396 .init_chipset = init_chipset_pdc202xx,
@@ -410,10 +404,10 @@ static ide_pci_device_t pdc202xx_chipsets[] __devinitdata = {
410 .udma_mask = ATA_UDMA2, 404 .udma_mask = ATA_UDMA2,
411 }, 405 },
412 406
413 /* 1 */ DECLARE_PDC2026X_DEV("PDC20262", ATA_UDMA4), 407 /* 1 */ DECLARE_PDC2026X_DEV("PDC20262", ATA_UDMA4, 0),
414 /* 2 */ DECLARE_PDC2026X_DEV("PDC20263", ATA_UDMA4), 408 /* 2 */ DECLARE_PDC2026X_DEV("PDC20263", ATA_UDMA4, 0),
415 /* 3 */ DECLARE_PDC2026X_DEV("PDC20265", ATA_UDMA5), 409 /* 3 */ DECLARE_PDC2026X_DEV("PDC20265", ATA_UDMA5, IDE_HFLAG_RQSIZE_256),
416 /* 4 */ DECLARE_PDC2026X_DEV("PDC20267", ATA_UDMA5), 410 /* 4 */ DECLARE_PDC2026X_DEV("PDC20267", ATA_UDMA5, IDE_HFLAG_RQSIZE_256),
417}; 411};
418 412
419/** 413/**
@@ -427,7 +421,7 @@ static ide_pci_device_t pdc202xx_chipsets[] __devinitdata = {
427 421
428static int __devinit pdc202xx_init_one(struct pci_dev *dev, const struct pci_device_id *id) 422static int __devinit pdc202xx_init_one(struct pci_dev *dev, const struct pci_device_id *id)
429{ 423{
430 ide_pci_device_t *d; 424 const struct ide_port_info *d;
431 u8 idx = id->driver_data; 425 u8 idx = id->driver_data;
432 426
433 d = &pdc202xx_chipsets[idx]; 427 d = &pdc202xx_chipsets[idx];
diff --git a/drivers/ide/pci/piix.c b/drivers/ide/pci/piix.c
index ec0c6e96a213..9329d4a810e5 100644
--- a/drivers/ide/pci/piix.c
+++ b/drivers/ide/pci/piix.c
@@ -396,7 +396,7 @@ static void __devinit init_hwif_ich(ide_hwif_t *hwif)
396 .udma_mask = udma, \ 396 .udma_mask = udma, \
397 } 397 }
398 398
399static ide_pci_device_t piix_pci_info[] __devinitdata = { 399static const struct ide_port_info piix_pci_info[] __devinitdata = {
400 /* 0 */ DECLARE_PIIX_DEV("PIIXa", 0x00), /* no udma */ 400 /* 0 */ DECLARE_PIIX_DEV("PIIXa", 0x00), /* no udma */
401 /* 1 */ DECLARE_PIIX_DEV("PIIXb", 0x00), /* no udma */ 401 /* 1 */ DECLARE_PIIX_DEV("PIIXb", 0x00), /* no udma */
402 402
@@ -449,9 +449,7 @@ static ide_pci_device_t piix_pci_info[] __devinitdata = {
449 449
450static int __devinit piix_init_one(struct pci_dev *dev, const struct pci_device_id *id) 450static int __devinit piix_init_one(struct pci_dev *dev, const struct pci_device_id *id)
451{ 451{
452 ide_pci_device_t *d = &piix_pci_info[id->driver_data]; 452 return ide_setup_pci_device(dev, &piix_pci_info[id->driver_data]);
453
454 return ide_setup_pci_device(dev, d);
455} 453}
456 454
457/** 455/**
diff --git a/drivers/ide/pci/rz1000.c b/drivers/ide/pci/rz1000.c
index dd2583ef1ad7..6b10ae260fa2 100644
--- a/drivers/ide/pci/rz1000.c
+++ b/drivers/ide/pci/rz1000.c
@@ -35,13 +35,13 @@ static void __devinit init_hwif_rz1000 (ide_hwif_t *hwif)
35 u16 reg; 35 u16 reg;
36 struct pci_dev *dev = hwif->pci_dev; 36 struct pci_dev *dev = hwif->pci_dev;
37 37
38 hwif->chipset = ide_rz1000;
39 if (!pci_read_config_word (dev, 0x40, &reg) && 38 if (!pci_read_config_word (dev, 0x40, &reg) &&
40 !pci_write_config_word(dev, 0x40, reg & 0xdfff)) { 39 !pci_write_config_word(dev, 0x40, reg & 0xdfff)) {
41 printk(KERN_INFO "%s: disabled chipset read-ahead " 40 printk(KERN_INFO "%s: disabled chipset read-ahead "
42 "(buggy RZ1000/RZ1001)\n", hwif->name); 41 "(buggy RZ1000/RZ1001)\n", hwif->name);
43 } else { 42 } else {
44 hwif->serialized = 1; 43 if (hwif->mate)
44 hwif->mate->serialized = hwif->serialized = 1;
45 hwif->drives[0].no_unmask = 1; 45 hwif->drives[0].no_unmask = 1;
46 hwif->drives[1].no_unmask = 1; 46 hwif->drives[1].no_unmask = 1;
47 printk(KERN_INFO "%s: serialized, disabled unmasking " 47 printk(KERN_INFO "%s: serialized, disabled unmasking "
@@ -49,9 +49,10 @@ static void __devinit init_hwif_rz1000 (ide_hwif_t *hwif)
49 } 49 }
50} 50}
51 51
52static ide_pci_device_t rz1000_chipset __devinitdata = { 52static const struct ide_port_info rz1000_chipset __devinitdata = {
53 .name = "RZ100x", 53 .name = "RZ100x",
54 .init_hwif = init_hwif_rz1000, 54 .init_hwif = init_hwif_rz1000,
55 .chipset = ide_rz1000,
55 .host_flags = IDE_HFLAG_NO_DMA | IDE_HFLAG_BOOTABLE, 56 .host_flags = IDE_HFLAG_NO_DMA | IDE_HFLAG_BOOTABLE,
56}; 57};
57 58
diff --git a/drivers/ide/pci/sc1200.c b/drivers/ide/pci/sc1200.c
index b2423e03bf36..d2c8b5524f28 100644
--- a/drivers/ide/pci/sc1200.c
+++ b/drivers/ide/pci/sc1200.c
@@ -372,7 +372,7 @@ static void __devinit init_hwif_sc1200 (ide_hwif_t *hwif)
372 hwif->ide_dma_end = &sc1200_ide_dma_end; 372 hwif->ide_dma_end = &sc1200_ide_dma_end;
373} 373}
374 374
375static ide_pci_device_t sc1200_chipset __devinitdata = { 375static const struct ide_port_info sc1200_chipset __devinitdata = {
376 .name = "SC1200", 376 .name = "SC1200",
377 .init_hwif = init_hwif_sc1200, 377 .init_hwif = init_hwif_sc1200,
378 .host_flags = IDE_HFLAG_SERIALIZE | 378 .host_flags = IDE_HFLAG_SERIALIZE |
diff --git a/drivers/ide/pci/scc_pata.c b/drivers/ide/pci/scc_pata.c
index ae9b50331d2a..ebb7132b9b84 100644
--- a/drivers/ide/pci/scc_pata.c
+++ b/drivers/ide/pci/scc_pata.c
@@ -538,12 +538,13 @@ static int setup_mmio_scc (struct pci_dev *dev, const char *name)
538/** 538/**
539 * init_setup_scc - set up an SCC PATA Controller 539 * init_setup_scc - set up an SCC PATA Controller
540 * @dev: PCI device 540 * @dev: PCI device
541 * @d: IDE PCI device 541 * @d: IDE port info
542 * 542 *
543 * Perform the initial set up for this device. 543 * Perform the initial set up for this device.
544 */ 544 */
545 545
546static int __devinit init_setup_scc(struct pci_dev *dev, ide_pci_device_t *d) 546static int __devinit init_setup_scc(struct pci_dev *dev,
547 const struct ide_port_info *d)
547{ 548{
548 unsigned long ctl_base; 549 unsigned long ctl_base;
549 unsigned long dma_base; 550 unsigned long dma_base;
@@ -702,7 +703,7 @@ static void __devinit init_hwif_scc(ide_hwif_t *hwif)
702 .pio_mask = ATA_PIO4, \ 703 .pio_mask = ATA_PIO4, \
703 } 704 }
704 705
705static ide_pci_device_t scc_chipsets[] __devinitdata = { 706static const struct ide_port_info scc_chipsets[] __devinitdata = {
706 /* 0 */ DECLARE_SCC_DEV("sccIDE"), 707 /* 0 */ DECLARE_SCC_DEV("sccIDE"),
707}; 708};
708 709
@@ -717,9 +718,7 @@ static ide_pci_device_t scc_chipsets[] __devinitdata = {
717 718
718static int __devinit scc_init_one(struct pci_dev *dev, const struct pci_device_id *id) 719static int __devinit scc_init_one(struct pci_dev *dev, const struct pci_device_id *id)
719{ 720{
720 ide_pci_device_t *d = &scc_chipsets[id->driver_data]; 721 return init_setup_scc(dev, &scc_chipsets[id->driver_data]);
721
722 return init_setup_scc(dev, d);
723} 722}
724 723
725/** 724/**
diff --git a/drivers/ide/pci/serverworks.c b/drivers/ide/pci/serverworks.c
index a3d880e21d0b..a7280311357b 100644
--- a/drivers/ide/pci/serverworks.c
+++ b/drivers/ide/pci/serverworks.c
@@ -158,13 +158,6 @@ static void svwks_set_dma_mode(ide_drive_t *drive, const u8 speed)
158 158
159 u8 ultra_enable = 0, ultra_timing = 0, dma_timing = 0; 159 u8 ultra_enable = 0, ultra_timing = 0, dma_timing = 0;
160 160
161 /* If we are about to put a disk into UDMA mode we screwed up.
162 Our code assumes we never _ever_ do this on an OSB4 */
163
164 if(dev->device == PCI_DEVICE_ID_SERVERWORKS_OSB4 &&
165 drive->media == ide_disk && speed >= XFER_UDMA_0)
166 BUG();
167
168 pci_read_config_byte(dev, (0x56|hwif->channel), &ultra_timing); 161 pci_read_config_byte(dev, (0x56|hwif->channel), &ultra_timing);
169 pci_read_config_byte(dev, 0x54, &ultra_enable); 162 pci_read_config_byte(dev, 0x54, &ultra_enable);
170 163
@@ -373,7 +366,7 @@ static void __devinit init_hwif_svwks (ide_hwif_t *hwif)
373 } 366 }
374} 367}
375 368
376static ide_pci_device_t serverworks_chipsets[] __devinitdata = { 369static const struct ide_port_info serverworks_chipsets[] __devinitdata = {
377 { /* 0 */ 370 { /* 0 */
378 .name = "SvrWks OSB4", 371 .name = "SvrWks OSB4",
379 .init_chipset = init_chipset_svwks, 372 .init_chipset = init_chipset_svwks,
@@ -430,7 +423,7 @@ static ide_pci_device_t serverworks_chipsets[] __devinitdata = {
430 423
431static int __devinit svwks_init_one(struct pci_dev *dev, const struct pci_device_id *id) 424static int __devinit svwks_init_one(struct pci_dev *dev, const struct pci_device_id *id)
432{ 425{
433 ide_pci_device_t d; 426 struct ide_port_info d;
434 u8 idx = id->driver_data; 427 u8 idx = id->driver_data;
435 428
436 d = serverworks_chipsets[idx]; 429 d = serverworks_chipsets[idx];
diff --git a/drivers/ide/pci/sgiioc4.c b/drivers/ide/pci/sgiioc4.c
index 5af74ea1d46e..de820aa58cd0 100644
--- a/drivers/ide/pci/sgiioc4.c
+++ b/drivers/ide/pci/sgiioc4.c
@@ -614,6 +614,7 @@ sgiioc4_ide_setup_pci_device(struct pci_dev *dev)
614 void __iomem *virt_base; 614 void __iomem *virt_base;
615 ide_hwif_t *hwif; 615 ide_hwif_t *hwif;
616 int h; 616 int h;
617 u8 idx[4] = { 0xff, 0xff, 0xff, 0xff };
617 618
618 /* 619 /*
619 * Find an empty HWIF; if none available, return -ENOMEM. 620 * Find an empty HWIF; if none available, return -ENOMEM.
@@ -654,10 +655,12 @@ sgiioc4_ide_setup_pci_device(struct pci_dev *dev)
654 } 655 }
655 656
656 if (hwif->io_ports[IDE_DATA_OFFSET] != cmd_base) { 657 if (hwif->io_ports[IDE_DATA_OFFSET] != cmd_base) {
658 hw_regs_t hw;
659
657 /* Initialize the IO registers */ 660 /* Initialize the IO registers */
658 sgiioc4_init_hwif_ports(&hwif->hw, cmd_base, ctl, irqport); 661 memset(&hw, 0, sizeof(hw));
659 memcpy(hwif->io_ports, hwif->hw.io_ports, 662 sgiioc4_init_hwif_ports(&hw, cmd_base, ctl, irqport);
660 sizeof (hwif->io_ports)); 663 memcpy(hwif->io_ports, hw.io_ports, sizeof(hwif->io_ports));
661 hwif->noprobe = !hwif->io_ports[IDE_DATA_OFFSET]; 664 hwif->noprobe = !hwif->io_ports[IDE_DATA_OFFSET];
662 } 665 }
663 666
@@ -679,11 +682,10 @@ sgiioc4_ide_setup_pci_device(struct pci_dev *dev)
679 682
680 ide_init_sgiioc4(hwif); 683 ide_init_sgiioc4(hwif);
681 684
682 if (probe_hwif_init(hwif)) 685 idx[0] = hwif->index;
683 return -EIO;
684 686
685 /* Create /proc/ide entries */ 687 if (ide_device_add(idx))
686 ide_proc_register_port(hwif); 688 return -EIO;
687 689
688 return 0; 690 return 0;
689} 691}
diff --git a/drivers/ide/pci/siimage.c b/drivers/ide/pci/siimage.c
index 689786df1ede..dc915cb22bec 100644
--- a/drivers/ide/pci/siimage.c
+++ b/drivers/ide/pci/siimage.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * linux/drivers/ide/pci/siimage.c Version 1.17 Oct 18 2007 2 * linux/drivers/ide/pci/siimage.c Version 1.18 Oct 18 2007
3 * 3 *
4 * Copyright (C) 2001-2002 Andre Hedrick <andre@linux-ide.org> 4 * Copyright (C) 2001-2002 Andre Hedrick <andre@linux-ide.org>
5 * Copyright (C) 2003 Red Hat <alan@redhat.com> 5 * Copyright (C) 2003 Red Hat <alan@redhat.com>
@@ -57,8 +57,8 @@
57 57
58static int pdev_is_sata(struct pci_dev *pdev) 58static int pdev_is_sata(struct pci_dev *pdev)
59{ 59{
60 switch(pdev->device) 60#ifdef CONFIG_BLK_DEV_IDE_SATA
61 { 61 switch(pdev->device) {
62 case PCI_DEVICE_ID_SII_3112: 62 case PCI_DEVICE_ID_SII_3112:
63 case PCI_DEVICE_ID_SII_1210SA: 63 case PCI_DEVICE_ID_SII_1210SA:
64 return 1; 64 return 1;
@@ -66,9 +66,10 @@ static int pdev_is_sata(struct pci_dev *pdev)
66 return 0; 66 return 0;
67 } 67 }
68 BUG(); 68 BUG();
69#endif
69 return 0; 70 return 0;
70} 71}
71 72
72/** 73/**
73 * is_sata - check if hwif is SATA 74 * is_sata - check if hwif is SATA
74 * @hwif: interface to check 75 * @hwif: interface to check
@@ -136,7 +137,7 @@ static inline unsigned long siimage_seldev(ide_drive_t *drive, int r)
136 * SI3112 SATA controller life is a bit simpler. 137 * SI3112 SATA controller life is a bit simpler.
137 */ 138 */
138 139
139static u8 sil_udma_filter(ide_drive_t *drive) 140static u8 sil_pata_udma_filter(ide_drive_t *drive)
140{ 141{
141 ide_hwif_t *hwif = drive->hwif; 142 ide_hwif_t *hwif = drive->hwif;
142 unsigned long base = (unsigned long) hwif->hwif_data; 143 unsigned long base = (unsigned long) hwif->hwif_data;
@@ -147,23 +148,23 @@ static u8 sil_udma_filter(ide_drive_t *drive)
147 else 148 else
148 pci_read_config_byte(hwif->pci_dev, 0x8A, &scsc); 149 pci_read_config_byte(hwif->pci_dev, 0x8A, &scsc);
149 150
150 if (is_sata(hwif)) {
151 mask = strstr(drive->id->model, "Maxtor") ? 0x3f : 0x7f;
152 goto out;
153 }
154
155 if ((scsc & 0x30) == 0x10) /* 133 */ 151 if ((scsc & 0x30) == 0x10) /* 133 */
156 mask = 0x7f; 152 mask = ATA_UDMA6;
157 else if ((scsc & 0x30) == 0x20) /* 2xPCI */ 153 else if ((scsc & 0x30) == 0x20) /* 2xPCI */
158 mask = 0x7f; 154 mask = ATA_UDMA6;
159 else if ((scsc & 0x30) == 0x00) /* 100 */ 155 else if ((scsc & 0x30) == 0x00) /* 100 */
160 mask = 0x3f; 156 mask = ATA_UDMA5;
161 else /* Disabled ? */ 157 else /* Disabled ? */
162 BUG(); 158 BUG();
163out: 159
164 return mask; 160 return mask;
165} 161}
166 162
163static u8 sil_sata_udma_filter(ide_drive_t *drive)
164{
165 return strstr(drive->id->model, "Maxtor") ? ATA_UDMA5 : ATA_UDMA6;
166}
167
167/** 168/**
168 * sil_set_pio_mode - set host controller for PIO mode 169 * sil_set_pio_mode - set host controller for PIO mode
169 * @drive: drive 170 * @drive: drive
@@ -340,10 +341,11 @@ static int siimage_io_ide_dma_test_irq (ide_drive_t *drive)
340static int siimage_mmio_ide_dma_test_irq (ide_drive_t *drive) 341static int siimage_mmio_ide_dma_test_irq (ide_drive_t *drive)
341{ 342{
342 ide_hwif_t *hwif = HWIF(drive); 343 ide_hwif_t *hwif = HWIF(drive);
343 unsigned long base = (unsigned long)hwif->hwif_data;
344 unsigned long addr = siimage_selreg(hwif, 0x1); 344 unsigned long addr = siimage_selreg(hwif, 0x1);
345 345
346 if (SATA_ERROR_REG) { 346 if (SATA_ERROR_REG) {
347 unsigned long base = (unsigned long)hwif->hwif_data;
348
347 u32 ext_stat = readl((void __iomem *)(base + 0x10)); 349 u32 ext_stat = readl((void __iomem *)(base + 0x10));
348 u8 watchdog = 0; 350 u8 watchdog = 0;
349 if (ext_stat & ((hwif->channel) ? 0x40 : 0x10)) { 351 if (ext_stat & ((hwif->channel) ? 0x40 : 0x10)) {
@@ -376,7 +378,7 @@ static int siimage_mmio_ide_dma_test_irq (ide_drive_t *drive)
376} 378}
377 379
378/** 380/**
379 * siimage_busproc - bus isolation ioctl 381 * sil_sata_busproc - bus isolation IOCTL
380 * @drive: drive to isolate/restore 382 * @drive: drive to isolate/restore
381 * @state: bus state to set 383 * @state: bus state to set
382 * 384 *
@@ -384,8 +386,8 @@ static int siimage_mmio_ide_dma_test_irq (ide_drive_t *drive)
384 * SATA controller the work required is quite limited, we 386 * SATA controller the work required is quite limited, we
385 * just have to clean up the statistics 387 * just have to clean up the statistics
386 */ 388 */
387 389
388static int siimage_busproc (ide_drive_t * drive, int state) 390static int sil_sata_busproc(ide_drive_t * drive, int state)
389{ 391{
390 ide_hwif_t *hwif = HWIF(drive); 392 ide_hwif_t *hwif = HWIF(drive);
391 u32 stat_config = 0; 393 u32 stat_config = 0;
@@ -417,14 +419,14 @@ static int siimage_busproc (ide_drive_t * drive, int state)
417} 419}
418 420
419/** 421/**
420 * siimage_reset_poll - wait for sata reset 422 * sil_sata_reset_poll - wait for SATA reset
421 * @drive: drive we are resetting 423 * @drive: drive we are resetting
422 * 424 *
423 * Poll the SATA phy and see whether it has come back from the dead 425 * Poll the SATA phy and see whether it has come back from the dead
424 * yet. 426 * yet.
425 */ 427 */
426 428
427static int siimage_reset_poll (ide_drive_t *drive) 429static int sil_sata_reset_poll(ide_drive_t *drive)
428{ 430{
429 if (SATA_STATUS_REG) { 431 if (SATA_STATUS_REG) {
430 ide_hwif_t *hwif = HWIF(drive); 432 ide_hwif_t *hwif = HWIF(drive);
@@ -436,27 +438,22 @@ static int siimage_reset_poll (ide_drive_t *drive)
436 HWGROUP(drive)->polling = 0; 438 HWGROUP(drive)->polling = 0;
437 return ide_started; 439 return ide_started;
438 } 440 }
439 return 0;
440 } else {
441 return 0;
442 } 441 }
442
443 return 0;
443} 444}
444 445
445/** 446/**
446 * siimage_pre_reset - reset hook 447 * sil_sata_pre_reset - reset hook
447 * @drive: IDE device being reset 448 * @drive: IDE device being reset
448 * 449 *
449 * For the SATA devices we need to handle recalibration/geometry 450 * For the SATA devices we need to handle recalibration/geometry
450 * differently 451 * differently
451 */ 452 */
452
453static void siimage_pre_reset (ide_drive_t *drive)
454{
455 if (drive->media != ide_disk)
456 return;
457 453
458 if (is_sata(HWIF(drive))) 454static void sil_sata_pre_reset(ide_drive_t *drive)
459 { 455{
456 if (drive->media == ide_disk) {
460 drive->special.b.set_geometry = 0; 457 drive->special.b.set_geometry = 0;
461 drive->special.b.recalibrate = 0; 458 drive->special.b.recalibrate = 0;
462 } 459 }
@@ -502,7 +499,6 @@ static void siimage_reset (ide_drive_t *drive)
502 drive->failures++; 499 drive->failures++;
503 } 500 }
504 } 501 }
505
506} 502}
507 503
508/** 504/**
@@ -758,16 +754,11 @@ static void __devinit init_mmio_iops_siimage(ide_hwif_t *hwif)
758 hwif->sata_misc[SATA_IEN_OFFSET] = base + 0x148; 754 hwif->sata_misc[SATA_IEN_OFFSET] = base + 0x148;
759 } 755 }
760 756
761 hw.irq = hwif->pci_dev->irq; 757 memcpy(hwif->io_ports, hw.io_ports, sizeof(hwif->io_ports));
762 758
763 memcpy(&hwif->hw, &hw, sizeof(hw)); 759 hwif->irq = dev->irq;
764 memcpy(hwif->io_ports, hwif->hw.io_ports, sizeof(hwif->hw.io_ports));
765 760
766 hwif->irq = hw.irq; 761 hwif->dma_base = (unsigned long)addr + (ch ? 0x08 : 0x00);
767
768 base = (unsigned long) addr;
769
770 hwif->dma_base = base + (ch ? 0x08 : 0x00);
771 762
772 hwif->mmio = 1; 763 hwif->mmio = 1;
773} 764}
@@ -864,28 +855,31 @@ static u8 __devinit ata66_siimage(ide_hwif_t *hwif)
864 855
865static void __devinit init_hwif_siimage(ide_hwif_t *hwif) 856static void __devinit init_hwif_siimage(ide_hwif_t *hwif)
866{ 857{
858 u8 sata = is_sata(hwif);
859
867 hwif->resetproc = &siimage_reset; 860 hwif->resetproc = &siimage_reset;
868 hwif->set_pio_mode = &sil_set_pio_mode; 861 hwif->set_pio_mode = &sil_set_pio_mode;
869 hwif->set_dma_mode = &sil_set_dma_mode; 862 hwif->set_dma_mode = &sil_set_dma_mode;
870 hwif->reset_poll = &siimage_reset_poll;
871 hwif->pre_reset = &siimage_pre_reset;
872 hwif->udma_filter = &sil_udma_filter;
873 863
874 if(is_sata(hwif)) { 864 if (sata) {
875 static int first = 1; 865 static int first = 1;
876 866
877 hwif->busproc = &siimage_busproc; 867 hwif->busproc = &sil_sata_busproc;
868 hwif->reset_poll = &sil_sata_reset_poll;
869 hwif->pre_reset = &sil_sata_pre_reset;
870 hwif->udma_filter = &sil_sata_udma_filter;
878 871
879 if (first) { 872 if (first) {
880 printk(KERN_INFO "siimage: For full SATA support you should use the libata sata_sil module.\n"); 873 printk(KERN_INFO "siimage: For full SATA support you should use the libata sata_sil module.\n");
881 first = 0; 874 first = 0;
882 } 875 }
883 } 876 } else
877 hwif->udma_filter = &sil_pata_udma_filter;
884 878
885 if (hwif->dma_base == 0) 879 if (hwif->dma_base == 0)
886 return; 880 return;
887 881
888 if (is_sata(hwif)) 882 if (sata)
889 hwif->host_flags |= IDE_HFLAG_NO_ATAPI_DMA; 883 hwif->host_flags |= IDE_HFLAG_NO_ATAPI_DMA;
890 884
891 if (hwif->cbl != ATA_CBL_PATA40_SHORT) 885 if (hwif->cbl != ATA_CBL_PATA40_SHORT)
@@ -911,7 +905,7 @@ static void __devinit init_hwif_siimage(ide_hwif_t *hwif)
911 .udma_mask = ATA_UDMA6, \ 905 .udma_mask = ATA_UDMA6, \
912 } 906 }
913 907
914static ide_pci_device_t siimage_chipsets[] __devinitdata = { 908static const struct ide_port_info siimage_chipsets[] __devinitdata = {
915 /* 0 */ DECLARE_SII_DEV("SiI680"), 909 /* 0 */ DECLARE_SII_DEV("SiI680"),
916 /* 1 */ DECLARE_SII_DEV("SiI3112 Serial ATA"), 910 /* 1 */ DECLARE_SII_DEV("SiI3112 Serial ATA"),
917 /* 2 */ DECLARE_SII_DEV("Adaptec AAR-1210SA") 911 /* 2 */ DECLARE_SII_DEV("Adaptec AAR-1210SA")
diff --git a/drivers/ide/pci/sis5513.c b/drivers/ide/pci/sis5513.c
index c1d280b06391..6b7bb53acefd 100644
--- a/drivers/ide/pci/sis5513.c
+++ b/drivers/ide/pci/sis5513.c
@@ -264,7 +264,7 @@ static void sis_ata133_program_timings(ide_drive_t *drive, const u8 mode)
264 if (mode >= XFER_MW_DMA_0) { 264 if (mode >= XFER_MW_DMA_0) {
265 t1 &= ~0x04; /* disable UDMA */ 265 t1 &= ~0x04; /* disable UDMA */
266 idx = mode - XFER_MW_DMA_0 + 5; 266 idx = mode - XFER_MW_DMA_0 + 5;
267 } 267 } else
268 idx = mode - XFER_PIO_0; 268 idx = mode - XFER_PIO_0;
269 t1 |= ini_time_value[clk][idx] << 12; 269 t1 |= ini_time_value[clk][idx] << 12;
270 t1 |= act_time_value[clk][idx] << 16; 270 t1 |= act_time_value[clk][idx] << 16;
@@ -579,7 +579,7 @@ static void __devinit init_hwif_sis5513 (ide_hwif_t *hwif)
579 hwif->cbl = ata66_sis5513(hwif); 579 hwif->cbl = ata66_sis5513(hwif);
580} 580}
581 581
582static ide_pci_device_t sis5513_chipset __devinitdata = { 582static const struct ide_port_info sis5513_chipset __devinitdata = {
583 .name = "SIS5513", 583 .name = "SIS5513",
584 .init_chipset = init_chipset_sis5513, 584 .init_chipset = init_chipset_sis5513,
585 .init_hwif = init_hwif_sis5513, 585 .init_hwif = init_hwif_sis5513,
diff --git a/drivers/ide/pci/sl82c105.c b/drivers/ide/pci/sl82c105.c
index 0dce459b1269..147d783f7529 100644
--- a/drivers/ide/pci/sl82c105.c
+++ b/drivers/ide/pci/sl82c105.c
@@ -361,13 +361,6 @@ static void __devinit init_hwif_sl82c105(ide_hwif_t *hwif)
361 hwif->selectproc = &sl82c105_selectproc; 361 hwif->selectproc = &sl82c105_selectproc;
362 hwif->resetproc = &sl82c105_resetproc; 362 hwif->resetproc = &sl82c105_resetproc;
363 363
364 /*
365 * We support 32-bit I/O on this interface, and
366 * it doesn't have problems with interrupts.
367 */
368 hwif->drives[0].io_32bit = hwif->drives[1].io_32bit = 1;
369 hwif->drives[0].unmask = hwif->drives[1].unmask = 1;
370
371 if (!hwif->dma_base) 364 if (!hwif->dma_base)
372 return; 365 return;
373 366
@@ -394,12 +387,15 @@ static void __devinit init_hwif_sl82c105(ide_hwif_t *hwif)
394 hwif->serialized = hwif->mate->serialized = 1; 387 hwif->serialized = hwif->mate->serialized = 1;
395} 388}
396 389
397static ide_pci_device_t sl82c105_chipset __devinitdata = { 390static const struct ide_port_info sl82c105_chipset __devinitdata = {
398 .name = "W82C105", 391 .name = "W82C105",
399 .init_chipset = init_chipset_sl82c105, 392 .init_chipset = init_chipset_sl82c105,
400 .init_hwif = init_hwif_sl82c105, 393 .init_hwif = init_hwif_sl82c105,
401 .enablebits = {{0x40,0x01,0x01}, {0x40,0x10,0x10}}, 394 .enablebits = {{0x40,0x01,0x01}, {0x40,0x10,0x10}},
402 .host_flags = IDE_HFLAG_NO_AUTODMA | IDE_HFLAG_BOOTABLE, 395 .host_flags = IDE_HFLAG_IO_32BIT |
396 IDE_HFLAG_UNMASK_IRQS |
397 IDE_HFLAG_NO_AUTODMA |
398 IDE_HFLAG_BOOTABLE,
403 .pio_mask = ATA_PIO5, 399 .pio_mask = ATA_PIO5,
404}; 400};
405 401
diff --git a/drivers/ide/pci/slc90e66.c b/drivers/ide/pci/slc90e66.c
index 4f22dffdf8ef..eb4445b229ed 100644
--- a/drivers/ide/pci/slc90e66.c
+++ b/drivers/ide/pci/slc90e66.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * linux/drivers/ide/pci/slc90e66.c Version 0.18 Aug 9, 2007 2 * linux/drivers/ide/pci/slc90e66.c Version 0.19 Sep 24, 2007
3 * 3 *
4 * Copyright (C) 2000-2002 Andre Hedrick <andre@linux-ide.org> 4 * Copyright (C) 2000-2002 Andre Hedrick <andre@linux-ide.org>
5 * Copyright (C) 2006-2007 MontaVista Software, Inc. <source@mvista.com> 5 * Copyright (C) 2006-2007 MontaVista Software, Inc. <source@mvista.com>
@@ -21,6 +21,8 @@
21 21
22#include <asm/io.h> 22#include <asm/io.h>
23 23
24static DEFINE_SPINLOCK(slc90e66_lock);
25
24static void slc90e66_set_pio_mode(ide_drive_t *drive, const u8 pio) 26static void slc90e66_set_pio_mode(ide_drive_t *drive, const u8 pio)
25{ 27{
26 ide_hwif_t *hwif = HWIF(drive); 28 ide_hwif_t *hwif = HWIF(drive);
@@ -40,7 +42,7 @@ static void slc90e66_set_pio_mode(ide_drive_t *drive, const u8 pio)
40 { 2, 1 }, 42 { 2, 1 },
41 { 2, 3 }, }; 43 { 2, 3 }, };
42 44
43 spin_lock_irqsave(&ide_lock, flags); 45 spin_lock_irqsave(&slc90e66_lock, flags);
44 pci_read_config_word(dev, master_port, &master_data); 46 pci_read_config_word(dev, master_port, &master_data);
45 47
46 if (pio > 1) 48 if (pio > 1)
@@ -71,7 +73,7 @@ static void slc90e66_set_pio_mode(ide_drive_t *drive, const u8 pio)
71 pci_write_config_word(dev, master_port, master_data); 73 pci_write_config_word(dev, master_port, master_data);
72 if (is_slave) 74 if (is_slave)
73 pci_write_config_byte(dev, slave_port, slave_data); 75 pci_write_config_byte(dev, slave_port, slave_data);
74 spin_unlock_irqrestore(&ide_lock, flags); 76 spin_unlock_irqrestore(&slc90e66_lock, flags);
75} 77}
76 78
77static void slc90e66_set_dma_mode(ide_drive_t *drive, const u8 speed) 79static void slc90e66_set_dma_mode(ide_drive_t *drive, const u8 speed)
@@ -146,7 +148,7 @@ static void __devinit init_hwif_slc90e66 (ide_hwif_t *hwif)
146 hwif->cbl = (reg47 & mask) ? ATA_CBL_PATA40 : ATA_CBL_PATA80; 148 hwif->cbl = (reg47 & mask) ? ATA_CBL_PATA40 : ATA_CBL_PATA80;
147} 149}
148 150
149static ide_pci_device_t slc90e66_chipset __devinitdata = { 151static const struct ide_port_info slc90e66_chipset __devinitdata = {
150 .name = "SLC90E66", 152 .name = "SLC90E66",
151 .init_hwif = init_hwif_slc90e66, 153 .init_hwif = init_hwif_slc90e66,
152 .enablebits = {{0x41,0x80,0x80}, {0x43,0x80,0x80}}, 154 .enablebits = {{0x41,0x80,0x80}, {0x43,0x80,0x80}},
diff --git a/drivers/ide/pci/tc86c001.c b/drivers/ide/pci/tc86c001.c
index 631506e9b5d2..a66ebd14664e 100644
--- a/drivers/ide/pci/tc86c001.c
+++ b/drivers/ide/pci/tc86c001.c
@@ -218,7 +218,7 @@ static unsigned int __devinit init_chipset_tc86c001(struct pci_dev *dev,
218 return err; 218 return err;
219} 219}
220 220
221static ide_pci_device_t tc86c001_chipset __devinitdata = { 221static const struct ide_port_info tc86c001_chipset __devinitdata = {
222 .name = "TC86C001", 222 .name = "TC86C001",
223 .init_chipset = init_chipset_tc86c001, 223 .init_chipset = init_chipset_tc86c001,
224 .init_hwif = init_hwif_tc86c001, 224 .init_hwif = init_hwif_tc86c001,
diff --git a/drivers/ide/pci/triflex.c b/drivers/ide/pci/triflex.c
index 30b52f62699a..a227c41d23a3 100644
--- a/drivers/ide/pci/triflex.c
+++ b/drivers/ide/pci/triflex.c
@@ -102,7 +102,7 @@ static void __devinit init_hwif_triflex(ide_hwif_t *hwif)
102 hwif->set_dma_mode = &triflex_set_mode; 102 hwif->set_dma_mode = &triflex_set_mode;
103} 103}
104 104
105static ide_pci_device_t triflex_device __devinitdata = { 105static const struct ide_port_info triflex_device __devinitdata = {
106 .name = "TRIFLEX", 106 .name = "TRIFLEX",
107 .init_hwif = init_hwif_triflex, 107 .init_hwif = init_hwif_triflex,
108 .enablebits = {{0x80, 0x01, 0x01}, {0x80, 0x02, 0x02}}, 108 .enablebits = {{0x80, 0x01, 0x01}, {0x80, 0x02, 0x02}},
diff --git a/drivers/ide/pci/trm290.c b/drivers/ide/pci/trm290.c
index 140d486f6237..5011ba22e36c 100644
--- a/drivers/ide/pci/trm290.c
+++ b/drivers/ide/pci/trm290.c
@@ -250,7 +250,6 @@ static void __devinit init_hwif_trm290(ide_hwif_t *hwif)
250 u8 reg = 0; 250 u8 reg = 0;
251 struct pci_dev *dev = hwif->pci_dev; 251 struct pci_dev *dev = hwif->pci_dev;
252 252
253 hwif->chipset = ide_trm290;
254 cfgbase = pci_resource_start(dev, 4); 253 cfgbase = pci_resource_start(dev, 4);
255 if ((dev->class & 5) && cfgbase) { 254 if ((dev->class & 5) && cfgbase) {
256 hwif->config_data = cfgbase; 255 hwif->config_data = cfgbase;
@@ -320,9 +319,10 @@ static void __devinit init_hwif_trm290(ide_hwif_t *hwif)
320#endif 319#endif
321} 320}
322 321
323static ide_pci_device_t trm290_chipset __devinitdata = { 322static const struct ide_port_info trm290_chipset __devinitdata = {
324 .name = "TRM290", 323 .name = "TRM290",
325 .init_hwif = init_hwif_trm290, 324 .init_hwif = init_hwif_trm290,
325 .chipset = ide_trm290,
326 .host_flags = IDE_HFLAG_NO_ATAPI_DMA | 326 .host_flags = IDE_HFLAG_NO_ATAPI_DMA |
327#if 0 /* play it safe for now */ 327#if 0 /* play it safe for now */
328 IDE_HFLAG_TRUST_BIOS_FOR_DMA | 328 IDE_HFLAG_TRUST_BIOS_FOR_DMA |
diff --git a/drivers/ide/pci/via82cxxx.c b/drivers/ide/pci/via82cxxx.c
index c8022a92a0e3..a0d3c16b68ec 100644
--- a/drivers/ide/pci/via82cxxx.c
+++ b/drivers/ide/pci/via82cxxx.c
@@ -1,6 +1,6 @@
1/* 1/*
2 * 2 *
3 * Version 3.49 3 * Version 3.50
4 * 4 *
5 * VIA IDE driver for Linux. Supported southbridges: 5 * VIA IDE driver for Linux. Supported southbridges:
6 * 6 *
@@ -422,65 +422,40 @@ static u8 __devinit via82cxxx_cable_detect(ide_hwif_t *hwif)
422 422
423static void __devinit init_hwif_via82cxxx(ide_hwif_t *hwif) 423static void __devinit init_hwif_via82cxxx(ide_hwif_t *hwif)
424{ 424{
425 struct via82cxxx_dev *vdev = pci_get_drvdata(hwif->pci_dev);
426 int i;
427
428 hwif->set_pio_mode = &via_set_pio_mode; 425 hwif->set_pio_mode = &via_set_pio_mode;
429 hwif->set_dma_mode = &via_set_drive; 426 hwif->set_dma_mode = &via_set_drive;
430 427
431#ifdef CONFIG_PPC_CHRP
432 if(machine_is(chrp) && _chrp_type == _CHRP_Pegasos) {
433 hwif->irq = hwif->channel ? 15 : 14;
434 }
435#endif
436
437 for (i = 0; i < 2; i++) {
438 hwif->drives[i].io_32bit = 1;
439 hwif->drives[i].unmask = (vdev->via_config->flags & VIA_NO_UNMASK) ? 0 : 1;
440 }
441
442 if (!hwif->dma_base) 428 if (!hwif->dma_base)
443 return; 429 return;
444 430
445 hwif->ultra_mask = vdev->via_config->udma_mask;
446
447 if (hwif->cbl != ATA_CBL_PATA40_SHORT) 431 if (hwif->cbl != ATA_CBL_PATA40_SHORT)
448 hwif->cbl = via82cxxx_cable_detect(hwif); 432 hwif->cbl = via82cxxx_cable_detect(hwif);
449} 433}
450 434
451static ide_pci_device_t via82cxxx_chipsets[] __devinitdata = { 435static const struct ide_port_info via82cxxx_chipset __devinitdata = {
452 { /* 0 */ 436 .name = "VP_IDE",
453 .name = "VP_IDE", 437 .init_chipset = init_chipset_via82cxxx,
454 .init_chipset = init_chipset_via82cxxx, 438 .init_hwif = init_hwif_via82cxxx,
455 .init_hwif = init_hwif_via82cxxx, 439 .enablebits = { { 0x40, 0x02, 0x02 }, { 0x40, 0x01, 0x01 } },
456 .enablebits = {{0x40,0x02,0x02}, {0x40,0x01,0x01}}, 440 .host_flags = IDE_HFLAG_PIO_NO_BLACKLIST |
457 .host_flags = IDE_HFLAG_PIO_NO_BLACKLIST | 441 IDE_HFLAG_PIO_NO_DOWNGRADE |
458 IDE_HFLAG_PIO_NO_DOWNGRADE | 442 IDE_HFLAG_POST_SET_MODE |
459 IDE_HFLAG_POST_SET_MODE | 443 IDE_HFLAG_IO_32BIT |
460 IDE_HFLAG_NO_AUTODMA | 444 IDE_HFLAG_BOOTABLE,
461 IDE_HFLAG_BOOTABLE, 445 .pio_mask = ATA_PIO5,
462 .pio_mask = ATA_PIO5, 446 .swdma_mask = ATA_SWDMA2,
463 .swdma_mask = ATA_SWDMA2, 447 .mwdma_mask = ATA_MWDMA2,
464 .mwdma_mask = ATA_MWDMA2,
465 },{ /* 1 */
466 .name = "VP_IDE",
467 .init_chipset = init_chipset_via82cxxx,
468 .init_hwif = init_hwif_via82cxxx,
469 .enablebits = {{0x00,0x00,0x00}, {0x00,0x00,0x00}},
470 .host_flags = IDE_HFLAG_PIO_NO_BLACKLIST |
471 IDE_HFLAG_PIO_NO_DOWNGRADE |
472 IDE_HFLAG_POST_SET_MODE |
473 IDE_HFLAG_BOOTABLE,
474 .pio_mask = ATA_PIO5,
475 .swdma_mask = ATA_SWDMA2,
476 .mwdma_mask = ATA_MWDMA2,
477 }
478}; 448};
479 449
480static int __devinit via_init_one(struct pci_dev *dev, const struct pci_device_id *id) 450static int __devinit via_init_one(struct pci_dev *dev, const struct pci_device_id *id)
481{ 451{
482 struct pci_dev *isa = NULL; 452 struct pci_dev *isa = NULL;
483 struct via_isa_bridge *via_config; 453 struct via_isa_bridge *via_config;
454 u8 idx = id->driver_data;
455 struct ide_port_info d;
456
457 d = via82cxxx_chipset;
458
484 /* 459 /*
485 * Find the ISA bridge and check we know what it is. 460 * Find the ISA bridge and check we know what it is.
486 */ 461 */
@@ -490,7 +465,23 @@ static int __devinit via_init_one(struct pci_dev *dev, const struct pci_device_i
490 printk(KERN_WARNING "VP_IDE: Unknown VIA SouthBridge, disabling DMA.\n"); 465 printk(KERN_WARNING "VP_IDE: Unknown VIA SouthBridge, disabling DMA.\n");
491 return -ENODEV; 466 return -ENODEV;
492 } 467 }
493 return ide_setup_pci_device(dev, &via82cxxx_chipsets[id->driver_data]); 468
469 if (idx == 0)
470 d.host_flags |= IDE_HFLAG_NO_AUTODMA;
471 else
472 d.enablebits[1].reg = d.enablebits[0].reg = 0;
473
474 if ((via_config->flags & VIA_NO_UNMASK) == 0)
475 d.host_flags |= IDE_HFLAG_UNMASK_IRQS;
476
477#ifdef CONFIG_PPC_CHRP
478 if (machine_is(chrp) && _chrp_type == _CHRP_Pegasos)
479 d.host_flags |= IDE_HFLAG_FORCE_LEGACY_IRQS;
480#endif
481
482 d.udma_mask = via_config->udma_mask;
483
484 return ide_setup_pci_device(dev, &d);
494} 485}
495 486
496static const struct pci_device_id via_pci_tbl[] = { 487static const struct pci_device_id via_pci_tbl[] = {
diff --git a/drivers/ide/ppc/mpc8xx.c b/drivers/ide/ppc/mpc8xx.c
index df2e92034f5d..5f0da35ab5ad 100644
--- a/drivers/ide/ppc/mpc8xx.c
+++ b/drivers/ide/ppc/mpc8xx.c
@@ -316,8 +316,8 @@ m8xx_ide_init_hwif_ports(hw_regs_t *hw, unsigned long data_port,
316 316
317 ide_hwifs[data_port].pio_mask = ATA_PIO4; 317 ide_hwifs[data_port].pio_mask = ATA_PIO4;
318 ide_hwifs[data_port].set_pio_mode = m8xx_ide_set_pio_mode; 318 ide_hwifs[data_port].set_pio_mode = m8xx_ide_set_pio_mode;
319 ide_hwifs[data_port].ack_intr = (ide_ack_intr_t *)ide_interrupt_ack;
319 320
320 hw->ack_intr = (ide_ack_intr_t *) ide_interrupt_ack;
321 /* Enable Harddisk Interrupt, 321 /* Enable Harddisk Interrupt,
322 * and make it edge sensitive 322 * and make it edge sensitive
323 */ 323 */
@@ -402,8 +402,8 @@ void m8xx_ide_init_hwif_ports (hw_regs_t *hw,
402 402
403 ide_hwifs[data_port].pio_mask = ATA_PIO4; 403 ide_hwifs[data_port].pio_mask = ATA_PIO4;
404 ide_hwifs[data_port].set_pio_mode = m8xx_ide_set_pio_mode; 404 ide_hwifs[data_port].set_pio_mode = m8xx_ide_set_pio_mode;
405 ide_hwifs[data_port].ack_intr = (ide_ack_intr_t *)ide_interrupt_ack;
405 406
406 hw->ack_intr = (ide_ack_intr_t *) ide_interrupt_ack;
407 /* Enable Harddisk Interrupt, 407 /* Enable Harddisk Interrupt,
408 * and make it edge sensitive 408 * and make it edge sensitive
409 */ 409 */
diff --git a/drivers/ide/ppc/pmac.c b/drivers/ide/ppc/pmac.c
index c55479356768..816b5311dad6 100644
--- a/drivers/ide/ppc/pmac.c
+++ b/drivers/ide/ppc/pmac.c
@@ -1039,6 +1039,8 @@ pmac_ide_setup_device(pmac_ide_hwif_t *pmif, ide_hwif_t *hwif)
1039{ 1039{
1040 struct device_node *np = pmif->node; 1040 struct device_node *np = pmif->node;
1041 const int *bidp; 1041 const int *bidp;
1042 u8 idx[4] = { 0xff, 0xff, 0xff, 0xff };
1043 hw_regs_t hw;
1042 1044
1043 pmif->cable_80 = 0; 1045 pmif->cable_80 = 0;
1044 pmif->broken_dma = pmif->broken_dma_warn = 0; 1046 pmif->broken_dma = pmif->broken_dma_warn = 0;
@@ -1124,8 +1126,9 @@ pmac_ide_setup_device(pmac_ide_hwif_t *pmif, ide_hwif_t *hwif)
1124 /* Tell common code _not_ to mess with resources */ 1126 /* Tell common code _not_ to mess with resources */
1125 hwif->mmio = 1; 1127 hwif->mmio = 1;
1126 hwif->hwif_data = pmif; 1128 hwif->hwif_data = pmif;
1127 pmac_ide_init_hwif_ports(&hwif->hw, pmif->regbase, 0, &hwif->irq); 1129 memset(&hw, 0, sizeof(hw));
1128 memcpy(hwif->io_ports, hwif->hw.io_ports, sizeof(hwif->io_ports)); 1130 pmac_ide_init_hwif_ports(&hw, pmif->regbase, 0, &hwif->irq);
1131 memcpy(hwif->io_ports, hw.io_ports, sizeof(hwif->io_ports));
1129 hwif->chipset = ide_pmac; 1132 hwif->chipset = ide_pmac;
1130 hwif->noprobe = !hwif->io_ports[IDE_DATA_OFFSET] || pmif->mediabay; 1133 hwif->noprobe = !hwif->io_ports[IDE_DATA_OFFSET] || pmif->mediabay;
1131 hwif->hold = pmif->mediabay; 1134 hwif->hold = pmif->mediabay;
@@ -1163,10 +1166,9 @@ pmac_ide_setup_device(pmac_ide_hwif_t *pmif, ide_hwif_t *hwif)
1163 pmac_ide_setup_dma(pmif, hwif); 1166 pmac_ide_setup_dma(pmif, hwif);
1164#endif /* CONFIG_BLK_DEV_IDEDMA_PMAC */ 1167#endif /* CONFIG_BLK_DEV_IDEDMA_PMAC */
1165 1168
1166 /* We probe the hwif now */ 1169 idx[0] = hwif->index;
1167 probe_hwif_init(hwif);
1168 1170
1169 ide_proc_register_port(hwif); 1171 ide_device_add(idx);
1170 1172
1171 return 0; 1173 return 0;
1172} 1174}
diff --git a/drivers/ide/setup-pci.c b/drivers/ide/setup-pci.c
index fff567bcedbe..02d14bf85ab2 100644
--- a/drivers/ide/setup-pci.c
+++ b/drivers/ide/setup-pci.c
@@ -147,15 +147,15 @@ static int ide_setup_pci_baseregs (struct pci_dev *dev, const char *name)
147#ifdef CONFIG_BLK_DEV_IDEDMA_PCI 147#ifdef CONFIG_BLK_DEV_IDEDMA_PCI
148/** 148/**
149 * ide_get_or_set_dma_base - setup BMIBA 149 * ide_get_or_set_dma_base - setup BMIBA
150 * @d: IDE pci device data 150 * @d: IDE port info
151 * @hwif: Interface 151 * @hwif: IDE interface
152 * 152 *
153 * Fetch the DMA Bus-Master-I/O-Base-Address (BMIBA) from PCI space. 153 * Fetch the DMA Bus-Master-I/O-Base-Address (BMIBA) from PCI space.
154 * Where a device has a partner that is already in DMA mode we check 154 * Where a device has a partner that is already in DMA mode we check
155 * and enforce IDE simplex rules. 155 * and enforce IDE simplex rules.
156 */ 156 */
157 157
158static unsigned long ide_get_or_set_dma_base(ide_pci_device_t *d, ide_hwif_t *hwif) 158static unsigned long ide_get_or_set_dma_base(const struct ide_port_info *d, ide_hwif_t *hwif)
159{ 159{
160 unsigned long dma_base = 0; 160 unsigned long dma_base = 0;
161 struct pci_dev *dev = hwif->pci_dev; 161 struct pci_dev *dev = hwif->pci_dev;
@@ -225,10 +225,11 @@ static unsigned long ide_get_or_set_dma_base(ide_pci_device_t *d, ide_hwif_t *hw
225} 225}
226#endif /* CONFIG_BLK_DEV_IDEDMA_PCI */ 226#endif /* CONFIG_BLK_DEV_IDEDMA_PCI */
227 227
228void ide_setup_pci_noise (struct pci_dev *dev, ide_pci_device_t *d) 228void ide_setup_pci_noise(struct pci_dev *dev, const struct ide_port_info *d)
229{ 229{
230 printk(KERN_INFO "%s: IDE controller at PCI slot %s\n", 230 printk(KERN_INFO "%s: IDE controller (0x%04x:0x%04x rev 0x%02x) at "
231 d->name, pci_name(dev)); 231 " PCI slot %s\n", d->name, dev->vendor, dev->device,
232 dev->revision, pci_name(dev));
232} 233}
233 234
234EXPORT_SYMBOL_GPL(ide_setup_pci_noise); 235EXPORT_SYMBOL_GPL(ide_setup_pci_noise);
@@ -237,15 +238,15 @@ EXPORT_SYMBOL_GPL(ide_setup_pci_noise);
237/** 238/**
238 * ide_pci_enable - do PCI enables 239 * ide_pci_enable - do PCI enables
239 * @dev: PCI device 240 * @dev: PCI device
240 * @d: IDE pci device data 241 * @d: IDE port info
241 * 242 *
242 * Enable the IDE PCI device. We attempt to enable the device in full 243 * Enable the IDE PCI device. We attempt to enable the device in full
243 * but if that fails then we only need BAR4 so we will enable that. 244 * but if that fails then we only need BAR4 so we will enable that.
244 * 245 *
245 * Returns zero on success or an error code 246 * Returns zero on success or an error code
246 */ 247 */
247 248
248static int ide_pci_enable(struct pci_dev *dev, ide_pci_device_t *d) 249static int ide_pci_enable(struct pci_dev *dev, const struct ide_port_info *d)
249{ 250{
250 int ret; 251 int ret;
251 252
@@ -260,9 +261,9 @@ static int ide_pci_enable(struct pci_dev *dev, ide_pci_device_t *d)
260 } 261 }
261 262
262 /* 263 /*
263 * assume all devices can do 32-bit dma for now. we can add a 264 * assume all devices can do 32-bit DMA for now, we can add
264 * dma mask field to the ide_pci_device_t if we need it (or let 265 * a DMA mask field to the struct ide_port_info if we need it
265 * lower level driver set the dma mask) 266 * (or let lower level driver set the DMA mask)
266 */ 267 */
267 ret = pci_set_dma_mask(dev, DMA_32BIT_MASK); 268 ret = pci_set_dma_mask(dev, DMA_32BIT_MASK);
268 if (ret < 0) { 269 if (ret < 0) {
@@ -284,13 +285,13 @@ out:
284/** 285/**
285 * ide_pci_configure - configure an unconfigured device 286 * ide_pci_configure - configure an unconfigured device
286 * @dev: PCI device 287 * @dev: PCI device
287 * @d: IDE pci device data 288 * @d: IDE port info
288 * 289 *
289 * Enable and configure the PCI device we have been passed. 290 * Enable and configure the PCI device we have been passed.
290 * Returns zero on success or an error code. 291 * Returns zero on success or an error code.
291 */ 292 */
292 293
293static int ide_pci_configure(struct pci_dev *dev, ide_pci_device_t *d) 294static int ide_pci_configure(struct pci_dev *dev, const struct ide_port_info *d)
294{ 295{
295 u16 pcicmd = 0; 296 u16 pcicmd = 0;
296 /* 297 /*
@@ -318,15 +319,15 @@ static int ide_pci_configure(struct pci_dev *dev, ide_pci_device_t *d)
318 319
319/** 320/**
320 * ide_pci_check_iomem - check a register is I/O 321 * ide_pci_check_iomem - check a register is I/O
321 * @dev: pci device 322 * @dev: PCI device
322 * @d: ide_pci_device 323 * @d: IDE port info
323 * @bar: bar number 324 * @bar: BAR number
324 * 325 *
325 * Checks if a BAR is configured and points to MMIO space. If so 326 * Checks if a BAR is configured and points to MMIO space. If so
326 * print an error and return an error code. Otherwise return 0 327 * print an error and return an error code. Otherwise return 0
327 */ 328 */
328 329
329static int ide_pci_check_iomem(struct pci_dev *dev, ide_pci_device_t *d, int bar) 330static int ide_pci_check_iomem(struct pci_dev *dev, const struct ide_port_info *d, int bar)
330{ 331{
331 ulong flags = pci_resource_flags(dev, bar); 332 ulong flags = pci_resource_flags(dev, bar);
332 333
@@ -348,7 +349,7 @@ static int ide_pci_check_iomem(struct pci_dev *dev, ide_pci_device_t *d, int bar
348/** 349/**
349 * ide_hwif_configure - configure an IDE interface 350 * ide_hwif_configure - configure an IDE interface
350 * @dev: PCI device holding interface 351 * @dev: PCI device holding interface
351 * @d: IDE pci data 352 * @d: IDE port info
352 * @mate: Paired interface if any 353 * @mate: Paired interface if any
353 * 354 *
354 * Perform the initial set up for the hardware interface structure. This 355 * Perform the initial set up for the hardware interface structure. This
@@ -357,8 +358,8 @@ static int ide_pci_check_iomem(struct pci_dev *dev, ide_pci_device_t *d, int bar
357 * 358 *
358 * Returns the new hardware interface structure, or NULL on a failure 359 * Returns the new hardware interface structure, or NULL on a failure
359 */ 360 */
360 361
361static ide_hwif_t *ide_hwif_configure(struct pci_dev *dev, ide_pci_device_t *d, ide_hwif_t *mate, int port, int irq) 362static ide_hwif_t *ide_hwif_configure(struct pci_dev *dev, const struct ide_port_info *d, ide_hwif_t *mate, int port, int irq)
362{ 363{
363 unsigned long ctl = 0, base = 0; 364 unsigned long ctl = 0, base = 0;
364 ide_hwif_t *hwif; 365 ide_hwif_t *hwif;
@@ -387,19 +388,20 @@ static ide_hwif_t *ide_hwif_configure(struct pci_dev *dev, ide_pci_device_t *d,
387 return NULL; /* no room in ide_hwifs[] */ 388 return NULL; /* no room in ide_hwifs[] */
388 if (hwif->io_ports[IDE_DATA_OFFSET] != base || 389 if (hwif->io_ports[IDE_DATA_OFFSET] != base ||
389 hwif->io_ports[IDE_CONTROL_OFFSET] != (ctl | 2)) { 390 hwif->io_ports[IDE_CONTROL_OFFSET] != (ctl | 2)) {
390 memset(&hwif->hw, 0, sizeof(hwif->hw)); 391 hw_regs_t hw;
391#ifndef IDE_ARCH_OBSOLETE_INIT 392
392 ide_std_init_ports(&hwif->hw, base, (ctl | 2)); 393 memset(&hw, 0, sizeof(hw));
393 hwif->hw.io_ports[IDE_IRQ_OFFSET] = 0; 394#ifndef CONFIG_IDE_ARCH_OBSOLETE_INIT
395 ide_std_init_ports(&hw, base, ctl | 2);
394#else 396#else
395 ide_init_hwif_ports(&hwif->hw, base, (ctl | 2), NULL); 397 ide_init_hwif_ports(&hw, base, ctl | 2, NULL);
396#endif 398#endif
397 memcpy(hwif->io_ports, hwif->hw.io_ports, sizeof(hwif->io_ports)); 399 memcpy(hwif->io_ports, hw.io_ports, sizeof(hwif->io_ports));
398 hwif->noprobe = !hwif->io_ports[IDE_DATA_OFFSET]; 400 hwif->noprobe = !hwif->io_ports[IDE_DATA_OFFSET];
399 } 401 }
400 hwif->chipset = ide_pci; 402 hwif->chipset = d->chipset ? d->chipset : ide_pci;
401 hwif->pci_dev = dev; 403 hwif->pci_dev = dev;
402 hwif->cds = (struct ide_pci_device_s *) d; 404 hwif->cds = d;
403 hwif->channel = port; 405 hwif->channel = port;
404 406
405 if (!hwif->irq) 407 if (!hwif->irq)
@@ -414,21 +416,17 @@ static ide_hwif_t *ide_hwif_configure(struct pci_dev *dev, ide_pci_device_t *d,
414/** 416/**
415 * ide_hwif_setup_dma - configure DMA interface 417 * ide_hwif_setup_dma - configure DMA interface
416 * @dev: PCI device 418 * @dev: PCI device
417 * @d: IDE pci data 419 * @d: IDE port info
418 * @hwif: Hardware interface we are configuring 420 * @hwif: IDE interface
419 * 421 *
420 * Set up the DMA base for the interface. Enable the master bits as 422 * Set up the DMA base for the interface. Enable the master bits as
421 * necessary and attempt to bring the device DMA into a ready to use 423 * necessary and attempt to bring the device DMA into a ready to use
422 * state 424 * state
423 */ 425 */
424 426
425#ifndef CONFIG_BLK_DEV_IDEDMA_PCI 427static void ide_hwif_setup_dma(struct pci_dev *dev, const struct ide_port_info *d, ide_hwif_t *hwif)
426static void ide_hwif_setup_dma(struct pci_dev *dev, ide_pci_device_t *d, ide_hwif_t *hwif)
427{
428}
429#else
430static void ide_hwif_setup_dma(struct pci_dev *dev, ide_pci_device_t *d, ide_hwif_t *hwif)
431{ 428{
429#ifdef CONFIG_BLK_DEV_IDEDMA_PCI
432 u16 pcicmd; 430 u16 pcicmd;
433 431
434 pci_read_config_word(dev, PCI_COMMAND, &pcicmd); 432 pci_read_config_word(dev, PCI_COMMAND, &pcicmd);
@@ -460,13 +458,13 @@ static void ide_hwif_setup_dma(struct pci_dev *dev, ide_pci_device_t *d, ide_hwi
460 "(BIOS)\n", hwif->name, d->name); 458 "(BIOS)\n", hwif->name, d->name);
461 } 459 }
462 } 460 }
463}
464#endif /* CONFIG_BLK_DEV_IDEDMA_PCI*/ 461#endif /* CONFIG_BLK_DEV_IDEDMA_PCI*/
462}
465 463
466/** 464/**
467 * ide_setup_pci_controller - set up IDE PCI 465 * ide_setup_pci_controller - set up IDE PCI
468 * @dev: PCI device 466 * @dev: PCI device
469 * @d: IDE PCI data 467 * @d: IDE port info
470 * @noisy: verbose flag 468 * @noisy: verbose flag
471 * @config: returned as 1 if we configured the hardware 469 * @config: returned as 1 if we configured the hardware
472 * 470 *
@@ -474,8 +472,8 @@ static void ide_hwif_setup_dma(struct pci_dev *dev, ide_pci_device_t *d, ide_hwi
474 * up the PCI side of the device, checks that the device is enabled 472 * up the PCI side of the device, checks that the device is enabled
475 * and enables it if need be 473 * and enables it if need be
476 */ 474 */
477 475
478static int ide_setup_pci_controller(struct pci_dev *dev, ide_pci_device_t *d, int noisy, int *config) 476static int ide_setup_pci_controller(struct pci_dev *dev, const struct ide_port_info *d, int noisy, int *config)
479{ 477{
480 int ret; 478 int ret;
481 u16 pcicmd; 479 u16 pcicmd;
@@ -500,9 +498,6 @@ static int ide_setup_pci_controller(struct pci_dev *dev, ide_pci_device_t *d, in
500 printk(KERN_INFO "%s: device enabled (Linux)\n", d->name); 498 printk(KERN_INFO "%s: device enabled (Linux)\n", d->name);
501 } 499 }
502 500
503 if (noisy)
504 printk(KERN_INFO "%s: chipset revision %d\n",
505 d->name, dev->revision);
506out: 501out:
507 return ret; 502 return ret;
508} 503}
@@ -510,9 +505,9 @@ out:
510/** 505/**
511 * ide_pci_setup_ports - configure ports/devices on PCI IDE 506 * ide_pci_setup_ports - configure ports/devices on PCI IDE
512 * @dev: PCI device 507 * @dev: PCI device
513 * @d: IDE pci device info 508 * @d: IDE port info
514 * @pciirq: IRQ line 509 * @pciirq: IRQ line
515 * @index: ata index to update 510 * @idx: ATA index table to update
516 * 511 *
517 * Scan the interfaces attached to this device and do any 512 * Scan the interfaces attached to this device and do any
518 * necessary per port setup. Attach the devices and ask the 513 * necessary per port setup. Attach the devices and ask the
@@ -522,26 +517,25 @@ out:
522 * but is also used directly as a helper function by some controllers 517 * but is also used directly as a helper function by some controllers
523 * where the chipset setup is not the default PCI IDE one. 518 * where the chipset setup is not the default PCI IDE one.
524 */ 519 */
525 520
526void ide_pci_setup_ports(struct pci_dev *dev, ide_pci_device_t *d, int pciirq, ata_index_t *index) 521void ide_pci_setup_ports(struct pci_dev *dev, const struct ide_port_info *d, int pciirq, u8 *idx)
527{ 522{
528 int channels = (d->host_flags & IDE_HFLAG_SINGLE) ? 1 : 2, port; 523 int channels = (d->host_flags & IDE_HFLAG_SINGLE) ? 1 : 2, port;
529 int at_least_one_hwif_enabled = 0;
530 ide_hwif_t *hwif, *mate = NULL; 524 ide_hwif_t *hwif, *mate = NULL;
531 u8 tmp; 525 u8 tmp;
532 526
533 index->all = 0xf0f0;
534
535 /* 527 /*
536 * Set up the IDE ports 528 * Set up the IDE ports
537 */ 529 */
538 530
539 for (port = 0; port < channels; ++port) { 531 for (port = 0; port < channels; ++port) {
540 ide_pci_enablebit_t *e = &(d->enablebits[port]); 532 const ide_pci_enablebit_t *e = &(d->enablebits[port]);
541 533
542 if (e->reg && (pci_read_config_byte(dev, e->reg, &tmp) || 534 if (e->reg && (pci_read_config_byte(dev, e->reg, &tmp) ||
543 (tmp & e->mask) != e->val)) 535 (tmp & e->mask) != e->val)) {
536 printk(KERN_INFO "%s: IDE port disabled\n", d->name);
544 continue; /* port not enabled */ 537 continue; /* port not enabled */
538 }
545 539
546 if ((hwif = ide_hwif_configure(dev, d, mate, port, pciirq)) == NULL) 540 if ((hwif = ide_hwif_configure(dev, d, mate, port, pciirq)) == NULL)
547 continue; 541 continue;
@@ -549,11 +543,7 @@ void ide_pci_setup_ports(struct pci_dev *dev, ide_pci_device_t *d, int pciirq, a
549 /* setup proper ancestral information */ 543 /* setup proper ancestral information */
550 hwif->gendev.parent = &dev->dev; 544 hwif->gendev.parent = &dev->dev;
551 545
552 if (hwif->channel) { 546 *(idx + port) = hwif->index;
553 index->b.high = hwif->index;
554 } else {
555 index->b.low = hwif->index;
556 }
557 547
558 548
559 if (d->init_iops) 549 if (d->init_iops)
@@ -562,15 +552,28 @@ void ide_pci_setup_ports(struct pci_dev *dev, ide_pci_device_t *d, int pciirq, a
562 if ((d->host_flags & IDE_HFLAG_NO_DMA) == 0) 552 if ((d->host_flags & IDE_HFLAG_NO_DMA) == 0)
563 ide_hwif_setup_dma(dev, d, hwif); 553 ide_hwif_setup_dma(dev, d, hwif);
564 554
565 if ((d->host_flags & IDE_HFLAG_LEGACY_IRQS) && hwif->irq == 0) 555 if ((!hwif->irq && (d->host_flags & IDE_HFLAG_LEGACY_IRQS)) ||
556 (d->host_flags & IDE_HFLAG_FORCE_LEGACY_IRQS))
566 hwif->irq = port ? 15 : 14; 557 hwif->irq = port ? 15 : 14;
567 558
559 hwif->fixup = d->fixup;
560
568 hwif->host_flags = d->host_flags; 561 hwif->host_flags = d->host_flags;
569 hwif->pio_mask = d->pio_mask; 562 hwif->pio_mask = d->pio_mask;
570 563
571 if ((d->host_flags & IDE_HFLAG_SERIALIZE) && hwif->mate) 564 if ((d->host_flags & IDE_HFLAG_SERIALIZE) && hwif->mate)
572 hwif->mate->serialized = hwif->serialized = 1; 565 hwif->mate->serialized = hwif->serialized = 1;
573 566
567 if (d->host_flags & IDE_HFLAG_IO_32BIT) {
568 hwif->drives[0].io_32bit = 1;
569 hwif->drives[1].io_32bit = 1;
570 }
571
572 if (d->host_flags & IDE_HFLAG_UNMASK_IRQS) {
573 hwif->drives[0].unmask = 1;
574 hwif->drives[1].unmask = 1;
575 }
576
574 if (hwif->dma_base) { 577 if (hwif->dma_base) {
575 hwif->swdma_mask = d->swdma_mask; 578 hwif->swdma_mask = d->swdma_mask;
576 hwif->mwdma_mask = d->mwdma_mask; 579 hwif->mwdma_mask = d->mwdma_mask;
@@ -580,6 +583,9 @@ void ide_pci_setup_ports(struct pci_dev *dev, ide_pci_device_t *d, int pciirq, a
580 hwif->drives[0].autotune = 1; 583 hwif->drives[0].autotune = 1;
581 hwif->drives[1].autotune = 1; 584 hwif->drives[1].autotune = 1;
582 585
586 if (d->host_flags & IDE_HFLAG_RQSIZE_256)
587 hwif->rqsize = 256;
588
583 if (d->init_hwif) 589 if (d->init_hwif)
584 /* Call chipset-specific routine 590 /* Call chipset-specific routine
585 * for each enabled hwif 591 * for each enabled hwif
@@ -587,10 +593,7 @@ void ide_pci_setup_ports(struct pci_dev *dev, ide_pci_device_t *d, int pciirq, a
587 d->init_hwif(hwif); 593 d->init_hwif(hwif);
588 594
589 mate = hwif; 595 mate = hwif;
590 at_least_one_hwif_enabled = 1;
591 } 596 }
592 if (!at_least_one_hwif_enabled)
593 printk(KERN_INFO "%s: neither IDE port enabled (BIOS)\n", d->name);
594} 597}
595 598
596EXPORT_SYMBOL_GPL(ide_pci_setup_ports); 599EXPORT_SYMBOL_GPL(ide_pci_setup_ports);
@@ -602,13 +605,13 @@ EXPORT_SYMBOL_GPL(ide_pci_setup_ports);
602 * 605 *
603 * One thing that is not standardized is the location of the 606 * One thing that is not standardized is the location of the
604 * primary/secondary interface "enable/disable" bits. For chipsets that 607 * primary/secondary interface "enable/disable" bits. For chipsets that
605 * we "know" about, this information is in the ide_pci_device_t struct; 608 * we "know" about, this information is in the struct ide_port_info;
606 * for all other chipsets, we just assume both interfaces are enabled. 609 * for all other chipsets, we just assume both interfaces are enabled.
607 */ 610 */
608static int do_ide_setup_pci_device(struct pci_dev *dev, ide_pci_device_t *d, 611static int do_ide_setup_pci_device(struct pci_dev *dev,
609 ata_index_t *index, u8 noisy) 612 const struct ide_port_info *d,
613 u8 *idx, u8 noisy)
610{ 614{
611 static ata_index_t ata_index = { .b = { .low = 0xff, .high = 0xff } };
612 int tried_config = 0; 615 int tried_config = 0;
613 int pciirq, ret; 616 int pciirq, ret;
614 617
@@ -658,51 +661,35 @@ static int do_ide_setup_pci_device(struct pci_dev *dev, ide_pci_device_t *d,
658 661
659 /* FIXME: silent failure can happen */ 662 /* FIXME: silent failure can happen */
660 663
661 *index = ata_index; 664 ide_pci_setup_ports(dev, d, pciirq, idx);
662 ide_pci_setup_ports(dev, d, pciirq, index);
663out: 665out:
664 return ret; 666 return ret;
665} 667}
666 668
667int ide_setup_pci_device(struct pci_dev *dev, ide_pci_device_t *d) 669int ide_setup_pci_device(struct pci_dev *dev, const struct ide_port_info *d)
668{ 670{
669 ide_hwif_t *hwif = NULL, *mate = NULL; 671 u8 idx[4] = { 0xff, 0xff, 0xff, 0xff };
670 ata_index_t index_list;
671 int ret; 672 int ret;
672 673
673 ret = do_ide_setup_pci_device(dev, d, &index_list, 1); 674 ret = do_ide_setup_pci_device(dev, d, &idx[0], 1);
674 if (ret < 0)
675 goto out;
676 675
677 if ((index_list.b.low & 0xf0) != 0xf0) 676 if (ret >= 0)
678 hwif = &ide_hwifs[index_list.b.low]; 677 ide_device_add(idx);
679 if ((index_list.b.high & 0xf0) != 0xf0)
680 mate = &ide_hwifs[index_list.b.high];
681 678
682 if (hwif)
683 probe_hwif_init_with_fixup(hwif, d->fixup);
684 if (mate)
685 probe_hwif_init_with_fixup(mate, d->fixup);
686
687 if (hwif)
688 ide_proc_register_port(hwif);
689 if (mate)
690 ide_proc_register_port(mate);
691out:
692 return ret; 679 return ret;
693} 680}
694 681
695EXPORT_SYMBOL_GPL(ide_setup_pci_device); 682EXPORT_SYMBOL_GPL(ide_setup_pci_device);
696 683
697int ide_setup_pci_devices(struct pci_dev *dev1, struct pci_dev *dev2, 684int ide_setup_pci_devices(struct pci_dev *dev1, struct pci_dev *dev2,
698 ide_pci_device_t *d) 685 const struct ide_port_info *d)
699{ 686{
700 struct pci_dev *pdev[] = { dev1, dev2 }; 687 struct pci_dev *pdev[] = { dev1, dev2 };
701 ata_index_t index_list[2];
702 int ret, i; 688 int ret, i;
689 u8 idx[4] = { 0xff, 0xff, 0xff, 0xff };
703 690
704 for (i = 0; i < 2; i++) { 691 for (i = 0; i < 2; i++) {
705 ret = do_ide_setup_pci_device(pdev[i], d, index_list + i, !i); 692 ret = do_ide_setup_pci_device(pdev[i], d, &idx[i*2], !i);
706 /* 693 /*
707 * FIXME: Mom, mom, they stole me the helper function to undo 694 * FIXME: Mom, mom, they stole me the helper function to undo
708 * do_ide_setup_pci_device() on the first device! 695 * do_ide_setup_pci_device() on the first device!
@@ -711,25 +698,7 @@ int ide_setup_pci_devices(struct pci_dev *dev1, struct pci_dev *dev2,
711 goto out; 698 goto out;
712 } 699 }
713 700
714 for (i = 0; i < 2; i++) { 701 ide_device_add(idx);
715 u8 idx[2] = { index_list[i].b.low, index_list[i].b.high };
716 int j;
717
718 for (j = 0; j < 2; j++) {
719 if ((idx[j] & 0xf0) != 0xf0)
720 probe_hwif_init(ide_hwifs + idx[j]);
721 }
722 }
723
724 for (i = 0; i < 2; i++) {
725 u8 idx[2] = { index_list[i].b.low, index_list[i].b.high };
726 int j;
727
728 for (j = 0; j < 2; j++) {
729 if ((idx[j] & 0xf0) != 0xf0)
730 ide_proc_register_port(ide_hwifs + idx[j]);
731 }
732 }
733out: 702out:
734 return ret; 703 return ret;
735} 704}
@@ -754,9 +723,6 @@ static LIST_HEAD(ide_pci_drivers);
754 * hands the controllers off to the core PCI code to do the rest of 723 * hands the controllers off to the core PCI code to do the rest of
755 * the work. 724 * the work.
756 * 725 *
757 * The driver_data of the driver table must point to an ide_pci_device_t
758 * describing the interface.
759 *
760 * Returns are the same as for pci_register_driver 726 * Returns are the same as for pci_register_driver
761 */ 727 */
762 728
diff --git a/drivers/macintosh/mediabay.c b/drivers/macintosh/mediabay.c
index c803d2bba65d..48d647abea46 100644
--- a/drivers/macintosh/mediabay.c
+++ b/drivers/macintosh/mediabay.c
@@ -563,7 +563,7 @@ static void media_bay_step(int i)
563 ide_init_hwif_ports(&hw, (unsigned long) bay->cd_base, (unsigned long) 0, NULL); 563 ide_init_hwif_ports(&hw, (unsigned long) bay->cd_base, (unsigned long) 0, NULL);
564 hw.irq = bay->cd_irq; 564 hw.irq = bay->cd_irq;
565 hw.chipset = ide_pmac; 565 hw.chipset = ide_pmac;
566 bay->cd_index = ide_register_hw(&hw, 0, NULL); 566 bay->cd_index = ide_register_hw(&hw, NULL, 0, NULL);
567 pmu_resume(); 567 pmu_resume();
568 } 568 }
569 if (bay->cd_index == -1) { 569 if (bay->cd_index == -1) {
diff --git a/include/asm-alpha/ide.h b/include/asm-alpha/ide.h
index 2a5cc0b367ab..b7bf68d0407b 100644
--- a/include/asm-alpha/ide.h
+++ b/include/asm-alpha/ide.h
@@ -40,7 +40,6 @@ static inline unsigned long ide_default_io_base(int index)
40 } 40 }
41} 41}
42 42
43#define IDE_ARCH_OBSOLETE_INIT
44#define ide_default_io_ctl(base) ((base) + 0x206) /* obsolete */ 43#define ide_default_io_ctl(base) ((base) + 0x206) /* obsolete */
45 44
46#ifdef CONFIG_PCI 45#ifdef CONFIG_PCI
diff --git a/include/asm-arm/ide.h b/include/asm-arm/ide.h
index 4f68c8a5a199..f348fcf3150b 100644
--- a/include/asm-arm/ide.h
+++ b/include/asm-arm/ide.h
@@ -18,7 +18,6 @@
18#endif 18#endif
19 19
20#if !defined(CONFIG_ARCH_L7200) 20#if !defined(CONFIG_ARCH_L7200)
21# define IDE_ARCH_OBSOLETE_INIT
22# ifdef CONFIG_ARCH_CLPS7500 21# ifdef CONFIG_ARCH_CLPS7500
23# define ide_default_io_ctl(base) ((base) + 0x206) /* obsolete */ 22# define ide_default_io_ctl(base) ((base) + 0x206) /* obsolete */
24# else 23# else
diff --git a/include/asm-blackfin/ide.h b/include/asm-blackfin/ide.h
index 41b2db46a168..121e272581d6 100644
--- a/include/asm-blackfin/ide.h
+++ b/include/asm-blackfin/ide.h
@@ -20,7 +20,6 @@
20#define MAX_HWIFS 1 20#define MAX_HWIFS 1
21 21
22/* Legacy ... BLK_DEV_IDECS */ 22/* Legacy ... BLK_DEV_IDECS */
23#define IDE_ARCH_OBSOLETE_INIT
24#define ide_default_io_ctl(base) ((base) + 0x206) /* obsolete */ 23#define ide_default_io_ctl(base) ((base) + 0x206) /* obsolete */
25 24
26 25
diff --git a/include/asm-cris/arch-v32/ide.h b/include/asm-cris/arch-v32/ide.h
index 6590f657500d..11296170d057 100644
--- a/include/asm-cris/arch-v32/ide.h
+++ b/include/asm-cris/arch-v32/ide.h
@@ -54,7 +54,7 @@ static inline unsigned long ide_default_io_base(int index)
54#define SUPPORT_VLB_SYNC 0 54#define SUPPORT_VLB_SYNC 0
55 55
56#define IDE_ARCH_ACK_INTR 56#define IDE_ARCH_ACK_INTR
57#define ide_ack_intr(hwif) (hwif)->hw.ack_intr(hwif) 57#define ide_ack_intr(hwif) ((hwif)->ack_intr(hwif))
58 58
59#endif /* __KERNEL__ */ 59#endif /* __KERNEL__ */
60 60
diff --git a/include/asm-ia64/ide.h b/include/asm-ia64/ide.h
index e928675de352..1ccf23809329 100644
--- a/include/asm-ia64/ide.h
+++ b/include/asm-ia64/ide.h
@@ -46,7 +46,6 @@ static inline unsigned long ide_default_io_base(int index)
46 } 46 }
47} 47}
48 48
49#define IDE_ARCH_OBSOLETE_INIT
50#define ide_default_io_ctl(base) ((base) + 0x206) /* obsolete */ 49#define ide_default_io_ctl(base) ((base) + 0x206) /* obsolete */
51 50
52#ifdef CONFIG_PCI 51#ifdef CONFIG_PCI
diff --git a/include/asm-m32r/ide.h b/include/asm-m32r/ide.h
index 4672a49e8760..5d2044e529ab 100644
--- a/include/asm-m32r/ide.h
+++ b/include/asm-m32r/ide.h
@@ -65,7 +65,6 @@ static __inline__ unsigned long ide_default_io_base(int index)
65 } 65 }
66} 66}
67 67
68#define IDE_ARCH_OBSOLETE_INIT
69#define ide_default_io_ctl(base) ((base) + 0x206) /* obsolete */ 68#define ide_default_io_ctl(base) ((base) + 0x206) /* obsolete */
70 69
71#ifdef CONFIG_BLK_DEV_IDEPCI 70#ifdef CONFIG_BLK_DEV_IDEPCI
diff --git a/include/asm-m68k/ide.h b/include/asm-m68k/ide.h
index f9ffb2cbbae8..909c6dfd3851 100644
--- a/include/asm-m68k/ide.h
+++ b/include/asm-m68k/ide.h
@@ -137,7 +137,7 @@ ide_get_lock(irq_handler_t handler, void *data)
137#endif /* CONFIG_BLK_DEV_FALCON_IDE */ 137#endif /* CONFIG_BLK_DEV_FALCON_IDE */
138 138
139#define IDE_ARCH_ACK_INTR 139#define IDE_ARCH_ACK_INTR
140#define ide_ack_intr(hwif) ((hwif)->hw.ack_intr ? (hwif)->hw.ack_intr(hwif) : 1) 140#define ide_ack_intr(hwif) ((hwif)->ack_intr ? (hwif)->ack_intr(hwif) : 1)
141 141
142#endif /* __KERNEL__ */ 142#endif /* __KERNEL__ */
143#endif /* _M68K_IDE_H */ 143#endif /* _M68K_IDE_H */
diff --git a/include/asm-mips/mach-generic/ide.h b/include/asm-mips/mach-generic/ide.h
index a77128362a7d..4ec2b930dfbb 100644
--- a/include/asm-mips/mach-generic/ide.h
+++ b/include/asm-mips/mach-generic/ide.h
@@ -98,7 +98,6 @@ static __inline__ unsigned long ide_default_io_base(int index)
98 } 98 }
99} 99}
100 100
101#define IDE_ARCH_OBSOLETE_INIT
102#define ide_default_io_ctl(base) ((base) + 0x206) /* obsolete */ 101#define ide_default_io_ctl(base) ((base) + 0x206) /* obsolete */
103 102
104#ifdef CONFIG_BLK_DEV_IDEPCI 103#ifdef CONFIG_BLK_DEV_IDEPCI
diff --git a/include/asm-parisc/ide.h b/include/asm-parisc/ide.h
index b27bf7aeb256..be8760fbc8ee 100644
--- a/include/asm-parisc/ide.h
+++ b/include/asm-parisc/ide.h
@@ -17,7 +17,6 @@
17#define MAX_HWIFS 2 17#define MAX_HWIFS 2
18#endif 18#endif
19 19
20#define IDE_ARCH_OBSOLETE_INIT
21#define ide_default_io_ctl(base) ((base) + 0x206) /* obsolete */ 20#define ide_default_io_ctl(base) ((base) + 0x206) /* obsolete */
22 21
23#define ide_request_irq(irq,hand,flg,dev,id) request_irq((irq),(hand),(flg),(dev),(id)) 22#define ide_request_irq(irq,hand,flg,dev,id) request_irq((irq),(hand),(flg),(dev),(id))
diff --git a/include/asm-powerpc/ide.h b/include/asm-powerpc/ide.h
index 1644e44c8757..fd7f5a430f0a 100644
--- a/include/asm-powerpc/ide.h
+++ b/include/asm-powerpc/ide.h
@@ -69,12 +69,11 @@ static __inline__ unsigned long ide_default_io_base(int index)
69 69
70#ifdef CONFIG_BLK_DEV_MPC8xx_IDE 70#ifdef CONFIG_BLK_DEV_MPC8xx_IDE
71#define IDE_ARCH_ACK_INTR 1 71#define IDE_ARCH_ACK_INTR 1
72#define ide_ack_intr(hwif) (hwif->hw.ack_intr ? hwif->hw.ack_intr(hwif) : 1) 72#define ide_ack_intr(hwif) ((hwif)->ack_intr ? (hwif)->ack_intr(hwif) : 1)
73#endif 73#endif
74 74
75#endif /* __powerpc64__ */ 75#endif /* __powerpc64__ */
76 76
77#define IDE_ARCH_OBSOLETE_INIT
78#define ide_default_io_ctl(base) ((base) + 0x206) /* obsolete */ 77#define ide_default_io_ctl(base) ((base) + 0x206) /* obsolete */
79 78
80#endif /* __KERNEL__ */ 79#endif /* __KERNEL__ */
diff --git a/include/asm-sh64/ide.h b/include/asm-sh64/ide.h
index c9d84d5f772e..b6e31e8b9410 100644
--- a/include/asm-sh64/ide.h
+++ b/include/asm-sh64/ide.h
@@ -19,7 +19,6 @@
19/* Without this, the initialisation of PCI IDE cards end up calling 19/* Without this, the initialisation of PCI IDE cards end up calling
20 * ide_init_hwif_ports, which won't work. */ 20 * ide_init_hwif_ports, which won't work. */
21#ifdef CONFIG_BLK_DEV_IDEPCI 21#ifdef CONFIG_BLK_DEV_IDEPCI
22#define IDE_ARCH_OBSOLETE_INIT 1
23#define ide_default_io_ctl(base) (0) 22#define ide_default_io_ctl(base) (0)
24#endif 23#endif
25 24
diff --git a/include/asm-sparc/ide.h b/include/asm-sparc/ide.h
index a6d735a1310e..404022765fc7 100644
--- a/include/asm-sparc/ide.h
+++ b/include/asm-sparc/ide.h
@@ -18,7 +18,6 @@
18#undef MAX_HWIFS 18#undef MAX_HWIFS
19#define MAX_HWIFS 2 19#define MAX_HWIFS 2
20 20
21#define IDE_ARCH_OBSOLETE_INIT
22#define ide_default_io_ctl(base) ((base) + 0x206) /* obsolete */ 21#define ide_default_io_ctl(base) ((base) + 0x206) /* obsolete */
23 22
24#define __ide_insl(data_reg, buffer, wcount) \ 23#define __ide_insl(data_reg, buffer, wcount) \
diff --git a/include/asm-sparc64/ide.h b/include/asm-sparc64/ide.h
index 55149cf933c2..ac7eb210b941 100644
--- a/include/asm-sparc64/ide.h
+++ b/include/asm-sparc64/ide.h
@@ -24,7 +24,6 @@
24# endif 24# endif
25#endif 25#endif
26 26
27#define IDE_ARCH_OBSOLETE_INIT
28#define ide_default_io_ctl(base) ((base) + 0x206) /* obsolete */ 27#define ide_default_io_ctl(base) ((base) + 0x206) /* obsolete */
29 28
30#define __ide_insl(data_reg, buffer, wcount) \ 29#define __ide_insl(data_reg, buffer, wcount) \
diff --git a/include/asm-x86/ide.h b/include/asm-x86/ide.h
index e7817a3d6578..42130adf9c7c 100644
--- a/include/asm-x86/ide.h
+++ b/include/asm-x86/ide.h
@@ -62,7 +62,6 @@ static __inline__ unsigned long ide_default_io_base(int index)
62 } 62 }
63} 63}
64 64
65#define IDE_ARCH_OBSOLETE_INIT
66#define ide_default_io_ctl(base) ((base) + 0x206) /* obsolete */ 65#define ide_default_io_ctl(base) ((base) + 0x206) /* obsolete */
67 66
68#ifdef CONFIG_BLK_DEV_IDEPCI 67#ifdef CONFIG_BLK_DEV_IDEPCI
diff --git a/include/linux/ide.h b/include/linux/ide.h
index 19db0a4ae447..2e4b8dd03cfe 100644
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -192,22 +192,20 @@ typedef unsigned char byte; /* used everywhere */
192struct hwif_s; 192struct hwif_s;
193typedef int (ide_ack_intr_t)(struct hwif_s *); 193typedef int (ide_ack_intr_t)(struct hwif_s *);
194 194
195#ifndef NO_DMA
196#define NO_DMA 255
197#endif
198
199/* 195/*
200 * hwif_chipset_t is used to keep track of the specific hardware 196 * hwif_chipset_t is used to keep track of the specific hardware
201 * chipset used by each IDE interface, if known. 197 * chipset used by each IDE interface, if known.
202 */ 198 */
203typedef enum { ide_unknown, ide_generic, ide_pci, 199enum { ide_unknown, ide_generic, ide_pci,
204 ide_cmd640, ide_dtc2278, ide_ali14xx, 200 ide_cmd640, ide_dtc2278, ide_ali14xx,
205 ide_qd65xx, ide_umc8672, ide_ht6560b, 201 ide_qd65xx, ide_umc8672, ide_ht6560b,
206 ide_rz1000, ide_trm290, 202 ide_rz1000, ide_trm290,
207 ide_cmd646, ide_cy82c693, ide_4drives, 203 ide_cmd646, ide_cy82c693, ide_4drives,
208 ide_pmac, ide_etrax100, ide_acorn, 204 ide_pmac, ide_etrax100, ide_acorn,
209 ide_au1xxx, ide_forced 205 ide_au1xxx, ide_forced
210} hwif_chipset_t; 206};
207
208typedef u8 hwif_chipset_t;
211 209
212/* 210/*
213 * Structure to hold all information about the location of this port 211 * Structure to hold all information about the location of this port
@@ -215,22 +213,16 @@ typedef enum { ide_unknown, ide_generic, ide_pci,
215typedef struct hw_regs_s { 213typedef struct hw_regs_s {
216 unsigned long io_ports[IDE_NR_PORTS]; /* task file registers */ 214 unsigned long io_ports[IDE_NR_PORTS]; /* task file registers */
217 int irq; /* our irq number */ 215 int irq; /* our irq number */
218 int dma; /* our dma entry */
219 ide_ack_intr_t *ack_intr; /* acknowledge interrupt */ 216 ide_ack_intr_t *ack_intr; /* acknowledge interrupt */
220 hwif_chipset_t chipset; 217 hwif_chipset_t chipset;
221 struct device *dev; 218 struct device *dev;
222} hw_regs_t; 219} hw_regs_t;
223 220
224/* 221struct hwif_s * ide_find_port(unsigned long);
225 * Register new hardware with ide 222
226 */ 223int ide_register_hw(hw_regs_t *, void (*)(struct hwif_s *), int,
227int ide_register_hw(hw_regs_t *, int, struct hwif_s **); 224 struct hwif_s **);
228int ide_register_hw_with_fixup(hw_regs_t *, int, struct hwif_s **,
229 void (*)(struct hwif_s *));
230 225
231/*
232 * Set up hw_regs_t structure before calling ide_register_hw (optional)
233 */
234void ide_setup_ports( hw_regs_t *hw, 226void ide_setup_ports( hw_regs_t *hw,
235 unsigned long base, 227 unsigned long base,
236 int *offsets, 228 int *offsets,
@@ -268,11 +260,7 @@ static inline void ide_std_init_ports(hw_regs_t *hw,
268# define ide_init_default_irq(base) (0) 260# define ide_init_default_irq(base) (0)
269#endif 261#endif
270 262
271/* 263#ifdef CONFIG_IDE_ARCH_OBSOLETE_INIT
272 * ide_init_hwif_ports() is OBSOLETE and will be removed in 2.7 series.
273 * New ports shouldn't define IDE_ARCH_OBSOLETE_INIT in <asm/ide.h>.
274 */
275#ifdef IDE_ARCH_OBSOLETE_INIT
276static inline void ide_init_hwif_ports(hw_regs_t *hw, 264static inline void ide_init_hwif_ports(hw_regs_t *hw,
277 unsigned long io_addr, 265 unsigned long io_addr,
278 unsigned long ctl_addr, 266 unsigned long ctl_addr,
@@ -302,7 +290,7 @@ static inline void ide_init_hwif_ports(hw_regs_t *hw,
302 if (io_addr || ctl_addr) 290 if (io_addr || ctl_addr)
303 printk(KERN_WARNING "%s: must not be called\n", __FUNCTION__); 291 printk(KERN_WARNING "%s: must not be called\n", __FUNCTION__);
304} 292}
305#endif /* IDE_ARCH_OBSOLETE_INIT */ 293#endif /* CONFIG_IDE_ARCH_OBSOLETE_INIT */
306 294
307/* Currently only m68k, apus and m8xx need it */ 295/* Currently only m68k, apus and m8xx need it */
308#ifndef IDE_ARCH_ACK_INTR 296#ifndef IDE_ARCH_ACK_INTR
@@ -363,7 +351,6 @@ typedef union {
363 * ATA DATA Register Special. 351 * ATA DATA Register Special.
364 * ATA NSECTOR Count Register(). 352 * ATA NSECTOR Count Register().
365 * ATAPI Byte Count Register. 353 * ATAPI Byte Count Register.
366 * Channel index ordering pairs.
367 */ 354 */
368typedef union { 355typedef union {
369 unsigned all :16; 356 unsigned all :16;
@@ -378,7 +365,7 @@ typedef union {
378#error "Please fix <asm/byteorder.h>" 365#error "Please fix <asm/byteorder.h>"
379#endif 366#endif
380 } b; 367 } b;
381} ata_nsector_t, ata_data_t, atapi_bcount_t, ata_index_t; 368} ata_nsector_t, ata_data_t, atapi_bcount_t;
382 369
383/* 370/*
384 * ATA-IDE Select Register, aka Device-Head 371 * ATA-IDE Select Register, aka Device-Head
@@ -657,7 +644,7 @@ typedef struct ide_drive_s {
657 ((1<<ide_pci)|(1<<ide_cmd646)|(1<<ide_ali14xx)) 644 ((1<<ide_pci)|(1<<ide_cmd646)|(1<<ide_ali14xx))
658#define IDE_CHIPSET_IS_PCI(c) ((IDE_CHIPSET_PCI_MASK >> (c)) & 1) 645#define IDE_CHIPSET_IS_PCI(c) ((IDE_CHIPSET_PCI_MASK >> (c)) & 1)
659 646
660struct ide_pci_device_s; 647struct ide_port_info;
661 648
662typedef struct hwif_s { 649typedef struct hwif_s {
663 struct hwif_s *next; /* for linked-list in ide_hwgroup_t */ 650 struct hwif_s *next; /* for linked-list in ide_hwgroup_t */
@@ -672,7 +659,6 @@ typedef struct hwif_s {
672 unsigned long sata_scr[SATA_NR_PORTS]; 659 unsigned long sata_scr[SATA_NR_PORTS];
673 unsigned long sata_misc[SATA_NR_PORTS]; 660 unsigned long sata_misc[SATA_NR_PORTS];
674 661
675 hw_regs_t hw; /* Hardware info */
676 ide_drive_t drives[MAX_DRIVES]; /* drive info */ 662 ide_drive_t drives[MAX_DRIVES]; /* drive info */
677 663
678 u8 major; /* our major number */ 664 u8 major; /* our major number */
@@ -694,7 +680,9 @@ typedef struct hwif_s {
694 hwif_chipset_t chipset; /* sub-module for tuning.. */ 680 hwif_chipset_t chipset; /* sub-module for tuning.. */
695 681
696 struct pci_dev *pci_dev; /* for pci chipsets */ 682 struct pci_dev *pci_dev; /* for pci chipsets */
697 struct ide_pci_device_s *cds; /* chipset device struct */ 683 const struct ide_port_info *cds; /* chipset device struct */
684
685 ide_ack_intr_t *ack_intr;
698 686
699 void (*rw_disk)(ide_drive_t *, struct request *); 687 void (*rw_disk)(ide_drive_t *, struct request *);
700 688
@@ -725,6 +713,8 @@ typedef struct hwif_s {
725 u8 (*mdma_filter)(ide_drive_t *); 713 u8 (*mdma_filter)(ide_drive_t *);
726 u8 (*udma_filter)(ide_drive_t *); 714 u8 (*udma_filter)(ide_drive_t *);
727 715
716 void (*fixup)(struct hwif_s *);
717
728 void (*ata_input_data)(ide_drive_t *, void *, u32); 718 void (*ata_input_data)(ide_drive_t *, void *, u32);
729 void (*ata_output_data)(ide_drive_t *, void *, u32); 719 void (*ata_output_data)(ide_drive_t *, void *, u32);
730 720
@@ -841,8 +831,6 @@ typedef struct hwgroup_s {
841 831
842 /* for pci chipsets */ 832 /* for pci chipsets */
843 struct pci_dev *pci_dev; 833 struct pci_dev *pci_dev;
844 /* chipset device struct */
845 struct ide_pci_device_s *cds;
846 834
847 /* current request */ 835 /* current request */
848 struct request *rq; 836 struct request *rq;
@@ -1030,36 +1018,16 @@ extern int ide_end_request (ide_drive_t *drive, int uptodate, int nrsecs);
1030int ide_end_dequeued_request(ide_drive_t *drive, struct request *rq, 1018int ide_end_dequeued_request(ide_drive_t *drive, struct request *rq,
1031 int uptodate, int nr_sectors); 1019 int uptodate, int nr_sectors);
1032 1020
1033/*
1034 * This is used on exit from the driver to designate the next irq handler
1035 * and also to start the safety timer.
1036 */
1037extern void ide_set_handler (ide_drive_t *drive, ide_handler_t *handler, unsigned int timeout, ide_expiry_t *expiry); 1021extern void ide_set_handler (ide_drive_t *drive, ide_handler_t *handler, unsigned int timeout, ide_expiry_t *expiry);
1038 1022
1039/*
1040 * This is used on exit from the driver to designate the next irq handler
1041 * and start the safety time safely and atomically from the IRQ handler
1042 * with respect to the command issue (which it also does)
1043 */
1044extern void ide_execute_command(ide_drive_t *, task_ioreg_t cmd, ide_handler_t *, unsigned int, ide_expiry_t *); 1023extern void ide_execute_command(ide_drive_t *, task_ioreg_t cmd, ide_handler_t *, unsigned int, ide_expiry_t *);
1045 1024
1046ide_startstop_t __ide_error(ide_drive_t *, struct request *, u8, u8); 1025ide_startstop_t __ide_error(ide_drive_t *, struct request *, u8, u8);
1047 1026
1048/*
1049 * ide_error() takes action based on the error returned by the controller.
1050 * The caller should return immediately after invoking this.
1051 *
1052 * (drive, msg, status)
1053 */
1054ide_startstop_t ide_error (ide_drive_t *drive, const char *msg, byte stat); 1027ide_startstop_t ide_error (ide_drive_t *drive, const char *msg, byte stat);
1055 1028
1056ide_startstop_t __ide_abort(ide_drive_t *, struct request *); 1029ide_startstop_t __ide_abort(ide_drive_t *, struct request *);
1057 1030
1058/*
1059 * Abort a running command on the controller triggering the abort
1060 * from a host side, non error situation
1061 * (drive, msg)
1062 */
1063extern ide_startstop_t ide_abort(ide_drive_t *, const char *); 1031extern ide_startstop_t ide_abort(ide_drive_t *, const char *);
1064 1032
1065extern void ide_fix_driveid(struct hd_driveid *); 1033extern void ide_fix_driveid(struct hd_driveid *);
@@ -1075,15 +1043,8 @@ extern void ide_fixstring(u8 *, const int, const int);
1075 1043
1076int ide_wait_stat(ide_startstop_t *, ide_drive_t *, u8, u8, unsigned long); 1044int ide_wait_stat(ide_startstop_t *, ide_drive_t *, u8, u8, unsigned long);
1077 1045
1078/*
1079 * Start a reset operation for an IDE interface.
1080 * The caller should return immediately after invoking this.
1081 */
1082extern ide_startstop_t ide_do_reset (ide_drive_t *); 1046extern ide_startstop_t ide_do_reset (ide_drive_t *);
1083 1047
1084/*
1085 * This function is intended to be used prior to invoking ide_do_drive_cmd().
1086 */
1087extern void ide_init_drive_cmd (struct request *rq); 1048extern void ide_init_drive_cmd (struct request *rq);
1088 1049
1089/* 1050/*
@@ -1098,13 +1059,6 @@ typedef enum {
1098 1059
1099extern int ide_do_drive_cmd(ide_drive_t *, struct request *, ide_action_t); 1060extern int ide_do_drive_cmd(ide_drive_t *, struct request *, ide_action_t);
1100 1061
1101/*
1102 * Clean up after success/failure of an explicit drive cmd.
1103 * stat/err are used only when (HWGROUP(drive)->rq->cmd == IDE_DRIVE_CMD).
1104 * stat/err are used only when (HWGROUP(drive)->rq->cmd == IDE_DRIVE_TASK_MASK).
1105 *
1106 * (ide_drive_t *drive, u8 stat, u8 err)
1107 */
1108extern void ide_end_drive_cmd(ide_drive_t *, u8, u8); 1062extern void ide_end_drive_cmd(ide_drive_t *, u8, u8);
1109 1063
1110/* 1064/*
@@ -1177,10 +1131,6 @@ extern int taskfile_lib_get_identify(ide_drive_t *drive, u8 *);
1177 1131
1178extern int ide_wait_not_busy(ide_hwif_t *hwif, unsigned long timeout); 1132extern int ide_wait_not_busy(ide_hwif_t *hwif, unsigned long timeout);
1179 1133
1180/*
1181 * ide_stall_queue() can be used by a drive to give excess bandwidth back
1182 * to the hwgroup by sleeping for timeout jiffies.
1183 */
1184extern void ide_stall_queue(ide_drive_t *drive, unsigned long timeout); 1134extern void ide_stall_queue(ide_drive_t *drive, unsigned long timeout);
1185 1135
1186extern int ide_spin_wait_hwgroup(ide_drive_t *); 1136extern int ide_spin_wait_hwgroup(ide_drive_t *);
@@ -1200,8 +1150,8 @@ extern int __ide_pci_register_driver(struct pci_driver *driver, struct module *o
1200#define ide_pci_register_driver(d) pci_register_driver(d) 1150#define ide_pci_register_driver(d) pci_register_driver(d)
1201#endif 1151#endif
1202 1152
1203void ide_pci_setup_ports(struct pci_dev *, struct ide_pci_device_s *, int, ata_index_t *); 1153void ide_pci_setup_ports(struct pci_dev *, const struct ide_port_info *, int, u8 *);
1204extern void ide_setup_pci_noise (struct pci_dev *dev, struct ide_pci_device_s *d); 1154void ide_setup_pci_noise(struct pci_dev *, const struct ide_port_info *);
1205 1155
1206extern void default_hwif_iops(ide_hwif_t *); 1156extern void default_hwif_iops(ide_hwif_t *);
1207extern void default_hwif_mmiops(ide_hwif_t *); 1157extern void default_hwif_mmiops(ide_hwif_t *);
@@ -1261,6 +1211,14 @@ enum {
1261 IDE_HFLAG_SERIALIZE = (1 << 20), 1211 IDE_HFLAG_SERIALIZE = (1 << 20),
1262 /* use legacy IRQs */ 1212 /* use legacy IRQs */
1263 IDE_HFLAG_LEGACY_IRQS = (1 << 21), 1213 IDE_HFLAG_LEGACY_IRQS = (1 << 21),
1214 /* force use of legacy IRQs */
1215 IDE_HFLAG_FORCE_LEGACY_IRQS = (1 << 22),
1216 /* limit LBA48 requests to 256 sectors */
1217 IDE_HFLAG_RQSIZE_256 = (1 << 23),
1218 /* use 32-bit I/O ops */
1219 IDE_HFLAG_IO_32BIT = (1 << 24),
1220 /* unmask IRQs */
1221 IDE_HFLAG_UNMASK_IRQS = (1 << 25),
1264}; 1222};
1265 1223
1266#ifdef CONFIG_BLK_DEV_OFFBOARD 1224#ifdef CONFIG_BLK_DEV_OFFBOARD
@@ -1269,7 +1227,7 @@ enum {
1269# define IDE_HFLAG_OFF_BOARD 0 1227# define IDE_HFLAG_OFF_BOARD 0
1270#endif 1228#endif
1271 1229
1272typedef struct ide_pci_device_s { 1230struct ide_port_info {
1273 char *name; 1231 char *name;
1274 unsigned int (*init_chipset)(struct pci_dev *, const char *); 1232 unsigned int (*init_chipset)(struct pci_dev *, const char *);
1275 void (*init_iops)(ide_hwif_t *); 1233 void (*init_iops)(ide_hwif_t *);
@@ -1277,17 +1235,17 @@ typedef struct ide_pci_device_s {
1277 void (*init_dma)(ide_hwif_t *, unsigned long); 1235 void (*init_dma)(ide_hwif_t *, unsigned long);
1278 void (*fixup)(ide_hwif_t *); 1236 void (*fixup)(ide_hwif_t *);
1279 ide_pci_enablebit_t enablebits[2]; 1237 ide_pci_enablebit_t enablebits[2];
1238 hwif_chipset_t chipset;
1280 unsigned int extra; 1239 unsigned int extra;
1281 struct ide_pci_device_s *next;
1282 u32 host_flags; 1240 u32 host_flags;
1283 u8 pio_mask; 1241 u8 pio_mask;
1284 u8 swdma_mask; 1242 u8 swdma_mask;
1285 u8 mwdma_mask; 1243 u8 mwdma_mask;
1286 u8 udma_mask; 1244 u8 udma_mask;
1287} ide_pci_device_t; 1245};
1288 1246
1289extern int ide_setup_pci_device(struct pci_dev *, ide_pci_device_t *); 1247int ide_setup_pci_device(struct pci_dev *, const struct ide_port_info *);
1290extern int ide_setup_pci_devices(struct pci_dev *, struct pci_dev *, ide_pci_device_t *); 1248int ide_setup_pci_devices(struct pci_dev *, struct pci_dev *, const struct ide_port_info *);
1291 1249
1292void ide_map_sg(ide_drive_t *, struct request *); 1250void ide_map_sg(ide_drive_t *, struct request *);
1293void ide_init_sg_cmd(ide_drive_t *, struct request *); 1251void ide_init_sg_cmd(ide_drive_t *, struct request *);
@@ -1370,8 +1328,7 @@ void ide_unregister_region(struct gendisk *);
1370 1328
1371void ide_undecoded_slave(ide_hwif_t *); 1329void ide_undecoded_slave(ide_hwif_t *);
1372 1330
1373int probe_hwif_init_with_fixup(ide_hwif_t *, void (*)(ide_hwif_t *)); 1331int ide_device_add(u8 idx[4]);
1374extern int probe_hwif_init(ide_hwif_t *);
1375 1332
1376static inline void *ide_get_hwifdata (ide_hwif_t * hwif) 1333static inline void *ide_get_hwifdata (ide_hwif_t * hwif)
1377{ 1334{