Lines Matching +full:native +full:- +full:mode

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
16 #include <linux/dma-mapping.h>
21 * ide_setup_pci_baseregs - place a PCI IDE controller native
22 * @dev: PCI device of interface to switch native
25 * We attempt to place the PCI interface into PCI native mode. If
26 * we succeed the BARs are ok and the controller is in PCI mode.
30 * we don't switch it back to legacy mode. Do we actually care ??
38 * Place both IDE interfaces into PCI "native" mode: in ide_setup_pci_baseregs()
44 "native PCI mode\n", name, pci_name(dev)); in ide_setup_pci_baseregs()
45 return -EOPNOTSUPP; in ide_setup_pci_baseregs()
47 printk(KERN_INFO "%s %s: placing both ports into native PCI " in ide_setup_pci_baseregs()
48 "mode\n", name, pci_name(dev)); in ide_setup_pci_baseregs()
55 return -EOPNOTSUPP; in ide_setup_pci_baseregs()
73 * ide_pci_dma_base - setup BMIBA
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()
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
188 * legacy mode.
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
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()
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
291 return -EINVAL; in ide_pci_check_iomem()
295 * ide_hw_configure - configure a struct ide_hw instance
313 if ((d->host_flags & IDE_HFLAG_ISA_PORTS) == 0) { in ide_hw_configure()
318 d->name, pci_name(dev), port); in ide_hw_configure()
319 return -EINVAL; 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
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
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
459 int channels = (d->host_flags & IDE_HFLAG_SINGLE) ? 1 : 2, 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()
472 d->name, pci_name(dev)); in ide_pci_setup_ports()
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()
517 printk(KERN_INFO "%s %s: not 100%% native mode: will " 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()
524 printk(KERN_INFO "%s %s: 100%% native mode on irq %d\n", 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()