update to 2.6.9-rc1
[linux-flexiantxendom0-3.2.10.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_pio,
129         .tf_read                = ata_tf_read_pio,
130         .check_status           = ata_check_status_pio,
131         .exec_command           = ata_exec_command_pio,
132
133         .phy_reset              = piix_pata_phy_reset,
134
135         .bmdma_setup            = ata_bmdma_setup_pio,
136         .bmdma_start            = ata_bmdma_start_pio,
137         .qc_prep                = ata_qc_prep,
138         .qc_issue               = ata_qc_issue_prot,
139
140         .eng_timeout            = ata_eng_timeout,
141
142         .irq_handler            = ata_interrupt,
143         .irq_clear              = ata_bmdma_irq_clear,
144
145         .port_start             = ata_port_start,
146         .port_stop              = ata_port_stop,
147 };
148
149 static struct ata_port_operations piix_sata_ops = {
150         .port_disable           = ata_port_disable,
151
152         .tf_load                = ata_tf_load_pio,
153         .tf_read                = ata_tf_read_pio,
154         .check_status           = ata_check_status_pio,
155         .exec_command           = ata_exec_command_pio,
156
157         .phy_reset              = piix_sata_phy_reset,
158
159         .bmdma_setup            = ata_bmdma_setup_pio,
160         .bmdma_start            = ata_bmdma_start_pio,
161         .qc_prep                = ata_qc_prep,
162         .qc_issue               = ata_qc_issue_prot,
163
164         .eng_timeout            = ata_eng_timeout,
165
166         .irq_handler            = ata_interrupt,
167         .irq_clear              = ata_bmdma_irq_clear,
168
169         .port_start             = ata_port_start,
170         .port_stop              = ata_port_stop,
171 };
172
173 static struct ata_port_info piix_port_info[] = {
174         /* ich5_pata */
175         {
176                 .sht            = &piix_sht,
177                 .host_flags     = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST |
178                                   PIIX_FLAG_CHECKINTR,
179                 .pio_mask       = 0x1f, /* pio0-4 */
180 #if 0
181                 .mwdma_mask     = 0x06, /* mwdma1-2 */
182 #else
183                 .mwdma_mask     = 0x00, /* mwdma broken */
184 #endif
185                 .udma_mask      = ATA_UDMA_MASK_40C, /* FIXME: cbl det */
186                 .port_ops       = &piix_pata_ops,
187         },
188
189         /* ich5_sata */
190         {
191                 .sht            = &piix_sht,
192                 .host_flags     = ATA_FLAG_SATA | ATA_FLAG_SRST |
193                                   PIIX_FLAG_COMBINED | PIIX_FLAG_CHECKINTR,
194                 .pio_mask       = 0x1f, /* pio0-4 */
195                 .mwdma_mask     = 0x07, /* mwdma0-2 */
196                 .udma_mask      = 0x7f, /* udma0-6 */
197                 .port_ops       = &piix_sata_ops,
198         },
199
200         /* piix4_pata */
201         {
202                 .sht            = &piix_sht,
203                 .host_flags     = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST,
204                 .pio_mask       = 0x1f, /* pio0-4 */
205 #if 0
206                 .mwdma_mask     = 0x06, /* mwdma1-2 */
207 #else
208                 .mwdma_mask     = 0x00, /* mwdma broken */
209 #endif
210                 .udma_mask      = ATA_UDMA_MASK_40C, /* FIXME: cbl det */
211                 .port_ops       = &piix_pata_ops,
212         },
213
214         /* ich6_sata */
215         {
216                 .sht            = &piix_sht,
217                 .host_flags     = ATA_FLAG_SATA | ATA_FLAG_SRST |
218                                   PIIX_FLAG_COMBINED | PIIX_FLAG_CHECKINTR |
219                                   ATA_FLAG_SLAVE_POSS,
220                 .pio_mask       = 0x1f, /* pio0-4 */
221                 .mwdma_mask     = 0x07, /* mwdma0-2 */
222                 .udma_mask      = 0x7f, /* udma0-6 */
223                 .port_ops       = &piix_sata_ops,
224         },
225
226         /* ich6_sata_rm */
227         {
228                 .sht            = &piix_sht,
229                 .host_flags     = ATA_FLAG_SATA | ATA_FLAG_SRST |
230                                   PIIX_FLAG_COMBINED | PIIX_FLAG_CHECKINTR |
231                                   ATA_FLAG_SLAVE_POSS | PIIX_FLAG_AHCI,
232                 .pio_mask       = 0x1f, /* pio0-4 */
233                 .mwdma_mask     = 0x07, /* mwdma0-2 */
234                 .udma_mask      = 0x7f, /* udma0-6 */
235                 .port_ops       = &piix_sata_ops,
236         },
237 };
238
239 static struct pci_bits piix_enable_bits[] = {
240         { 0x41U, 1U, 0x80UL, 0x80UL },  /* port 0 */
241         { 0x43U, 1U, 0x80UL, 0x80UL },  /* port 1 */
242 };
243
244 MODULE_AUTHOR("Andre Hedrick, Alan Cox, Andrzej Krzysztofowicz, Jeff Garzik");
245 MODULE_DESCRIPTION("SCSI low-level driver for Intel PIIX/ICH ATA controllers");
246 MODULE_LICENSE("GPL");
247 MODULE_DEVICE_TABLE(pci, piix_pci_tbl);
248
249 /**
250  *      piix_pata_cbl_detect - Probe host controller cable detect info
251  *      @ap: Port for which cable detect info is desired
252  *
253  *      Read 80c cable indicator from SATA PCI device's PCI config
254  *      register.  This register is normally set by firmware (BIOS).
255  *
256  *      LOCKING:
257  *      None (inherited from caller).
258  */
259 static void piix_pata_cbl_detect(struct ata_port *ap)
260 {
261         struct pci_dev *pdev = ap->host_set->pdev;
262         u8 tmp, mask;
263
264         /* no 80c support in host controller? */
265         if ((ap->udma_mask & ~ATA_UDMA_MASK_40C) == 0)
266                 goto cbl40;
267
268         /* check BIOS cable detect results */
269         mask = ap->port_no == 0 ? PIIX_80C_PRI : PIIX_80C_SEC;
270         pci_read_config_byte(pdev, PIIX_IOCFG, &tmp);
271         if ((tmp & mask) == 0)
272                 goto cbl40;
273
274         ap->cbl = ATA_CBL_PATA80;
275         return;
276
277 cbl40:
278         ap->cbl = ATA_CBL_PATA40;
279         ap->udma_mask &= ATA_UDMA_MASK_40C;
280 }
281
282 /**
283  *      piix_pata_phy_reset - Probe specified port on PATA host controller
284  *      @ap: Port to probe
285  *
286  *      Probe PATA phy.
287  *
288  *      LOCKING:
289  *      None (inherited from caller).
290  */
291
292 static void piix_pata_phy_reset(struct ata_port *ap)
293 {
294         if (!pci_test_config_bits(ap->host_set->pdev,
295                                   &piix_enable_bits[ap->port_no])) {
296                 ata_port_disable(ap);
297                 printk(KERN_INFO "ata%u: port disabled. ignoring.\n", ap->id);
298                 return;
299         }
300
301         piix_pata_cbl_detect(ap);
302
303         ata_port_probe(ap);
304
305         ata_bus_reset(ap);
306 }
307
308 /**
309  *      piix_sata_probe - Probe PCI device for present SATA devices
310  *      @ap: Port associated with the PCI device we wish to probe
311  *
312  *      Reads SATA PCI device's PCI config register Port Configuration
313  *      and Status (PCS) to determine port and device availability.
314  *
315  *      LOCKING:
316  *      None (inherited from caller).
317  *
318  *      RETURNS:
319  *      Non-zero if device detected, zero otherwise.
320  */
321 static int piix_sata_probe (struct ata_port *ap)
322 {
323         struct pci_dev *pdev = ap->host_set->pdev;
324         int combined = (ap->flags & ATA_FLAG_SLAVE_POSS);
325         int orig_mask, mask, i;
326         u8 pcs;
327
328         mask = (PIIX_PORT_PRESENT << ap->port_no) |
329                (PIIX_PORT_ENABLED << ap->port_no);
330
331         pci_read_config_byte(pdev, ICH5_PCS, &pcs);
332         orig_mask = (int) pcs & 0xff;
333
334         /* TODO: this is vaguely wrong for ICH6 combined mode,
335          * where only two of the four SATA ports are mapped
336          * onto a single ATA channel.  It is also vaguely inaccurate
337          * for ICH5, which has only two ports.  However, this is ok,
338          * as further device presence detection code will handle
339          * any false positives produced here.
340          */
341
342         for (i = 0; i < 4; i++) {
343                 mask = (PIIX_PORT_PRESENT << i) | (PIIX_PORT_ENABLED << i);
344
345                 if ((orig_mask & mask) == mask)
346                         if (combined || (i == ap->port_no))
347                                 return 1;
348         }
349
350         return 0;
351 }
352
353 /**
354  *      piix_sata_phy_reset - Probe specified port on SATA host controller
355  *      @ap: Port to probe
356  *
357  *      Probe SATA phy.
358  *
359  *      LOCKING:
360  *      None (inherited from caller).
361  */
362
363 static void piix_sata_phy_reset(struct ata_port *ap)
364 {
365         if (!piix_sata_probe(ap)) {
366                 ata_port_disable(ap);
367                 printk(KERN_INFO "ata%u: SATA port has no device.\n", ap->id);
368                 return;
369         }
370
371         ap->cbl = ATA_CBL_SATA;
372
373         ata_port_probe(ap);
374
375         ata_bus_reset(ap);
376 }
377
378 /**
379  *      piix_set_piomode - Initialize host controller PATA PIO timings
380  *      @ap: Port whose timings we are configuring
381  *      @adev: um
382  *      @pio: PIO mode, 0 - 4
383  *
384  *      Set PIO mode for device, in host controller PCI config space.
385  *
386  *      LOCKING:
387  *      None (inherited from caller).
388  */
389
390 static void piix_set_piomode (struct ata_port *ap, struct ata_device *adev)
391 {
392         unsigned int pio        = adev->pio_mode;
393         struct pci_dev *dev     = ap->host_set->pdev;
394         unsigned int is_slave   = (adev->devno != 0);
395         unsigned int master_port= ap->port_no ? 0x42 : 0x40;
396         unsigned int slave_port = 0x44;
397         u16 master_data;
398         u8 slave_data;
399
400         static const     /* ISP  RTC */
401         u8 timings[][2] = { { 0, 0 },
402                             { 0, 0 },
403                             { 1, 0 },
404                             { 2, 1 },
405                             { 2, 3 }, };
406
407         pci_read_config_word(dev, master_port, &master_data);
408         if (is_slave) {
409                 master_data |= 0x4000;
410                 /* enable PPE, IE and TIME */
411                 master_data |= 0x0070;
412                 pci_read_config_byte(dev, slave_port, &slave_data);
413                 slave_data &= (ap->port_no ? 0x0f : 0xf0);
414                 slave_data |=
415                         (timings[pio][0] << 2) |
416                         (timings[pio][1] << (ap->port_no ? 4 : 0));
417         } else {
418                 master_data &= 0xccf8;
419                 /* enable PPE, IE and TIME */
420                 master_data |= 0x0007;
421                 master_data |=
422                         (timings[pio][0] << 12) |
423                         (timings[pio][1] << 8);
424         }
425         pci_write_config_word(dev, master_port, master_data);
426         if (is_slave)
427                 pci_write_config_byte(dev, slave_port, slave_data);
428 }
429
430 /**
431  *      piix_set_dmamode - Initialize host controller PATA PIO timings
432  *      @ap: Port whose timings we are configuring
433  *      @adev: um
434  *      @udma: udma mode, 0 - 6
435  *
436  *      Set UDMA mode for device, in host controller PCI config space.
437  *
438  *      LOCKING:
439  *      None (inherited from caller).
440  */
441
442 static void piix_set_dmamode (struct ata_port *ap, struct ata_device *adev)
443 {
444         unsigned int udma       = adev->dma_mode; /* FIXME: MWDMA too */
445         struct pci_dev *dev     = ap->host_set->pdev;
446         u8 maslave              = ap->port_no ? 0x42 : 0x40;
447         u8 speed                = udma;
448         unsigned int drive_dn   = (ap->port_no ? 2 : 0) + adev->devno;
449         int a_speed             = 3 << (drive_dn * 4);
450         int u_flag              = 1 << drive_dn;
451         int v_flag              = 0x01 << drive_dn;
452         int w_flag              = 0x10 << drive_dn;
453         int u_speed             = 0;
454         int                     sitre;
455         u16                     reg4042, reg4a;
456         u8                      reg48, reg54, reg55;
457
458         pci_read_config_word(dev, maslave, &reg4042);
459         DPRINTK("reg4042 = 0x%04x\n", reg4042);
460         sitre = (reg4042 & 0x4000) ? 1 : 0;
461         pci_read_config_byte(dev, 0x48, &reg48);
462         pci_read_config_word(dev, 0x4a, &reg4a);
463         pci_read_config_byte(dev, 0x54, &reg54);
464         pci_read_config_byte(dev, 0x55, &reg55);
465
466         switch(speed) {
467                 case XFER_UDMA_4:
468                 case XFER_UDMA_2:       u_speed = 2 << (drive_dn * 4); break;
469                 case XFER_UDMA_6:
470                 case XFER_UDMA_5:
471                 case XFER_UDMA_3:
472                 case XFER_UDMA_1:       u_speed = 1 << (drive_dn * 4); break;
473                 case XFER_UDMA_0:       u_speed = 0 << (drive_dn * 4); break;
474                 case XFER_MW_DMA_2:
475                 case XFER_MW_DMA_1:     break;
476                 default:
477                         BUG();
478                         return;
479         }
480
481         if (speed >= XFER_UDMA_0) {
482                 if (!(reg48 & u_flag))
483                         pci_write_config_byte(dev, 0x48, reg48 | u_flag);
484                 if (speed == XFER_UDMA_5) {
485                         pci_write_config_byte(dev, 0x55, (u8) reg55|w_flag);
486                 } else {
487                         pci_write_config_byte(dev, 0x55, (u8) reg55 & ~w_flag);
488                 }
489                 if ((reg4a & a_speed) != u_speed)
490                         pci_write_config_word(dev, 0x4a, (reg4a & ~a_speed) | u_speed);
491                 if (speed > XFER_UDMA_2) {
492                         if (!(reg54 & v_flag))
493                                 pci_write_config_byte(dev, 0x54, reg54 | v_flag);
494                 } else
495                         pci_write_config_byte(dev, 0x54, reg54 & ~v_flag);
496         } else {
497                 if (reg48 & u_flag)
498                         pci_write_config_byte(dev, 0x48, reg48 & ~u_flag);
499                 if (reg4a & a_speed)
500                         pci_write_config_word(dev, 0x4a, reg4a & ~a_speed);
501                 if (reg54 & v_flag)
502                         pci_write_config_byte(dev, 0x54, reg54 & ~v_flag);
503                 if (reg55 & w_flag)
504                         pci_write_config_byte(dev, 0x55, (u8) reg55 & ~w_flag);
505         }
506 }
507
508 /* move to PCI layer, integrate w/ MSI stuff */
509 static void pci_enable_intx(struct pci_dev *pdev)
510 {
511         u16 pci_command;
512
513         pci_read_config_word(pdev, PCI_COMMAND, &pci_command);
514         if (pci_command & PCI_COMMAND_INTX_DISABLE) {
515                 pci_command &= ~PCI_COMMAND_INTX_DISABLE;
516                 pci_write_config_word(pdev, PCI_COMMAND, pci_command);
517         }
518 }
519
520 #define AHCI_PCI_BAR 5
521 #define AHCI_GLOBAL_CTL 0x04
522 #define AHCI_ENABLE (1 << 31)
523 static int piix_disable_ahci(struct pci_dev *pdev)
524 {
525         void *mmio;
526         unsigned long addr;
527         u32 tmp;
528         int rc = 0;
529
530         /* BUG: pci_enable_device has not yet been called.  This
531          * works because this device is usually set up by BIOS.
532          */
533
534         addr = pci_resource_start(pdev, AHCI_PCI_BAR);
535         if (!addr || !pci_resource_len(pdev, AHCI_PCI_BAR))
536                 return 0;
537         
538         mmio = ioremap(addr, 64);
539         if (!mmio)
540                 return -ENOMEM;
541         
542         tmp = readl(mmio + AHCI_GLOBAL_CTL);
543         if (tmp & AHCI_ENABLE) {
544                 tmp &= ~AHCI_ENABLE;
545                 writel(tmp, mmio + AHCI_GLOBAL_CTL);
546
547                 tmp = readl(mmio + AHCI_GLOBAL_CTL);
548                 if (tmp & AHCI_ENABLE)
549                         rc = -EIO;
550         }
551         
552         iounmap(mmio);
553         return rc;
554 }
555
556 /**
557  *      piix_init_one - Register PIIX ATA PCI device with kernel services
558  *      @pdev: PCI device to register
559  *      @ent: Entry in piix_pci_tbl matching with @pdev
560  *
561  *      Called from kernel PCI layer.  We probe for combined mode (sigh),
562  *      and then hand over control to libata, for it to do the rest.
563  *
564  *      LOCKING:
565  *      Inherited from PCI layer (may sleep).
566  *
567  *      RETURNS:
568  *      Zero on success, or -ERRNO value.
569  */
570
571 static int piix_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
572 {
573         static int printed_version;
574         struct ata_port_info *port_info[2];
575         unsigned int combined = 0, n_ports = 1;
576         unsigned int pata_chan = 0, sata_chan = 0;
577
578         if (!printed_version++)
579                 printk(KERN_DEBUG DRV_NAME " version " DRV_VERSION "\n");
580
581         /* no hotplugging support (FIXME) */
582         if (!in_module_init)
583                 return -ENODEV;
584
585         port_info[0] = &piix_port_info[ent->driver_data];
586         port_info[1] = NULL;
587
588         if (port_info[0]->host_flags & PIIX_FLAG_AHCI) {
589                 int rc = piix_disable_ahci(pdev);
590                 if (rc)
591                         return rc;
592         }
593
594         if (port_info[0]->host_flags & PIIX_FLAG_COMBINED) {
595                 u8 tmp;
596                 pci_read_config_byte(pdev, ICH5_PMR, &tmp);
597
598                 if (tmp & PIIX_COMB) {
599                         combined = 1;
600                         if (tmp & PIIX_COMB_PATA_P0)
601                                 sata_chan = 1;
602                         else
603                                 pata_chan = 1;
604                 }
605         }
606
607         /* On ICH5, some BIOSen disable the interrupt using the
608          * PCI_COMMAND_INTX_DISABLE bit added in PCI 2.3.
609          * On ICH6, this bit has the same effect, but only when
610          * MSI is disabled (and it is disabled, as we don't use
611          * message-signalled interrupts currently).
612          */
613         if (port_info[0]->host_flags & PIIX_FLAG_CHECKINTR)
614                 pci_enable_intx(pdev);
615
616         if (combined) {
617                 port_info[sata_chan] = &piix_port_info[ent->driver_data];
618                 port_info[sata_chan]->host_flags |= ATA_FLAG_SLAVE_POSS;
619                 port_info[pata_chan] = &piix_port_info[ich5_pata];
620                 n_ports++;
621
622                 printk(KERN_WARNING DRV_NAME ": combined mode detected\n");
623         }
624
625         return ata_pci_init_one(pdev, port_info, n_ports);
626 }
627
628 /**
629  *      piix_init -
630  *
631  *      LOCKING:
632  *
633  *      RETURNS:
634  *
635  */
636
637 static int __init piix_init(void)
638 {
639         int rc;
640
641         DPRINTK("pci_module_init\n");
642         rc = pci_module_init(&piix_pci_driver);
643         if (rc)
644                 return rc;
645
646         in_module_init = 0;
647
648         DPRINTK("done\n");
649         return 0;
650 }
651
652 /**
653  *      piix_exit -
654  *
655  *      LOCKING:
656  *
657  */
658
659 static void __exit piix_exit(void)
660 {
661         pci_unregister_driver(&piix_pci_driver);
662 }
663
664 module_init(piix_init);
665 module_exit(piix_exit);
666