diff options
Diffstat (limited to 'drivers/scsi/sata_promise.c')
-rw-r--r-- | drivers/scsi/sata_promise.c | 129 |
1 files changed, 88 insertions, 41 deletions
diff --git a/drivers/scsi/sata_promise.c b/drivers/scsi/sata_promise.c index b0b0a69b3563..84cb3940ad88 100644 --- a/drivers/scsi/sata_promise.c +++ b/drivers/scsi/sata_promise.c | |||
@@ -46,7 +46,7 @@ | |||
46 | #include "sata_promise.h" | 46 | #include "sata_promise.h" |
47 | 47 | ||
48 | #define DRV_NAME "sata_promise" | 48 | #define DRV_NAME "sata_promise" |
49 | #define DRV_VERSION "1.03" | 49 | #define DRV_VERSION "1.04" |
50 | 50 | ||
51 | 51 | ||
52 | enum { | 52 | enum { |
@@ -58,6 +58,7 @@ enum { | |||
58 | PDC_GLOBAL_CTL = 0x48, /* Global control/status (per port) */ | 58 | PDC_GLOBAL_CTL = 0x48, /* Global control/status (per port) */ |
59 | PDC_CTLSTAT = 0x60, /* IDE control and status (per port) */ | 59 | PDC_CTLSTAT = 0x60, /* IDE control and status (per port) */ |
60 | PDC_SATA_PLUG_CSR = 0x6C, /* SATA Plug control/status reg */ | 60 | PDC_SATA_PLUG_CSR = 0x6C, /* SATA Plug control/status reg */ |
61 | PDC2_SATA_PLUG_CSR = 0x60, /* SATAII Plug control/status reg */ | ||
61 | PDC_SLEW_CTL = 0x470, /* slew rate control reg */ | 62 | PDC_SLEW_CTL = 0x470, /* slew rate control reg */ |
62 | 63 | ||
63 | PDC_ERR_MASK = (1<<19) | (1<<20) | (1<<21) | (1<<22) | | 64 | PDC_ERR_MASK = (1<<19) | (1<<20) | (1<<21) | (1<<22) | |
@@ -67,8 +68,10 @@ enum { | |||
67 | board_20319 = 1, /* FastTrak S150 TX4 */ | 68 | board_20319 = 1, /* FastTrak S150 TX4 */ |
68 | board_20619 = 2, /* FastTrak TX4000 */ | 69 | board_20619 = 2, /* FastTrak TX4000 */ |
69 | board_20771 = 3, /* FastTrak TX2300 */ | 70 | board_20771 = 3, /* FastTrak TX2300 */ |
71 | board_2057x = 4, /* SATAII150 Tx2plus */ | ||
72 | board_40518 = 5, /* SATAII150 Tx4 */ | ||
70 | 73 | ||
71 | PDC_HAS_PATA = (1 << 1), /* PDC20375 has PATA */ | 74 | PDC_HAS_PATA = (1 << 1), /* PDC20375/20575 has PATA */ |
72 | 75 | ||
73 | PDC_RESET = (1 << 11), /* HDMA reset */ | 76 | PDC_RESET = (1 << 11), /* HDMA reset */ |
74 | 77 | ||
@@ -82,6 +85,10 @@ struct pdc_port_priv { | |||
82 | dma_addr_t pkt_dma; | 85 | dma_addr_t pkt_dma; |
83 | }; | 86 | }; |
84 | 87 | ||
88 | struct pdc_host_priv { | ||
89 | int hotplug_offset; | ||
90 | }; | ||
91 | |||
85 | static u32 pdc_sata_scr_read (struct ata_port *ap, unsigned int sc_reg); | 92 | static u32 pdc_sata_scr_read (struct ata_port *ap, unsigned int sc_reg); |
86 | static void pdc_sata_scr_write (struct ata_port *ap, unsigned int sc_reg, u32 val); | 93 | static void pdc_sata_scr_write (struct ata_port *ap, unsigned int sc_reg, u32 val); |
87 | static int pdc_ata_init_one (struct pci_dev *pdev, const struct pci_device_id *ent); | 94 | static int pdc_ata_init_one (struct pci_dev *pdev, const struct pci_device_id *ent); |
@@ -95,7 +102,8 @@ static void pdc_qc_prep(struct ata_queued_cmd *qc); | |||
95 | static void pdc_tf_load_mmio(struct ata_port *ap, const struct ata_taskfile *tf); | 102 | static void pdc_tf_load_mmio(struct ata_port *ap, const struct ata_taskfile *tf); |
96 | static void pdc_exec_command_mmio(struct ata_port *ap, const struct ata_taskfile *tf); | 103 | static void pdc_exec_command_mmio(struct ata_port *ap, const struct ata_taskfile *tf); |
97 | static void pdc_irq_clear(struct ata_port *ap); | 104 | static void pdc_irq_clear(struct ata_port *ap); |
98 | static int pdc_qc_issue_prot(struct ata_queued_cmd *qc); | 105 | static unsigned int pdc_qc_issue_prot(struct ata_queued_cmd *qc); |
106 | static void pdc_host_stop(struct ata_host_set *host_set); | ||
99 | 107 | ||
100 | 108 | ||
101 | static struct scsi_host_template pdc_ata_sht = { | 109 | static struct scsi_host_template pdc_ata_sht = { |
@@ -103,11 +111,11 @@ static struct scsi_host_template pdc_ata_sht = { | |||
103 | .name = DRV_NAME, | 111 | .name = DRV_NAME, |
104 | .ioctl = ata_scsi_ioctl, | 112 | .ioctl = ata_scsi_ioctl, |
105 | .queuecommand = ata_scsi_queuecmd, | 113 | .queuecommand = ata_scsi_queuecmd, |
114 | .eh_timed_out = ata_scsi_timed_out, | ||
106 | .eh_strategy_handler = ata_scsi_error, | 115 | .eh_strategy_handler = ata_scsi_error, |
107 | .can_queue = ATA_DEF_QUEUE, | 116 | .can_queue = ATA_DEF_QUEUE, |
108 | .this_id = ATA_SHT_THIS_ID, | 117 | .this_id = ATA_SHT_THIS_ID, |
109 | .sg_tablesize = LIBATA_MAX_PRD, | 118 | .sg_tablesize = LIBATA_MAX_PRD, |
110 | .max_sectors = ATA_MAX_SECTORS, | ||
111 | .cmd_per_lun = ATA_SHT_CMD_PER_LUN, | 119 | .cmd_per_lun = ATA_SHT_CMD_PER_LUN, |
112 | .emulated = ATA_SHT_EMULATED, | 120 | .emulated = ATA_SHT_EMULATED, |
113 | .use_clustering = ATA_SHT_USE_CLUSTERING, | 121 | .use_clustering = ATA_SHT_USE_CLUSTERING, |
@@ -137,7 +145,7 @@ static const struct ata_port_operations pdc_sata_ops = { | |||
137 | .scr_write = pdc_sata_scr_write, | 145 | .scr_write = pdc_sata_scr_write, |
138 | .port_start = pdc_port_start, | 146 | .port_start = pdc_port_start, |
139 | .port_stop = pdc_port_stop, | 147 | .port_stop = pdc_port_stop, |
140 | .host_stop = ata_pci_host_stop, | 148 | .host_stop = pdc_host_stop, |
141 | }; | 149 | }; |
142 | 150 | ||
143 | static const struct ata_port_operations pdc_pata_ops = { | 151 | static const struct ata_port_operations pdc_pata_ops = { |
@@ -158,7 +166,7 @@ static const struct ata_port_operations pdc_pata_ops = { | |||
158 | 166 | ||
159 | .port_start = pdc_port_start, | 167 | .port_start = pdc_port_start, |
160 | .port_stop = pdc_port_stop, | 168 | .port_stop = pdc_port_stop, |
161 | .host_stop = ata_pci_host_stop, | 169 | .host_stop = pdc_host_stop, |
162 | }; | 170 | }; |
163 | 171 | ||
164 | static const struct ata_port_info pdc_port_info[] = { | 172 | static const struct ata_port_info pdc_port_info[] = { |
@@ -201,6 +209,26 @@ static const struct ata_port_info pdc_port_info[] = { | |||
201 | .udma_mask = 0x7f, /* udma0-6 ; FIXME */ | 209 | .udma_mask = 0x7f, /* udma0-6 ; FIXME */ |
202 | .port_ops = &pdc_sata_ops, | 210 | .port_ops = &pdc_sata_ops, |
203 | }, | 211 | }, |
212 | |||
213 | /* board_2057x */ | ||
214 | { | ||
215 | .sht = &pdc_ata_sht, | ||
216 | .host_flags = PDC_COMMON_FLAGS | ATA_FLAG_SATA, | ||
217 | .pio_mask = 0x1f, /* pio0-4 */ | ||
218 | .mwdma_mask = 0x07, /* mwdma0-2 */ | ||
219 | .udma_mask = 0x7f, /* udma0-6 ; FIXME */ | ||
220 | .port_ops = &pdc_sata_ops, | ||
221 | }, | ||
222 | |||
223 | /* board_40518 */ | ||
224 | { | ||
225 | .sht = &pdc_ata_sht, | ||
226 | .host_flags = PDC_COMMON_FLAGS | ATA_FLAG_SATA, | ||
227 | .pio_mask = 0x1f, /* pio0-4 */ | ||
228 | .mwdma_mask = 0x07, /* mwdma0-2 */ | ||
229 | .udma_mask = 0x7f, /* udma0-6 ; FIXME */ | ||
230 | .port_ops = &pdc_sata_ops, | ||
231 | }, | ||
204 | }; | 232 | }; |
205 | 233 | ||
206 | static const struct pci_device_id pdc_ata_pci_tbl[] = { | 234 | static const struct pci_device_id pdc_ata_pci_tbl[] = { |
@@ -217,9 +245,9 @@ static const struct pci_device_id pdc_ata_pci_tbl[] = { | |||
217 | { PCI_VENDOR_ID_PROMISE, 0x3376, PCI_ANY_ID, PCI_ANY_ID, 0, 0, | 245 | { PCI_VENDOR_ID_PROMISE, 0x3376, PCI_ANY_ID, PCI_ANY_ID, 0, 0, |
218 | board_2037x }, | 246 | board_2037x }, |
219 | { PCI_VENDOR_ID_PROMISE, 0x3574, PCI_ANY_ID, PCI_ANY_ID, 0, 0, | 247 | { PCI_VENDOR_ID_PROMISE, 0x3574, PCI_ANY_ID, PCI_ANY_ID, 0, 0, |
220 | board_2037x }, | 248 | board_2057x }, |
221 | { PCI_VENDOR_ID_PROMISE, 0x3d75, PCI_ANY_ID, PCI_ANY_ID, 0, 0, | 249 | { PCI_VENDOR_ID_PROMISE, 0x3d75, PCI_ANY_ID, PCI_ANY_ID, 0, 0, |
222 | board_2037x }, | 250 | board_2057x }, |
223 | { PCI_VENDOR_ID_PROMISE, 0x3d73, PCI_ANY_ID, PCI_ANY_ID, 0, 0, | 251 | { PCI_VENDOR_ID_PROMISE, 0x3d73, PCI_ANY_ID, PCI_ANY_ID, 0, 0, |
224 | board_2037x }, | 252 | board_2037x }, |
225 | 253 | ||
@@ -227,12 +255,14 @@ static const struct pci_device_id pdc_ata_pci_tbl[] = { | |||
227 | board_20319 }, | 255 | board_20319 }, |
228 | { PCI_VENDOR_ID_PROMISE, 0x3319, PCI_ANY_ID, PCI_ANY_ID, 0, 0, | 256 | { PCI_VENDOR_ID_PROMISE, 0x3319, PCI_ANY_ID, PCI_ANY_ID, 0, 0, |
229 | board_20319 }, | 257 | board_20319 }, |
258 | { PCI_VENDOR_ID_PROMISE, 0x3515, PCI_ANY_ID, PCI_ANY_ID, 0, 0, | ||
259 | board_20319 }, | ||
230 | { PCI_VENDOR_ID_PROMISE, 0x3519, PCI_ANY_ID, PCI_ANY_ID, 0, 0, | 260 | { PCI_VENDOR_ID_PROMISE, 0x3519, PCI_ANY_ID, PCI_ANY_ID, 0, 0, |
231 | board_20319 }, | 261 | board_20319 }, |
232 | { PCI_VENDOR_ID_PROMISE, 0x3d17, PCI_ANY_ID, PCI_ANY_ID, 0, 0, | 262 | { PCI_VENDOR_ID_PROMISE, 0x3d17, PCI_ANY_ID, PCI_ANY_ID, 0, 0, |
233 | board_20319 }, | 263 | board_20319 }, |
234 | { PCI_VENDOR_ID_PROMISE, 0x3d18, PCI_ANY_ID, PCI_ANY_ID, 0, 0, | 264 | { PCI_VENDOR_ID_PROMISE, 0x3d18, PCI_ANY_ID, PCI_ANY_ID, 0, 0, |
235 | board_20319 }, | 265 | board_40518 }, |
236 | 266 | ||
237 | { PCI_VENDOR_ID_PROMISE, 0x6629, PCI_ANY_ID, PCI_ANY_ID, 0, 0, | 267 | { PCI_VENDOR_ID_PROMISE, 0x6629, PCI_ANY_ID, PCI_ANY_ID, 0, 0, |
238 | board_20619 }, | 268 | board_20619 }, |
@@ -261,12 +291,11 @@ static int pdc_port_start(struct ata_port *ap) | |||
261 | if (rc) | 291 | if (rc) |
262 | return rc; | 292 | return rc; |
263 | 293 | ||
264 | pp = kmalloc(sizeof(*pp), GFP_KERNEL); | 294 | pp = kzalloc(sizeof(*pp), GFP_KERNEL); |
265 | if (!pp) { | 295 | if (!pp) { |
266 | rc = -ENOMEM; | 296 | rc = -ENOMEM; |
267 | goto err_out; | 297 | goto err_out; |
268 | } | 298 | } |
269 | memset(pp, 0, sizeof(*pp)); | ||
270 | 299 | ||
271 | pp->pkt = dma_alloc_coherent(dev, 128, &pp->pkt_dma, GFP_KERNEL); | 300 | pp->pkt = dma_alloc_coherent(dev, 128, &pp->pkt_dma, GFP_KERNEL); |
272 | if (!pp->pkt) { | 301 | if (!pp->pkt) { |
@@ -298,6 +327,16 @@ static void pdc_port_stop(struct ata_port *ap) | |||
298 | } | 327 | } |
299 | 328 | ||
300 | 329 | ||
330 | static void pdc_host_stop(struct ata_host_set *host_set) | ||
331 | { | ||
332 | struct pdc_host_priv *hp = host_set->private_data; | ||
333 | |||
334 | ata_pci_host_stop(host_set); | ||
335 | |||
336 | kfree(hp); | ||
337 | } | ||
338 | |||
339 | |||
301 | static void pdc_reset_port(struct ata_port *ap) | 340 | static void pdc_reset_port(struct ata_port *ap) |
302 | { | 341 | { |
303 | void __iomem *mmio = (void __iomem *) ap->ioaddr.cmd_addr + PDC_CTLSTAT; | 342 | void __iomem *mmio = (void __iomem *) ap->ioaddr.cmd_addr + PDC_CTLSTAT; |
@@ -394,19 +433,6 @@ static void pdc_eng_timeout(struct ata_port *ap) | |||
394 | spin_lock_irqsave(&host_set->lock, flags); | 433 | spin_lock_irqsave(&host_set->lock, flags); |
395 | 434 | ||
396 | qc = ata_qc_from_tag(ap, ap->active_tag); | 435 | qc = ata_qc_from_tag(ap, ap->active_tag); |
397 | if (!qc) { | ||
398 | printk(KERN_ERR "ata%u: BUG: timeout without command\n", | ||
399 | ap->id); | ||
400 | goto out; | ||
401 | } | ||
402 | |||
403 | /* hack alert! We cannot use the supplied completion | ||
404 | * function from inside the ->eh_strategy_handler() thread. | ||
405 | * libata is the only user of ->eh_strategy_handler() in | ||
406 | * any kernel, so the default scsi_done() assumes it is | ||
407 | * not being called from the SCSI EH. | ||
408 | */ | ||
409 | qc->scsidone = scsi_finish_command; | ||
410 | 436 | ||
411 | switch (qc->tf.protocol) { | 437 | switch (qc->tf.protocol) { |
412 | case ATA_PROT_DMA: | 438 | case ATA_PROT_DMA: |
@@ -414,7 +440,6 @@ static void pdc_eng_timeout(struct ata_port *ap) | |||
414 | printk(KERN_ERR "ata%u: command timeout\n", ap->id); | 440 | printk(KERN_ERR "ata%u: command timeout\n", ap->id); |
415 | drv_stat = ata_wait_idle(ap); | 441 | drv_stat = ata_wait_idle(ap); |
416 | qc->err_mask |= __ac_err_mask(drv_stat); | 442 | qc->err_mask |= __ac_err_mask(drv_stat); |
417 | ata_qc_complete(qc); | ||
418 | break; | 443 | break; |
419 | 444 | ||
420 | default: | 445 | default: |
@@ -424,12 +449,11 @@ static void pdc_eng_timeout(struct ata_port *ap) | |||
424 | ap->id, qc->tf.command, drv_stat); | 449 | ap->id, qc->tf.command, drv_stat); |
425 | 450 | ||
426 | qc->err_mask |= ac_err_mask(drv_stat); | 451 | qc->err_mask |= ac_err_mask(drv_stat); |
427 | ata_qc_complete(qc); | ||
428 | break; | 452 | break; |
429 | } | 453 | } |
430 | 454 | ||
431 | out: | ||
432 | spin_unlock_irqrestore(&host_set->lock, flags); | 455 | spin_unlock_irqrestore(&host_set->lock, flags); |
456 | ata_eh_qc_complete(qc); | ||
433 | DPRINTK("EXIT\n"); | 457 | DPRINTK("EXIT\n"); |
434 | } | 458 | } |
435 | 459 | ||
@@ -495,14 +519,15 @@ static irqreturn_t pdc_interrupt (int irq, void *dev_instance, struct pt_regs *r | |||
495 | VPRINTK("QUICK EXIT 2\n"); | 519 | VPRINTK("QUICK EXIT 2\n"); |
496 | return IRQ_NONE; | 520 | return IRQ_NONE; |
497 | } | 521 | } |
522 | |||
523 | spin_lock(&host_set->lock); | ||
524 | |||
498 | mask &= 0xffff; /* only 16 tags possible */ | 525 | mask &= 0xffff; /* only 16 tags possible */ |
499 | if (!mask) { | 526 | if (!mask) { |
500 | VPRINTK("QUICK EXIT 3\n"); | 527 | VPRINTK("QUICK EXIT 3\n"); |
501 | return IRQ_NONE; | 528 | goto done_irq; |
502 | } | 529 | } |
503 | 530 | ||
504 | spin_lock(&host_set->lock); | ||
505 | |||
506 | writel(mask, mmio_base + PDC_INT_SEQMASK); | 531 | writel(mask, mmio_base + PDC_INT_SEQMASK); |
507 | 532 | ||
508 | for (i = 0; i < host_set->n_ports; i++) { | 533 | for (i = 0; i < host_set->n_ports; i++) { |
@@ -519,10 +544,10 @@ static irqreturn_t pdc_interrupt (int irq, void *dev_instance, struct pt_regs *r | |||
519 | } | 544 | } |
520 | } | 545 | } |
521 | 546 | ||
522 | spin_unlock(&host_set->lock); | ||
523 | |||
524 | VPRINTK("EXIT\n"); | 547 | VPRINTK("EXIT\n"); |
525 | 548 | ||
549 | done_irq: | ||
550 | spin_unlock(&host_set->lock); | ||
526 | return IRQ_RETVAL(handled); | 551 | return IRQ_RETVAL(handled); |
527 | } | 552 | } |
528 | 553 | ||
@@ -544,7 +569,7 @@ static inline void pdc_packet_start(struct ata_queued_cmd *qc) | |||
544 | readl((void __iomem *) ap->ioaddr.cmd_addr + PDC_PKT_SUBMIT); /* flush */ | 569 | readl((void __iomem *) ap->ioaddr.cmd_addr + PDC_PKT_SUBMIT); /* flush */ |
545 | } | 570 | } |
546 | 571 | ||
547 | static int pdc_qc_issue_prot(struct ata_queued_cmd *qc) | 572 | static unsigned int pdc_qc_issue_prot(struct ata_queued_cmd *qc) |
548 | { | 573 | { |
549 | switch (qc->tf.protocol) { | 574 | switch (qc->tf.protocol) { |
550 | case ATA_PROT_DMA: | 575 | case ATA_PROT_DMA: |
@@ -600,6 +625,8 @@ static void pdc_ata_setup_port(struct ata_ioports *port, unsigned long base) | |||
600 | static void pdc_host_init(unsigned int chip_id, struct ata_probe_ent *pe) | 625 | static void pdc_host_init(unsigned int chip_id, struct ata_probe_ent *pe) |
601 | { | 626 | { |
602 | void __iomem *mmio = pe->mmio_base; | 627 | void __iomem *mmio = pe->mmio_base; |
628 | struct pdc_host_priv *hp = pe->private_data; | ||
629 | int hotplug_offset = hp->hotplug_offset; | ||
603 | u32 tmp; | 630 | u32 tmp; |
604 | 631 | ||
605 | /* | 632 | /* |
@@ -614,12 +641,12 @@ static void pdc_host_init(unsigned int chip_id, struct ata_probe_ent *pe) | |||
614 | writel(tmp, mmio + PDC_FLASH_CTL); | 641 | writel(tmp, mmio + PDC_FLASH_CTL); |
615 | 642 | ||
616 | /* clear plug/unplug flags for all ports */ | 643 | /* clear plug/unplug flags for all ports */ |
617 | tmp = readl(mmio + PDC_SATA_PLUG_CSR); | 644 | tmp = readl(mmio + hotplug_offset); |
618 | writel(tmp | 0xff, mmio + PDC_SATA_PLUG_CSR); | 645 | writel(tmp | 0xff, mmio + hotplug_offset); |
619 | 646 | ||
620 | /* mask plug/unplug ints */ | 647 | /* mask plug/unplug ints */ |
621 | tmp = readl(mmio + PDC_SATA_PLUG_CSR); | 648 | tmp = readl(mmio + hotplug_offset); |
622 | writel(tmp | 0xff0000, mmio + PDC_SATA_PLUG_CSR); | 649 | writel(tmp | 0xff0000, mmio + hotplug_offset); |
623 | 650 | ||
624 | /* reduce TBG clock to 133 Mhz. */ | 651 | /* reduce TBG clock to 133 Mhz. */ |
625 | tmp = readl(mmio + PDC_TBG_MODE); | 652 | tmp = readl(mmio + PDC_TBG_MODE); |
@@ -641,6 +668,7 @@ static int pdc_ata_init_one (struct pci_dev *pdev, const struct pci_device_id *e | |||
641 | { | 668 | { |
642 | static int printed_version; | 669 | static int printed_version; |
643 | struct ata_probe_ent *probe_ent = NULL; | 670 | struct ata_probe_ent *probe_ent = NULL; |
671 | struct pdc_host_priv *hp; | ||
644 | unsigned long base; | 672 | unsigned long base; |
645 | void __iomem *mmio_base; | 673 | void __iomem *mmio_base; |
646 | unsigned int board_idx = (unsigned int) ent->driver_data; | 674 | unsigned int board_idx = (unsigned int) ent->driver_data; |
@@ -671,13 +699,12 @@ static int pdc_ata_init_one (struct pci_dev *pdev, const struct pci_device_id *e | |||
671 | if (rc) | 699 | if (rc) |
672 | goto err_out_regions; | 700 | goto err_out_regions; |
673 | 701 | ||
674 | probe_ent = kmalloc(sizeof(*probe_ent), GFP_KERNEL); | 702 | probe_ent = kzalloc(sizeof(*probe_ent), GFP_KERNEL); |
675 | if (probe_ent == NULL) { | 703 | if (probe_ent == NULL) { |
676 | rc = -ENOMEM; | 704 | rc = -ENOMEM; |
677 | goto err_out_regions; | 705 | goto err_out_regions; |
678 | } | 706 | } |
679 | 707 | ||
680 | memset(probe_ent, 0, sizeof(*probe_ent)); | ||
681 | probe_ent->dev = pci_dev_to_dev(pdev); | 708 | probe_ent->dev = pci_dev_to_dev(pdev); |
682 | INIT_LIST_HEAD(&probe_ent->node); | 709 | INIT_LIST_HEAD(&probe_ent->node); |
683 | 710 | ||
@@ -688,6 +715,16 @@ static int pdc_ata_init_one (struct pci_dev *pdev, const struct pci_device_id *e | |||
688 | } | 715 | } |
689 | base = (unsigned long) mmio_base; | 716 | base = (unsigned long) mmio_base; |
690 | 717 | ||
718 | hp = kzalloc(sizeof(*hp), GFP_KERNEL); | ||
719 | if (hp == NULL) { | ||
720 | rc = -ENOMEM; | ||
721 | goto err_out_free_ent; | ||
722 | } | ||
723 | |||
724 | /* Set default hotplug offset */ | ||
725 | hp->hotplug_offset = PDC_SATA_PLUG_CSR; | ||
726 | probe_ent->private_data = hp; | ||
727 | |||
691 | probe_ent->sht = pdc_port_info[board_idx].sht; | 728 | probe_ent->sht = pdc_port_info[board_idx].sht; |
692 | probe_ent->host_flags = pdc_port_info[board_idx].host_flags; | 729 | probe_ent->host_flags = pdc_port_info[board_idx].host_flags; |
693 | probe_ent->pio_mask = pdc_port_info[board_idx].pio_mask; | 730 | probe_ent->pio_mask = pdc_port_info[board_idx].pio_mask; |
@@ -707,6 +744,10 @@ static int pdc_ata_init_one (struct pci_dev *pdev, const struct pci_device_id *e | |||
707 | 744 | ||
708 | /* notice 4-port boards */ | 745 | /* notice 4-port boards */ |
709 | switch (board_idx) { | 746 | switch (board_idx) { |
747 | case board_40518: | ||
748 | /* Override hotplug offset for SATAII150 */ | ||
749 | hp->hotplug_offset = PDC2_SATA_PLUG_CSR; | ||
750 | /* Fall through */ | ||
710 | case board_20319: | 751 | case board_20319: |
711 | probe_ent->n_ports = 4; | 752 | probe_ent->n_ports = 4; |
712 | 753 | ||
@@ -716,6 +757,10 @@ static int pdc_ata_init_one (struct pci_dev *pdev, const struct pci_device_id *e | |||
716 | probe_ent->port[2].scr_addr = base + 0x600; | 757 | probe_ent->port[2].scr_addr = base + 0x600; |
717 | probe_ent->port[3].scr_addr = base + 0x700; | 758 | probe_ent->port[3].scr_addr = base + 0x700; |
718 | break; | 759 | break; |
760 | case board_2057x: | ||
761 | /* Override hotplug offset for SATAII150 */ | ||
762 | hp->hotplug_offset = PDC2_SATA_PLUG_CSR; | ||
763 | /* Fall through */ | ||
719 | case board_2037x: | 764 | case board_2037x: |
720 | probe_ent->n_ports = 2; | 765 | probe_ent->n_ports = 2; |
721 | break; | 766 | break; |
@@ -741,8 +786,10 @@ static int pdc_ata_init_one (struct pci_dev *pdev, const struct pci_device_id *e | |||
741 | /* initialize adapter */ | 786 | /* initialize adapter */ |
742 | pdc_host_init(board_idx, probe_ent); | 787 | pdc_host_init(board_idx, probe_ent); |
743 | 788 | ||
744 | /* FIXME: check ata_device_add return value */ | 789 | /* FIXME: Need any other frees than hp? */ |
745 | ata_device_add(probe_ent); | 790 | if (!ata_device_add(probe_ent)) |
791 | kfree(hp); | ||
792 | |||
746 | kfree(probe_ent); | 793 | kfree(probe_ent); |
747 | 794 | ||
748 | return 0; | 795 | return 0; |