This commit was manufactured by cvs2svn to create tag
[linux-2.6.git] / drivers / scsi / ata_piix.c
1 /*
2
3     ata_piix.c - Intel PATA/SATA controllers
4
5     Maintained by:  Jeff Garzik <jgarzik@pobox.com>
6                     Please ALWAYS copy linux-ide@vger.kernel.org
7                     on emails.
8
9
10         Copyright 2003-2004 Red Hat Inc
11         Copyright 2003-2004 Jeff Garzik
12
13
14         Copyright header from piix.c:
15
16     Copyright (C) 1998-1999 Andrzej Krzysztofowicz, Author and Maintainer
17     Copyright (C) 1998-2000 Andre Hedrick <andre@linux-ide.org>
18     Copyright (C) 2003 Red Hat Inc <alan@redhat.com>
19
20     May be copied or modified under the terms of the GNU General Public License
21
22  */
23
24 #include <linux/kernel.h>
25 #include <linux/module.h>
26 #include <linux/pci.h>
27 #include <linux/init.h>
28 #include <linux/blkdev.h>
29 #include <linux/delay.h>
30 #include "scsi.h"
31 #include <scsi/scsi_host.h>
32 #include <linux/libata.h>
33
34 #define DRV_NAME        "ata_piix"
35 #define DRV_VERSION     "1.02"
36
37 enum {
38         PIIX_IOCFG              = 0x54, /* IDE I/O configuration register */
39         ICH5_PMR                = 0x90, /* port mapping register */
40         ICH5_PCS                = 0x92, /* port control and status */
41
42         PIIX_FLAG_AHCI          = (1 << 28), /* AHCI possible */
43         PIIX_FLAG_CHECKINTR     = (1 << 29), /* make sure PCI INTx enabled */
44         PIIX_FLAG_COMBINED      = (1 << 30), /* combined mode possible */
45
46         /* combined mode.  if set, PATA is channel 0.
47          * if clear, PATA is channel 1.
48          */
49         PIIX_COMB_PATA_P0       = (1 << 1),
50         PIIX_COMB               = (1 << 2), /* combined mode enabled? */
51
52         PIIX_PORT_PRESENT       = (1 << 0),
53         PIIX_PORT_ENABLED       = (1 << 4),
54
55         PIIX_80C_PRI            = (1 << 5) | (1 << 4),
56         PIIX_80C_SEC            = (1 << 7) | (1 << 6),
57
58         ich5_pata               = 0,
59         ich5_sata               = 1,
60         piix4_pata              = 2,
61         ich6_sata               = 3,
62         ich6_sata_rm            = 4,
63 };
64
65 static int piix_init_one (struct pci_dev *pdev,
66                                     const struct pci_device_id *ent);
67
68 static void piix_pata_phy_reset(struct ata_port *ap);
69 static void piix_sata_phy_reset(struct ata_port *ap);
70 static void piix_set_piomode (struct ata_port *ap, struct ata_device *adev);
71 static void piix_set_dmamode (struct ata_port *ap, struct ata_device *adev);
72
73 static unsigned int in_module_init = 1;
74
75 static struct pci_device_id piix_pci_tbl[] = {
76 #ifdef ATA_ENABLE_PATA
77         { 0x8086, 0x7111, PCI_ANY_ID, PCI_ANY_ID, 0, 0, piix4_pata },
78         { 0x8086, 0x24db, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich5_pata },
79         { 0x8086, 0x25a2, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich5_pata },
80 #endif
81
82         /* NOTE: The following PCI ids must be kept in sync with the
83          * list in drivers/pci/quirks.c.
84          */
85
86         { 0x8086, 0x24d1, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich5_sata },
87         { 0x8086, 0x24df, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich5_sata },
88         { 0x8086, 0x25a3, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich5_sata },
89         { 0x8086, 0x25b0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich5_sata },
90         { 0x8086, 0x2651, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich6_sata },
91         { 0x8086, 0x2652, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich6_sata_rm },
92         { 0x8086, 0x2653, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich6_sata_rm },
93
94         { }     /* terminate list */
95 };
96
97 static struct pci_driver piix_pci_driver = {
98         .name                   = DRV_NAME,
99         .id_table               = piix_pci_tbl,
100         .probe                  = piix_init_one,
101         .remove                 = ata_pci_remove_one,
102 };
103
104 static Scsi_Host_Template piix_sht = {
105         .module                 = THIS_MODULE,
106         .name                   = DRV_NAME,
107         .ioctl                  = ata_scsi_ioctl,
108         .queuecommand           = ata_scsi_queuecmd,
109         .eh_strategy_handler    = ata_scsi_error,
110         .can_queue              = ATA_DEF_QUEUE,
111         .this_id                = ATA_SHT_THIS_ID,
112         .sg_tablesize           = LIBATA_MAX_PRD,
113         .max_sectors            = ATA_MAX_SECTORS,
114         .cmd_per_lun            = ATA_SHT_CMD_PER_LUN,
115         .emulated               = ATA_SHT_EMULATED,
116         .use_clustering         = ATA_SHT_USE_CLUSTERING,
117         .proc_name              = DRV_NAME,
118         .dma_boundary           = ATA_DMA_BOUNDARY,
119         .slave_configure        = ata_scsi_slave_config,
120         .bios_param             = ata_std_bios_param,
121 };
122
123 static struct ata_port_operations piix_pata_ops = {
124         .port_disable           = ata_port_disable,
125         .set_piomode            = piix_set_piomode,
126         .set_dmamode            = piix_set_dmamode,
127
128         .tf_load                = ata_tf_load,
129         .tf_read                = ata_tf_read,
130         .check_status           = ata_check_status,
131         .exec_command           = ata_exec_command,
132         .dev_select             = ata_std_dev_select,
133
134         .phy_reset              = piix_pata_phy_reset,
135
136         .bmdma_setup            = ata_bmdma_setup,
137         .bmdma_start            = ata_bmdma_start,
138         .qc_prep                = ata_qc_prep,
139         .qc_issue               = ata_qc_issue_prot,
140
141         .eng_timeout            = ata_eng_timeout,
142
143         .irq_handler            = ata_interrupt,
144         .irq_clear              = ata_bmdma_irq_clear,
145
146         .port_start             = ata_port_start,
147         .port_stop              = ata_port_stop,
148 };
149
150 static struct ata_port_operations piix_sata_ops = {
151         .port_disable           = ata_port_disable,
152
153         .tf_load                = ata_tf_load,
154         .tf_read                = ata_tf_read,
155         .check_status           = ata_check_status,
156         .exec_command           = ata_exec_command,
157         .dev_select             = ata_std_dev_select,
158
159         .phy_reset              = piix_sata_phy_reset,
160
161         .bmdma_setup            = ata_bmdma_setup,
162         .bmdma_start            = ata_bmdma_start,
163         .qc_prep                = ata_qc_prep,
164         .qc_issue               = ata_qc_issue_prot,
165
166         .eng_timeout            = ata_eng_timeout,
167
168         .irq_handler            = ata_interrupt,
169         .irq_clear              = ata_bmdma_irq_clear,
170
171         .port_start             = ata_port_start,
172         .port_stop              = ata_port_stop,
173 };
174
175 static struct ata_port_info piix_port_info[] = {
176         /* ich5_pata */
177         {
178                 .sht            = &piix_sht,
179                 .host_flags     = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST |
180                                   PIIX_FLAG_CHECKINTR,
181                 .pio_mask       = 0x1f, /* pio0-4 */
182 #if 0
183                 .mwdma_mask     = 0x06, /* mwdma1-2 */
184 #else
185                 .mwdma_mask     = 0x00, /* mwdma broken */
186 #endif
187                 .udma_mask      = 0x3f, /* udma0-5 */
188                 .port_ops       = &piix_pata_ops,
189         },
190
191         /* ich5_sata */
192         {
193                 .sht            = &piix_sht,
194                 .host_flags     = ATA_FLAG_SATA | ATA_FLAG_SRST |
195                                   PIIX_FLAG_COMBINED | PIIX_FLAG_CHECKINTR,
196                 .pio_mask       = 0x1f, /* pio0-4 */
197                 .mwdma_mask     = 0x07, /* mwdma0-2 */
198                 .udma_mask      = 0x7f, /* udma0-6 */
199                 .port_ops       = &piix_sata_ops,
200         },
201
202         /* piix4_pata */
203         {
204                 .sht            = &piix_sht,
205                 .host_flags     = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST,
206                 .pio_mask       = 0x1f, /* pio0-4 */
207 #if 0
208                 .mwdma_mask     = 0x06, /* mwdma1-2 */
209 #else
210                 .mwdma_mask     = 0x00, /* mwdma broken */
211 #endif
212                 .udma_mask      = ATA_UDMA_MASK_40C,
213                 .port_ops       = &piix_pata_ops,
214         },
215
216         /* ich6_sata */
217         {
218                 .sht            = &piix_sht,
219                 .host_flags     = ATA_FLAG_SATA | ATA_FLAG_SRST |
220                                   PIIX_FLAG_COMBINED | PIIX_FLAG_CHECKINTR |
221                                   ATA_FLAG_SLAVE_POSS,
222                 .pio_mask       = 0x1f, /* pio0-4 */
223                 .mwdma_mask     = 0x07, /* mwdma0-2 */
224                 .udma_mask      = 0x7f, /* udma0-6 */
225                 .port_ops       = &piix_sata_ops,
226         },
227
228         /* ich6_sata_rm */
229         {
230                 .sht            = &piix_sht,
231                 .host_flags     = ATA_FLAG_SATA | ATA_FLAG_SRST |
232                                   PIIX_FLAG_COMBINED | PIIX_FLAG_CHECKINTR |
233                                   ATA_FLAG_SLAVE_POSS | PIIX_FLAG_AHCI,
234                 .pio_mask       = 0x1f, /* pio0-4 */
235                 .mwdma_mask     = 0x07, /* mwdma0-2 */
236                 .udma_mask      = 0x7f, /* udma0-6 */
237                 .port_ops       = &piix_sata_ops,
238         },
239 };
240
241 static struct pci_bits piix_enable_bits[] = {
242         { 0x41U, 1U, 0x80UL, 0x80UL },  /* port 0 */
243         { 0x43U, 1U, 0x80UL, 0x80UL },  /* port 1 */
244 };
245
246 MODULE_AUTHOR("Andre Hedrick, Alan Cox, Andrzej Krzysztofowicz, Jeff Garzik");
247 MODULE_DESCRIPTION("SCSI low-level driver for Intel PIIX/ICH ATA controllers");
248 MODULE_LICENSE("GPL");
249 MODULE_DEVICE_TABLE(pci, piix_pci_tbl);
250 MODULE_VERSION(DRV_VERSION);
251
252 /**
253  *      piix_pata_cbl_detect - Probe host controller cable detect info
254  *      @ap: Port for which cable detect info is desired
255  *
256  *      Read 80c cable indicator from ATA PCI device's PCI config
257  *      register.  This register is normally set by firmware (BIOS).
258  *
259  *      LOCKING:
260  *      None (inherited from caller).
261  */
262 static void piix_pata_cbl_detect(struct ata_port *ap)
263 {
264         struct pci_dev *pdev = ap->host_set->pdev;
265         u8 tmp, mask;
266
267         /* no 80c support in host controller? */
268         if ((ap->udma_mask & ~ATA_UDMA_MASK_40C) == 0)
269                 goto cbl40;
270
271         /* check BIOS cable detect results */
272         mask = ap->hard_port_no == 0 ? PIIX_80C_PRI : PIIX_80C_SEC;
273         pci_read_config_byte(pdev, PIIX_IOCFG, &tmp);
274         if ((tmp & mask) == 0)
275                 goto cbl40;
276
277         ap->cbl = ATA_CBL_PATA80;
278         return;
279
280 cbl40:
281         ap->cbl = ATA_CBL_PATA40;
282         ap->udma_mask &= ATA_UDMA_MASK_40C;
283 }
284
285 /**
286  *      piix_pata_phy_reset - Probe specified port on PATA host controller
287  *      @ap: Port to probe
288  *
289  *      Probe PATA phy.
290  *
291  *      LOCKING:
292  *      None (inherited from caller).
293  */
294
295 static void piix_pata_phy_reset(struct ata_port *ap)
296 {
297         if (!pci_test_config_bits(ap->host_set->pdev,
298                                   &piix_enable_bits[ap->hard_port_no])) {
299                 ata_port_disable(ap);
300                 printk(KERN_INFO "ata%u: port disabled. ignoring.\n", ap->id);
301                 return;
302         }
303
304         piix_pata_cbl_detect(ap);
305
306         ata_port_probe(ap);
307
308         ata_bus_reset(ap);
309 }
310
311 /**
312  *      piix_sata_probe - Probe PCI device for present SATA devices
313  *      @ap: Port associated with the PCI device we wish to probe
314  *
315  *      Reads SATA PCI device's PCI config register Port Configuration
316  *      and Status (PCS) to determine port and device availability.
317  *
318  *      LOCKING:
319  *      None (inherited from caller).
320  *
321  *      RETURNS:
322  *      Non-zero if device detected, zero otherwise.
323  */
324 static int piix_sata_probe (struct ata_port *ap)
325 {
326         struct pci_dev *pdev = ap->host_set->pdev;
327         int combined = (ap->flags & ATA_FLAG_SLAVE_POSS);
328         int orig_mask, mask, i;
329         u8 pcs;
330
331         mask = (PIIX_PORT_PRESENT << ap->hard_port_no) |
332                (PIIX_PORT_ENABLED << ap->hard_port_no);
333
334         pci_read_config_byte(pdev, ICH5_PCS, &pcs);
335         orig_mask = (int) pcs & 0xff;
336
337         /* TODO: this is vaguely wrong for ICH6 combined mode,
338          * where only two of the four SATA ports are mapped
339          * onto a single ATA channel.  It is also vaguely inaccurate
340          * for ICH5, which has only two ports.  However, this is ok,
341          * as further device presence detection code will handle
342          * any false positives produced here.
343          */
344
345         for (i = 0; i < 4; i++) {
346                 mask = (PIIX_PORT_PRESENT << i) | (PIIX_PORT_ENABLED << i);
347
348                 if ((orig_mask & mask) == mask)
349                         if (combined || (i == ap->hard_port_no))
350                                 return 1;
351         }
352
353         return 0;
354 }
355
356 /**
357  *      piix_sata_phy_reset - Probe specified port on SATA host controller
358  *      @ap: Port to probe
359  *
360  *      Probe SATA phy.
361  *
362  *      LOCKING:
363  *      None (inherited from caller).
364  */
365
366 static void piix_sata_phy_reset(struct ata_port *ap)
367 {
368         if (!piix_sata_probe(ap)) {
369                 ata_port_disable(ap);
370                 printk(KERN_INFO "ata%u: SATA port has no device.\n", ap->id);
371                 return;
372         }
373
374         ap->cbl = ATA_CBL_SATA;
375
376         ata_port_probe(ap);
377
378         ata_bus_reset(ap);
379 }
380
381 /**
382  *      piix_set_piomode - Initialize host controller PATA PIO timings
383  *      @ap: Port whose timings we are configuring
384  *      @adev: um
385  *      @pio: PIO mode, 0 - 4
386  *
387  *      Set PIO mode for device, in host controller PCI config space.
388  *
389  *      LOCKING:
390  *      None (inherited from caller).
391  */
392
393 static void piix_set_piomode (struct ata_port *ap, struct ata_device *adev)
394 {
395         unsigned int pio        = adev->pio_mode - XFER_PIO_0;
396         struct pci_dev *dev     = ap->host_set->pdev;
397         unsigned int is_slave   = (adev->devno != 0);
398         unsigned int master_port= ap->hard_port_no ? 0x42 : 0x40;
399         unsigned int slave_port = 0x44;
400         u16 master_data;
401         u8 slave_data;
402
403         static const     /* ISP  RTC */
404         u8 timings[][2] = { { 0, 0 },
405                             { 0, 0 },
406                             { 1, 0 },
407                             { 2, 1 },
408                             { 2, 3 }, };
409
410         pci_read_config_word(dev, master_port, &master_data);
411         if (is_slave) {
412                 master_data |= 0x4000;
413                 /* enable PPE, IE and TIME */
414                 master_data |= 0x0070;
415                 pci_read_config_byte(dev, slave_port, &slave_data);
416                 slave_data &= (ap->hard_port_no ? 0x0f : 0xf0);
417                 slave_data |=
418                         (timings[pio][0] << 2) |
419                         (timings[pio][1] << (ap->hard_port_no ? 4 : 0));
420         } else {
421                 master_data &= 0xccf8;
422                 /* enable PPE, IE and TIME */
423                 master_data |= 0x0007;
424                 master_data |=
425                         (timings[pio][0] << 12) |
426                         (timings[pio][1] << 8);
427         }
428         pci_write_config_word(dev, master_port, master_data);
429         if (is_slave)
430                 pci_write_config_byte(dev, slave_port, slave_data);
431 }
432
433 /**
434  *      piix_set_dmamode - Initialize host controller PATA PIO timings
435  *      @ap: Port whose timings we are configuring
436  *      @adev: um
437  *      @udma: udma mode, 0 - 6
438  *
439  *      Set UDMA mode for device, in host controller PCI config space.
440  *
441  *      LOCKING:
442  *      None (inherited from caller).
443  */
444
445 static void piix_set_dmamode (struct ata_port *ap, struct ata_device *adev)
446 {
447         unsigned int udma       = adev->dma_mode; /* FIXME: MWDMA too */
448         struct pci_dev *dev     = ap->host_set->pdev;
449         u8 maslave              = ap->hard_port_no ? 0x42 : 0x40;
450         u8 speed                = udma;
451         unsigned int drive_dn   = (ap->hard_port_no ? 2 : 0) + adev->devno;
452         int a_speed             = 3 << (drive_dn * 4);
453         int u_flag              = 1 << drive_dn;
454         int v_flag              = 0x01 << drive_dn;
455         int w_flag              = 0x10 << drive_dn;
456         int u_speed             = 0;
457         int                     sitre;
458         u16                     reg4042, reg4a;
459         u8                      reg48, reg54, reg55;
460
461         pci_read_config_word(dev, maslave, &reg4042);
462         DPRINTK("reg4042 = 0x%04x\n", reg4042);
463         sitre = (reg4042 & 0x4000) ? 1 : 0;
464         pci_read_config_byte(dev, 0x48, &reg48);
465         pci_read_config_word(dev, 0x4a, &reg4a);
466         pci_read_config_byte(dev, 0x54, &reg54);
467         pci_read_config_byte(dev, 0x55, &reg55);
468
469         switch(speed) {
470                 case XFER_UDMA_4:
471                 case XFER_UDMA_2:       u_speed = 2 << (drive_dn * 4); break;
472                 case XFER_UDMA_6:
473                 case XFER_UDMA_5:
474                 case XFER_UDMA_3:
475                 case XFER_UDMA_1:       u_speed = 1 << (drive_dn * 4); break;
476                 case XFER_UDMA_0:       u_speed = 0 << (drive_dn * 4); break;
477                 case XFER_MW_DMA_2:
478                 case XFER_MW_DMA_1:     break;
479                 default:
480                         BUG();
481                         return;
482         }
483
484         if (speed >= XFER_UDMA_0) {
485                 if (!(reg48 & u_flag))
486                         pci_write_config_byte(dev, 0x48, reg48 | u_flag);
487                 if (speed == XFER_UDMA_5) {
488                         pci_write_config_byte(dev, 0x55, (u8) reg55|w_flag);
489                 } else {
490                         pci_write_config_byte(dev, 0x55, (u8) reg55 & ~w_flag);
491                 }
492                 if ((reg4a & a_speed) != u_speed)
493                         pci_write_config_word(dev, 0x4a, (reg4a & ~a_speed) | u_speed);
494                 if (speed > XFER_UDMA_2) {
495                         if (!(reg54 & v_flag))
496                                 pci_write_config_byte(dev, 0x54, reg54 | v_flag);
497                 } else
498                         pci_write_config_byte(dev, 0x54, reg54 & ~v_flag);
499         } else {
500                 if (reg48 & u_flag)
501                         pci_write_config_byte(dev, 0x48, reg48 & ~u_flag);
502                 if (reg4a & a_speed)
503                         pci_write_config_word(dev, 0x4a, reg4a & ~a_speed);
504                 if (reg54 & v_flag)
505                         pci_write_config_byte(dev, 0x54, reg54 & ~v_flag);
506                 if (reg55 & w_flag)
507                         pci_write_config_byte(dev, 0x55, (u8) reg55 & ~w_flag);
508         }
509 }
510
511 /* move to PCI layer, integrate w/ MSI stuff */
512 static void pci_enable_intx(struct pci_dev *pdev)
513 {
514         u16 pci_command;
515
516         pci_read_config_word(pdev, PCI_COMMAND, &pci_command);
517         if (pci_command & PCI_COMMAND_INTX_DISABLE) {
518                 pci_command &= ~PCI_COMMAND_INTX_DISABLE;
519                 pci_write_config_word(pdev, PCI_COMMAND, pci_command);
520         }
521 }
522
523 #define AHCI_PCI_BAR 5
524 #define AHCI_GLOBAL_CTL 0x04
525 #define AHCI_ENABLE (1 << 31)
526 static int piix_disable_ahci(struct pci_dev *pdev)
527 {
528         void *mmio;
529         unsigned long addr;
530         u32 tmp;
531         int rc = 0;
532
533         /* BUG: pci_enable_device has not yet been called.  This
534          * works because this device is usually set up by BIOS.
535          */
536
537         addr = pci_resource_start(pdev, AHCI_PCI_BAR);
538         if (!addr || !pci_resource_len(pdev, AHCI_PCI_BAR))
539                 return 0;
540         
541         mmio = ioremap(addr, 64);
542         if (!mmio)
543                 return -ENOMEM;
544         
545         tmp = readl(mmio + AHCI_GLOBAL_CTL);
546         if (tmp & AHCI_ENABLE) {
547                 tmp &= ~AHCI_ENABLE;
548                 writel(tmp, mmio + AHCI_GLOBAL_CTL);
549
550                 tmp = readl(mmio + AHCI_GLOBAL_CTL);
551                 if (tmp & AHCI_ENABLE)
552                         rc = -EIO;
553         }
554         
555         iounmap(mmio);
556         return rc;
557 }
558
559 /**
560  *      piix_init_one - Register PIIX ATA PCI device with kernel services
561  *      @pdev: PCI device to register
562  *      @ent: Entry in piix_pci_tbl matching with @pdev
563  *
564  *      Called from kernel PCI layer.  We probe for combined mode (sigh),
565  *      and then hand over control to libata, for it to do the rest.
566  *
567  *      LOCKING:
568  *      Inherited from PCI layer (may sleep).
569  *
570  *      RETURNS:
571  *      Zero on success, or -ERRNO value.
572  */
573
574 static int piix_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
575 {
576         static int printed_version;
577         struct ata_port_info *port_info[2];
578         unsigned int combined = 0, n_ports = 1;
579         unsigned int pata_chan = 0, sata_chan = 0;
580
581         if (!printed_version++)
582                 printk(KERN_DEBUG DRV_NAME " version " DRV_VERSION "\n");
583
584         /* no hotplugging support (FIXME) */
585         if (!in_module_init)
586                 return -ENODEV;
587
588         port_info[0] = &piix_port_info[ent->driver_data];
589         port_info[1] = NULL;
590
591         if (port_info[0]->host_flags & PIIX_FLAG_AHCI) {
592                 int rc = piix_disable_ahci(pdev);
593                 if (rc)
594                         return rc;
595         }
596
597         if (port_info[0]->host_flags & PIIX_FLAG_COMBINED) {
598                 u8 tmp;
599                 pci_read_config_byte(pdev, ICH5_PMR, &tmp);
600
601                 if (tmp & PIIX_COMB) {
602                         combined = 1;
603                         if (tmp & PIIX_COMB_PATA_P0)
604                                 sata_chan = 1;
605                         else
606                                 pata_chan = 1;
607                 }
608         }
609
610         /* On ICH5, some BIOSen disable the interrupt using the
611          * PCI_COMMAND_INTX_DISABLE bit added in PCI 2.3.
612          * On ICH6, this bit has the same effect, but only when
613          * MSI is disabled (and it is disabled, as we don't use
614          * message-signalled interrupts currently).
615          */
616         if (port_info[0]->host_flags & PIIX_FLAG_CHECKINTR)
617                 pci_enable_intx(pdev);
618
619         if (combined) {
620                 port_info[sata_chan] = &piix_port_info[ent->driver_data];
621                 port_info[sata_chan]->host_flags |= ATA_FLAG_SLAVE_POSS;
622                 port_info[pata_chan] = &piix_port_info[ich5_pata];
623                 n_ports++;
624
625                 printk(KERN_WARNING DRV_NAME ": combined mode detected\n");
626         }
627
628         return ata_pci_init_one(pdev, port_info, n_ports);
629 }
630
631 /**
632  *      piix_init -
633  *
634  *      LOCKING:
635  *
636  *      RETURNS:
637  *
638  */
639
640 static int __init piix_init(void)
641 {
642         int rc;
643
644         DPRINTK("pci_module_init\n");
645         rc = pci_module_init(&piix_pci_driver);
646         if (rc)
647                 return rc;
648
649         in_module_init = 0;
650
651         DPRINTK("done\n");
652         return 0;
653 }
654
655 /**
656  *      piix_exit -
657  *
658  *      LOCKING:
659  *
660  */
661
662 static void __exit piix_exit(void)
663 {
664         pci_unregister_driver(&piix_pci_driver);
665 }
666
667 module_init(piix_init);
668 module_exit(piix_exit);
669