diff options
-rw-r--r-- | drivers/scsi/sata_nv.c | 169 |
1 files changed, 0 insertions, 169 deletions
diff --git a/drivers/scsi/sata_nv.c b/drivers/scsi/sata_nv.c index 90551246aa46..70f81941f76e 100644 --- a/drivers/scsi/sata_nv.c +++ b/drivers/scsi/sata_nv.c | |||
@@ -64,12 +64,6 @@ enum { | |||
64 | NV_INT_STATUS_SDEV_PM = 0x20, | 64 | NV_INT_STATUS_SDEV_PM = 0x20, |
65 | NV_INT_STATUS_SDEV_ADDED = 0x40, | 65 | NV_INT_STATUS_SDEV_ADDED = 0x40, |
66 | NV_INT_STATUS_SDEV_REMOVED = 0x80, | 66 | NV_INT_STATUS_SDEV_REMOVED = 0x80, |
67 | NV_INT_STATUS_PDEV_HOTPLUG = (NV_INT_STATUS_PDEV_ADDED | | ||
68 | NV_INT_STATUS_PDEV_REMOVED), | ||
69 | NV_INT_STATUS_SDEV_HOTPLUG = (NV_INT_STATUS_SDEV_ADDED | | ||
70 | NV_INT_STATUS_SDEV_REMOVED), | ||
71 | NV_INT_STATUS_HOTPLUG = (NV_INT_STATUS_PDEV_HOTPLUG | | ||
72 | NV_INT_STATUS_SDEV_HOTPLUG), | ||
73 | 67 | ||
74 | NV_INT_ENABLE = 0x11, | 68 | NV_INT_ENABLE = 0x11, |
75 | NV_INT_ENABLE_CK804 = 0x441, | 69 | NV_INT_ENABLE_CK804 = 0x441, |
@@ -81,12 +75,6 @@ enum { | |||
81 | NV_INT_ENABLE_SDEV_PM = 0x20, | 75 | NV_INT_ENABLE_SDEV_PM = 0x20, |
82 | NV_INT_ENABLE_SDEV_ADDED = 0x40, | 76 | NV_INT_ENABLE_SDEV_ADDED = 0x40, |
83 | NV_INT_ENABLE_SDEV_REMOVED = 0x80, | 77 | NV_INT_ENABLE_SDEV_REMOVED = 0x80, |
84 | NV_INT_ENABLE_PDEV_HOTPLUG = (NV_INT_ENABLE_PDEV_ADDED | | ||
85 | NV_INT_ENABLE_PDEV_REMOVED), | ||
86 | NV_INT_ENABLE_SDEV_HOTPLUG = (NV_INT_ENABLE_SDEV_ADDED | | ||
87 | NV_INT_ENABLE_SDEV_REMOVED), | ||
88 | NV_INT_ENABLE_HOTPLUG = (NV_INT_ENABLE_PDEV_HOTPLUG | | ||
89 | NV_INT_ENABLE_SDEV_HOTPLUG), | ||
90 | 78 | ||
91 | NV_INT_CONFIG = 0x12, | 79 | NV_INT_CONFIG = 0x12, |
92 | NV_INT_CONFIG_METHD = 0x01, // 0 = INT, 1 = SMI | 80 | NV_INT_CONFIG_METHD = 0x01, // 0 = INT, 1 = SMI |
@@ -102,12 +90,6 @@ static irqreturn_t nv_interrupt (int irq, void *dev_instance, | |||
102 | static u32 nv_scr_read (struct ata_port *ap, unsigned int sc_reg); | 90 | static u32 nv_scr_read (struct ata_port *ap, unsigned int sc_reg); |
103 | static void nv_scr_write (struct ata_port *ap, unsigned int sc_reg, u32 val); | 91 | static void nv_scr_write (struct ata_port *ap, unsigned int sc_reg, u32 val); |
104 | static void nv_host_stop (struct ata_host_set *host_set); | 92 | static void nv_host_stop (struct ata_host_set *host_set); |
105 | static void nv_enable_hotplug(struct ata_probe_ent *probe_ent); | ||
106 | static void nv_disable_hotplug(struct ata_host_set *host_set); | ||
107 | static int nv_check_hotplug(struct ata_host_set *host_set); | ||
108 | static void nv_enable_hotplug_ck804(struct ata_probe_ent *probe_ent); | ||
109 | static void nv_disable_hotplug_ck804(struct ata_host_set *host_set); | ||
110 | static int nv_check_hotplug_ck804(struct ata_host_set *host_set); | ||
111 | 93 | ||
112 | enum nv_host_type | 94 | enum nv_host_type |
113 | { | 95 | { |
@@ -158,34 +140,18 @@ static const struct pci_device_id nv_pci_tbl[] = { | |||
158 | struct nv_host_desc | 140 | struct nv_host_desc |
159 | { | 141 | { |
160 | enum nv_host_type host_type; | 142 | enum nv_host_type host_type; |
161 | void (*enable_hotplug)(struct ata_probe_ent *probe_ent); | ||
162 | void (*disable_hotplug)(struct ata_host_set *host_set); | ||
163 | int (*check_hotplug)(struct ata_host_set *host_set); | ||
164 | |||
165 | }; | 143 | }; |
166 | static struct nv_host_desc nv_device_tbl[] = { | 144 | static struct nv_host_desc nv_device_tbl[] = { |
167 | { | 145 | { |
168 | .host_type = GENERIC, | 146 | .host_type = GENERIC, |
169 | .enable_hotplug = NULL, | ||
170 | .disable_hotplug= NULL, | ||
171 | .check_hotplug = NULL, | ||
172 | }, | 147 | }, |
173 | { | 148 | { |
174 | .host_type = NFORCE2, | 149 | .host_type = NFORCE2, |
175 | .enable_hotplug = nv_enable_hotplug, | ||
176 | .disable_hotplug= nv_disable_hotplug, | ||
177 | .check_hotplug = nv_check_hotplug, | ||
178 | }, | 150 | }, |
179 | { | 151 | { |
180 | .host_type = NFORCE3, | 152 | .host_type = NFORCE3, |
181 | .enable_hotplug = nv_enable_hotplug, | ||
182 | .disable_hotplug= nv_disable_hotplug, | ||
183 | .check_hotplug = nv_check_hotplug, | ||
184 | }, | 153 | }, |
185 | { .host_type = CK804, | 154 | { .host_type = CK804, |
186 | .enable_hotplug = nv_enable_hotplug_ck804, | ||
187 | .disable_hotplug= nv_disable_hotplug_ck804, | ||
188 | .check_hotplug = nv_check_hotplug_ck804, | ||
189 | }, | 155 | }, |
190 | }; | 156 | }; |
191 | 157 | ||
@@ -275,7 +241,6 @@ static irqreturn_t nv_interrupt (int irq, void *dev_instance, | |||
275 | struct pt_regs *regs) | 241 | struct pt_regs *regs) |
276 | { | 242 | { |
277 | struct ata_host_set *host_set = dev_instance; | 243 | struct ata_host_set *host_set = dev_instance; |
278 | struct nv_host *host = host_set->private_data; | ||
279 | unsigned int i; | 244 | unsigned int i; |
280 | unsigned int handled = 0; | 245 | unsigned int handled = 0; |
281 | unsigned long flags; | 246 | unsigned long flags; |
@@ -301,9 +266,6 @@ static irqreturn_t nv_interrupt (int irq, void *dev_instance, | |||
301 | 266 | ||
302 | } | 267 | } |
303 | 268 | ||
304 | if (host->host_desc->check_hotplug) | ||
305 | handled += host->host_desc->check_hotplug(host_set); | ||
306 | |||
307 | spin_unlock_irqrestore(&host_set->lock, flags); | 269 | spin_unlock_irqrestore(&host_set->lock, flags); |
308 | 270 | ||
309 | return IRQ_RETVAL(handled); | 271 | return IRQ_RETVAL(handled); |
@@ -329,10 +291,6 @@ static void nv_host_stop (struct ata_host_set *host_set) | |||
329 | { | 291 | { |
330 | struct nv_host *host = host_set->private_data; | 292 | struct nv_host *host = host_set->private_data; |
331 | 293 | ||
332 | // Disable hotplug event interrupts. | ||
333 | if (host->host_desc->disable_hotplug) | ||
334 | host->host_desc->disable_hotplug(host_set); | ||
335 | |||
336 | kfree(host); | 294 | kfree(host); |
337 | 295 | ||
338 | ata_pci_host_stop(host_set); | 296 | ata_pci_host_stop(host_set); |
@@ -409,10 +367,6 @@ static int nv_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) | |||
409 | if (rc != NV_PORTS) | 367 | if (rc != NV_PORTS) |
410 | goto err_out_iounmap; | 368 | goto err_out_iounmap; |
411 | 369 | ||
412 | // Enable hotplug event interrupts. | ||
413 | if (host->host_desc->enable_hotplug) | ||
414 | host->host_desc->enable_hotplug(probe_ent); | ||
415 | |||
416 | kfree(probe_ent); | 370 | kfree(probe_ent); |
417 | 371 | ||
418 | return 0; | 372 | return 0; |
@@ -432,129 +386,6 @@ err_out: | |||
432 | return rc; | 386 | return rc; |
433 | } | 387 | } |
434 | 388 | ||
435 | static void nv_enable_hotplug(struct ata_probe_ent *probe_ent) | ||
436 | { | ||
437 | u8 intr_mask; | ||
438 | |||
439 | outb(NV_INT_STATUS_HOTPLUG, | ||
440 | probe_ent->port[0].scr_addr + NV_INT_STATUS); | ||
441 | |||
442 | intr_mask = inb(probe_ent->port[0].scr_addr + NV_INT_ENABLE); | ||
443 | intr_mask |= NV_INT_ENABLE_HOTPLUG; | ||
444 | |||
445 | outb(intr_mask, probe_ent->port[0].scr_addr + NV_INT_ENABLE); | ||
446 | } | ||
447 | |||
448 | static void nv_disable_hotplug(struct ata_host_set *host_set) | ||
449 | { | ||
450 | u8 intr_mask; | ||
451 | |||
452 | intr_mask = inb(host_set->ports[0]->ioaddr.scr_addr + NV_INT_ENABLE); | ||
453 | |||
454 | intr_mask &= ~(NV_INT_ENABLE_HOTPLUG); | ||
455 | |||
456 | outb(intr_mask, host_set->ports[0]->ioaddr.scr_addr + NV_INT_ENABLE); | ||
457 | } | ||
458 | |||
459 | static int nv_check_hotplug(struct ata_host_set *host_set) | ||
460 | { | ||
461 | u8 intr_status; | ||
462 | |||
463 | intr_status = inb(host_set->ports[0]->ioaddr.scr_addr + NV_INT_STATUS); | ||
464 | |||
465 | // Clear interrupt status. | ||
466 | outb(0xff, host_set->ports[0]->ioaddr.scr_addr + NV_INT_STATUS); | ||
467 | |||
468 | if (intr_status & NV_INT_STATUS_HOTPLUG) { | ||
469 | if (intr_status & NV_INT_STATUS_PDEV_ADDED) | ||
470 | printk(KERN_WARNING "nv_sata: " | ||
471 | "Primary device added\n"); | ||
472 | |||
473 | if (intr_status & NV_INT_STATUS_PDEV_REMOVED) | ||
474 | printk(KERN_WARNING "nv_sata: " | ||
475 | "Primary device removed\n"); | ||
476 | |||
477 | if (intr_status & NV_INT_STATUS_SDEV_ADDED) | ||
478 | printk(KERN_WARNING "nv_sata: " | ||
479 | "Secondary device added\n"); | ||
480 | |||
481 | if (intr_status & NV_INT_STATUS_SDEV_REMOVED) | ||
482 | printk(KERN_WARNING "nv_sata: " | ||
483 | "Secondary device removed\n"); | ||
484 | |||
485 | return 1; | ||
486 | } | ||
487 | |||
488 | return 0; | ||
489 | } | ||
490 | |||
491 | static void nv_enable_hotplug_ck804(struct ata_probe_ent *probe_ent) | ||
492 | { | ||
493 | struct pci_dev *pdev = to_pci_dev(probe_ent->dev); | ||
494 | u8 intr_mask; | ||
495 | u8 regval; | ||
496 | |||
497 | pci_read_config_byte(pdev, NV_MCP_SATA_CFG_20, ®val); | ||
498 | regval |= NV_MCP_SATA_CFG_20_SATA_SPACE_EN; | ||
499 | pci_write_config_byte(pdev, NV_MCP_SATA_CFG_20, regval); | ||
500 | |||
501 | writeb(NV_INT_STATUS_HOTPLUG, probe_ent->mmio_base + NV_INT_STATUS_CK804); | ||
502 | |||
503 | intr_mask = readb(probe_ent->mmio_base + NV_INT_ENABLE_CK804); | ||
504 | intr_mask |= NV_INT_ENABLE_HOTPLUG; | ||
505 | |||
506 | writeb(intr_mask, probe_ent->mmio_base + NV_INT_ENABLE_CK804); | ||
507 | } | ||
508 | |||
509 | static void nv_disable_hotplug_ck804(struct ata_host_set *host_set) | ||
510 | { | ||
511 | struct pci_dev *pdev = to_pci_dev(host_set->dev); | ||
512 | u8 intr_mask; | ||
513 | u8 regval; | ||
514 | |||
515 | intr_mask = readb(host_set->mmio_base + NV_INT_ENABLE_CK804); | ||
516 | |||
517 | intr_mask &= ~(NV_INT_ENABLE_HOTPLUG); | ||
518 | |||
519 | writeb(intr_mask, host_set->mmio_base + NV_INT_ENABLE_CK804); | ||
520 | |||
521 | pci_read_config_byte(pdev, NV_MCP_SATA_CFG_20, ®val); | ||
522 | regval &= ~NV_MCP_SATA_CFG_20_SATA_SPACE_EN; | ||
523 | pci_write_config_byte(pdev, NV_MCP_SATA_CFG_20, regval); | ||
524 | } | ||
525 | |||
526 | static int nv_check_hotplug_ck804(struct ata_host_set *host_set) | ||
527 | { | ||
528 | u8 intr_status; | ||
529 | |||
530 | intr_status = readb(host_set->mmio_base + NV_INT_STATUS_CK804); | ||
531 | |||
532 | // Clear interrupt status. | ||
533 | writeb(0xff, host_set->mmio_base + NV_INT_STATUS_CK804); | ||
534 | |||
535 | if (intr_status & NV_INT_STATUS_HOTPLUG) { | ||
536 | if (intr_status & NV_INT_STATUS_PDEV_ADDED) | ||
537 | printk(KERN_WARNING "nv_sata: " | ||
538 | "Primary device added\n"); | ||
539 | |||
540 | if (intr_status & NV_INT_STATUS_PDEV_REMOVED) | ||
541 | printk(KERN_WARNING "nv_sata: " | ||
542 | "Primary device removed\n"); | ||
543 | |||
544 | if (intr_status & NV_INT_STATUS_SDEV_ADDED) | ||
545 | printk(KERN_WARNING "nv_sata: " | ||
546 | "Secondary device added\n"); | ||
547 | |||
548 | if (intr_status & NV_INT_STATUS_SDEV_REMOVED) | ||
549 | printk(KERN_WARNING "nv_sata: " | ||
550 | "Secondary device removed\n"); | ||
551 | |||
552 | return 1; | ||
553 | } | ||
554 | |||
555 | return 0; | ||
556 | } | ||
557 | |||
558 | static int __init nv_init(void) | 389 | static int __init nv_init(void) |
559 | { | 390 | { |
560 | return pci_module_init(&nv_pci_driver); | 391 | return pci_module_init(&nv_pci_driver); |