Lines Matching +full:ide +full:- +full:port
2 * Copyright (C) 1998-2000 Andre Hedrick <andre@linux-ide.org>
3 * Copyright (C) 1995-1998 Mark Lord
4 * Copyright (C) 2007-2009 Bartlomiej Zolnierkiewicz
15 #include <linux/ide.h>
16 #include <linux/dma-mapping.h>
21 * ide_setup_pci_baseregs - place a PCI IDE controller native
38 * Place both IDE interfaces into PCI "native" mode: in ide_setup_pci_baseregs()
45 return -EOPNOTSUPP; in ide_setup_pci_baseregs()
55 return -EOPNOTSUPP; in ide_setup_pci_baseregs()
73 * ide_pci_dma_base - setup BMIBA
74 * @hwif: IDE interface
75 * @d: IDE port info
77 * Fetch the DMA Bus-Master-I/O-Base-Address (BMIBA) from PCI space.
82 struct pci_dev *dev = to_pci_dev(hwif->dev); in ide_pci_dma_base()
85 if (hwif->host_flags & IDE_HFLAG_MMIO) in ide_pci_dma_base()
86 return hwif->dma_base; in ide_pci_dma_base()
88 if (hwif->mate && hwif->mate->dma_base) { in ide_pci_dma_base()
89 dma_base = hwif->mate->dma_base - (hwif->channel ? 0 : 8); in ide_pci_dma_base()
91 u8 baridx = (d->host_flags & IDE_HFLAG_CS5520) ? 2 : 4; in ide_pci_dma_base()
97 d->name, pci_name(dev)); in ide_pci_dma_base()
102 if (hwif->channel) in ide_pci_dma_base()
111 struct pci_dev *dev = to_pci_dev(hwif->dev); in ide_pci_check_simplex()
114 if (d->host_flags & (IDE_HFLAG_MMIO | IDE_HFLAG_CS5520)) in ide_pci_check_simplex()
117 if (d->host_flags & IDE_HFLAG_CLEAR_SIMPLEX) { in ide_pci_check_simplex()
118 if (ide_pci_clear_simplex(hwif->dma_base, d->name)) in ide_pci_check_simplex()
120 d->name, pci_name(dev)); in ide_pci_check_simplex()
132 * the DMA end. This has to be become dynamic to handle hot-plug. in ide_pci_check_simplex()
134 dma_stat = hwif->dma_ops->dma_sff_read_status(hwif); in ide_pci_check_simplex()
135 if ((dma_stat & 0x80) && hwif->mate && hwif->mate->dma_base) { in ide_pci_check_simplex()
137 d->name, pci_name(dev)); in ide_pci_check_simplex()
138 return -1; in ide_pci_check_simplex()
146 * Set up BM-DMA capability (PnP BIOS should have done this)
161 return -EIO; in ide_pci_set_master()
172 printk(KERN_INFO "%s %s: IDE controller (0x%04x:0x%04x rev 0x%02x)\n", in ide_setup_pci_noise()
173 d->name, pci_name(dev), in ide_setup_pci_noise()
174 dev->vendor, dev->device, dev->revision); in ide_setup_pci_noise()
180 * ide_pci_enable - do PCI enables
183 * @d: IDE port info
185 * Enable the IDE PCI device. We attempt to enable the device in full
202 d->name, pci_name(dev)); in ide_pci_enable()
206 d->name, pci_name(dev)); in ide_pci_enable()
210 * assume all devices can do 32-bit DMA for now, we can add in ide_pci_enable()
214 ret = dma_set_mask(&dev->dev, DMA_BIT_MASK(32)); in ide_pci_enable()
217 d->name, pci_name(dev)); in ide_pci_enable()
221 ret = pci_request_selected_regions(dev, bars, d->name); in ide_pci_enable()
224 d->name, pci_name(dev)); in ide_pci_enable()
230 * ide_pci_configure - configure an unconfigured device
232 * @d: IDE port info
248 if (ide_setup_pci_baseregs(dev, d->name) || in ide_pci_configure()
251 d->name, pci_name(dev)); in ide_pci_configure()
252 return -ENODEV; in ide_pci_configure()
256 d->name, pci_name(dev)); in ide_pci_configure()
257 return -EIO; in ide_pci_configure()
260 printk(KERN_ERR "%s %s: unable to enable IDE controller\n", in ide_pci_configure()
261 d->name, pci_name(dev)); in ide_pci_configure()
262 return -ENXIO; in ide_pci_configure()
268 * ide_pci_check_iomem - check a register is I/O
270 * @d: IDE port info
291 return -EINVAL; in ide_pci_check_iomem()
295 * ide_hw_configure - configure a struct ide_hw instance
297 * @d: IDE port info
298 * @port: port number
299 * @hw: struct ide_hw instance corresponding to this port
302 * is done per interface port rather than per PCI device. There may be
303 * more than one port per device.
309 unsigned int port, struct ide_hw *hw) in ide_hw_configure() argument
313 if ((d->host_flags & IDE_HFLAG_ISA_PORTS) == 0) { in ide_hw_configure()
314 if (ide_pci_check_iomem(dev, d, 2 * port) || in ide_hw_configure()
315 ide_pci_check_iomem(dev, d, 2 * port + 1)) { in ide_hw_configure()
317 "reported as MEM for port %d!\n", in ide_hw_configure()
318 d->name, pci_name(dev), port); in ide_hw_configure()
319 return -EINVAL; in ide_hw_configure()
322 ctl = pci_resource_start(dev, 2*port+1); in ide_hw_configure()
323 base = pci_resource_start(dev, 2*port); in ide_hw_configure()
326 ctl = port ? 0x374 : 0x3f4; in ide_hw_configure()
327 base = port ? 0x170 : 0x1f0; in ide_hw_configure()
331 printk(KERN_ERR "%s %s: bad PCI BARs for port %d, skipping\n", in ide_hw_configure()
332 d->name, pci_name(dev), port); in ide_hw_configure()
333 return -EINVAL; in ide_hw_configure()
337 hw->dev = &dev->dev; in ide_hw_configure()
345 * ide_hwif_setup_dma - configure DMA interface
346 * @hwif: IDE interface
347 * @d: IDE port info
356 struct pci_dev *dev = to_pci_dev(hwif->dev); in ide_hwif_setup_dma()
358 if ((d->host_flags & IDE_HFLAG_NO_AUTODMA) == 0 || in ide_hwif_setup_dma()
359 ((dev->class >> 8) == PCI_CLASS_STORAGE_IDE && in ide_hwif_setup_dma()
360 (dev->class & 0x80))) { in ide_hwif_setup_dma()
364 return -1; in ide_hwif_setup_dma()
366 hwif->dma_base = base; in ide_hwif_setup_dma()
368 if (hwif->dma_ops == NULL) in ide_hwif_setup_dma()
369 hwif->dma_ops = &sff_dma_ops; in ide_hwif_setup_dma()
372 return -1; in ide_hwif_setup_dma()
374 if (ide_pci_set_master(dev, d->name) < 0) in ide_hwif_setup_dma()
375 return -1; in ide_hwif_setup_dma()
377 if (hwif->host_flags & IDE_HFLAG_MMIO) in ide_hwif_setup_dma()
378 printk(KERN_INFO " %s: MMIO-DMA\n", hwif->name); in ide_hwif_setup_dma()
380 printk(KERN_INFO " %s: BM-DMA at 0x%04lx-0x%04lx\n", in ide_hwif_setup_dma()
381 hwif->name, base, base + 7); in ide_hwif_setup_dma()
383 hwif->extra_base = base + (hwif->channel ? 8 : 16); in ide_hwif_setup_dma()
386 return -1; in ide_hwif_setup_dma()
394 * ide_setup_pci_controller - set up IDE PCI
397 * @d: IDE port info
400 * Set up the PCI and controller side of the IDE interface. This brings
421 d->name, pci_name(dev)); in ide_setup_pci_controller()
429 d->name, pci_name(dev)); in ide_setup_pci_controller()
441 * ide_pci_setup_ports - configure ports/devices on PCI IDE
443 * @d: IDE port info
444 * @hw: struct ide_hw instances corresponding to this PCI IDE device
448 * necessary per port setup. Attach the devices and ask the
453 * where the chipset setup is not the default PCI IDE one.
459 int channels = (d->host_flags & IDE_HFLAG_SINGLE) ? 1 : 2, port; in ide_pci_setup_ports() local
463 * Set up the IDE ports in ide_pci_setup_ports()
466 for (port = 0; port < channels; ++port) { in ide_pci_setup_ports()
467 const struct ide_pci_enablebit *e = &d->enablebits[port]; in ide_pci_setup_ports()
469 if (e->reg && (pci_read_config_byte(dev, e->reg, &tmp) || in ide_pci_setup_ports()
470 (tmp & e->mask) != e->val)) { in ide_pci_setup_ports()
471 printk(KERN_INFO "%s %s: IDE port disabled\n", in ide_pci_setup_ports()
472 d->name, pci_name(dev)); in ide_pci_setup_ports()
473 continue; /* port not enabled */ in ide_pci_setup_ports()
476 if (ide_hw_configure(dev, d, port, hw + port)) in ide_pci_setup_ports()
479 *(hws + port) = hw + port; in ide_pci_setup_ports()
486 * on a PCI IDE device and, if they are enabled, prepares the IDE driver
503 pciirq = dev->irq; in do_ide_setup_pci_device()
506 * This allows offboard ide-pci cards the enable a BIOS, in do_ide_setup_pci_device()
507 * verify interrupt settings of split-mirror pci-config in do_ide_setup_pci_device()
508 * space, place chipset into init-mode, and/or preserve in do_ide_setup_pci_device()
509 * an interrupt if the card is not native ide support. in do_ide_setup_pci_device()
511 ret = d->init_chipset ? d->init_chipset(dev) : 0; in do_ide_setup_pci_device()
518 "probe irqs later\n", d->name, pci_name(dev)); in do_ide_setup_pci_device()
522 d->name, pci_name(dev), pciirq); in do_ide_setup_pci_device()
525 d->name, pci_name(dev), pciirq); in do_ide_setup_pci_device()
541 if (d->host_flags & IDE_HFLAG_SINGLE) in ide_pci_init_two()
542 bars = (1 << 2) - 1; in ide_pci_init_two()
544 bars = (1 << 4) - 1; in ide_pci_init_two()
546 if ((d->host_flags & IDE_HFLAG_NO_DMA) == 0) { in ide_pci_init_two()
547 if (d->host_flags & IDE_HFLAG_CS5520) in ide_pci_init_two()
566 ret = -ENOMEM; in ide_pci_init_two()
570 host->dev[0] = &dev1->dev; in ide_pci_init_two()
572 host->dev[1] = &dev2->dev; in ide_pci_init_two()
574 host->host_priv = priv; in ide_pci_init_two()
575 host->irq_flags = IRQF_SHARED; in ide_pci_init_two()
607 while (i--) in ide_pci_init_two()
624 struct pci_dev *dev2 = host->dev[1] ? to_pci_dev(host->dev[1]) : NULL; in ide_pci_remove()
627 if (host->host_flags & IDE_HFLAG_SINGLE) in ide_pci_remove()
628 bars = (1 << 2) - 1; in ide_pci_remove()
630 bars = (1 << 4) - 1; in ide_pci_remove()
632 if ((host->host_flags & IDE_HFLAG_NO_DMA) == 0) { in ide_pci_remove()
633 if (host->host_flags & IDE_HFLAG_CS5520) in ide_pci_remove()
676 if (host->init_chipset) in ide_pci_resume()
677 host->init_chipset(dev); in ide_pci_resume()