Lines Matching defs:host

23  * low-level ATA host controller drivers.  As such, the API/ABI is
205 /* we just iterated over the host link, what's next? */
354 * the host link and all fan-out ports connected via PMP. If the
356 * first fan-out link not the host link. Device number 15 always
357 * points to the host link whether PMP is attached or not. If the
411 * the first device connected to the host link.
422 /* allow n.15/16 for devices attached to host port */
465 * the first device connected to the host link.
476 /* allow n.15/16 for devices attached to host port */
602 /* Unable to use DMA due to host limitation */
1860 if (ap->host->flags & ATA_HOST_IGNORE_ATA &&
1863 "host indicates ignore ATA devices, ignored\n");
2423 * Check for host-aware devices.
2982 /* Enable ATAPI AN if both the host and device have
3562 /* step 2: always set host PIO timings */
3576 /* step 3: set host DMA timings */
3595 * host channels are not permitted to do so.
3597 if (used_dma && (ap->host->flags & ATA_HOST_SIMPLEX))
3598 ap->host->simplex_claimed = ap;
3635 if (link->ap->host->flags & ATA_HOST_PARALLEL_SCAN)
4368 * known limits including host controller limits, device
4378 struct ata_host *host = ap->host;
4407 if ((host->flags & ATA_HOST_SIMPLEX) &&
4408 host->simplex_claimed && host->simplex_claimed != ap) {
4424 * Unknown or 80 wire cables reported host side are checked
4573 * spin_lock_irqsave(host lock)
4605 * spin_lock_irqsave(host lock)
4643 * spin_lock_irqsave(host lock)
4662 * spin_lock_irqsave(host lock)
4686 * spin_lock_irqsave(host lock)
4745 * spin_lock_irqsave(host lock)
4827 * spin_lock_irqsave(host lock)
4934 * spin_lock_irqsave(host lock)
4963 * spin_lock_irqsave(host lock)
5300 * ata_host_suspend - suspend host
5301 * @host: host to suspend
5304 * Suspend @host. Actual operation is performed by port suspend.
5306 void ata_host_suspend(struct ata_host *host, pm_message_t mesg)
5308 host->dev->power.power_state = mesg;
5313 * ata_host_resume - resume host
5314 * @host: host to resume
5316 * Resume @host. Actual operation is performed by port resume.
5318 void ata_host_resume(struct ata_host *host)
5320 host->dev->power.power_state = PMSG_ON;
5353 * host lock.
5439 * @host: ATA host this allocated port belongs to
5449 struct ata_port *ata_port_alloc(struct ata_host *host)
5458 ap->lock = &host->lock;
5461 ap->host = host;
5462 ap->dev = host->dev;
5488 struct ata_host *host = dev_get_drvdata(gendev);
5491 for (i = 0; i < host->n_ports; i++) {
5492 struct ata_port *ap = host->ports[i];
5503 ata_host_put(host);
5508 struct ata_host *host = container_of(kref, struct ata_host, kref);
5511 for (i = 0; i < host->n_ports; i++) {
5512 struct ata_port *ap = host->ports[i];
5518 host->ports[i] = NULL;
5520 kfree(host);
5523 void ata_host_get(struct ata_host *host)
5525 kref_get(&host->kref);
5528 void ata_host_put(struct ata_host *host)
5530 kref_put(&host->kref, ata_host_release);
5535 * ata_host_alloc - allocate and init basic ATA host resources
5536 * @dev: generic device this host is associated with
5537 * @max_ports: maximum number of ATA ports associated with this host
5539 * Allocate and initialize basic ATA host resources. LLD calls
5540 * this function to allocate a host, initializes it fully and
5543 * @max_ports ports are allocated and host->n_ports is
5545 * host->n_ports before calling ata_host_register(). The unused
5549 * Allocate ATA host on success, NULL on failure.
5556 struct ata_host *host;
5563 host = kzalloc(sz, GFP_KERNEL);
5564 if (!host)
5575 dev_set_drvdata(dev, host);
5577 spin_lock_init(&host->lock);
5578 mutex_init(&host->eh_mutex);
5579 host->dev = dev;
5580 host->n_ports = max_ports;
5581 kref_init(&host->kref);
5583 /* allocate ports bound to this host */
5587 ap = ata_port_alloc(host);
5592 host->ports[i] = ap;
5596 return host;
5601 kfree(host);
5607 * ata_host_alloc_pinfo - alloc host and init with port_info array
5608 * @dev: generic device this host is associated with
5609 * @ppi: array of ATA port_info to initialize host with
5610 * @n_ports: number of ATA ports attached to this host
5612 * Allocate ATA host and initialize with info from @ppi. If NULL
5617 * Allocate ATA host on success, NULL on failure.
5627 struct ata_host *host;
5630 host = ata_host_alloc(dev, n_ports);
5631 if (!host)
5634 for (i = 0, j = 0; i < host->n_ports; i++) {
5635 struct ata_port *ap = host->ports[i];
5647 if (!host->ops && (pi->port_ops != &ata_dummy_port_ops))
5648 host->ops = pi->port_ops;
5651 return host;
5657 struct ata_host *host = dev_get_drvdata(gendev);
5660 WARN_ON(!(host->flags & ATA_HOST_STARTED));
5662 for (i = 0; i < host->n_ports; i++) {
5663 struct ata_port *ap = host->ports[i];
5669 if (host->ops->host_stop)
5670 host->ops->host_stop(host);
5682 * Ops tables are finalized when the host is started. NULL or
5724 * ata_host_start - start and freeze ports of an ATA host
5725 * @host: ATA host to start ports for
5727 * Start and then freeze ports of @host. Started status is
5728 * recorded in host->flags, so this function can be called
5730 * once. If host->ops is not initialized yet, it is set to the
5739 int ata_host_start(struct ata_host *host)
5745 if (host->flags & ATA_HOST_STARTED)
5748 ata_finalize_port_ops(host->ops);
5750 for (i = 0; i < host->n_ports; i++) {
5751 struct ata_port *ap = host->ports[i];
5755 if (!host->ops && !ata_port_is_dummy(ap))
5756 host->ops = ap->ops;
5762 if (host->ops && host->ops->host_stop)
5771 for (i = 0; i < host->n_ports; i++) {
5772 struct ata_port *ap = host->ports[i];
5778 dev_err(host->dev,
5788 devres_add(host->dev, start_dr);
5789 host->flags |= ATA_HOST_STARTED;
5794 struct ata_port *ap = host->ports[i];
5805 * ata_host_init - Initialize a host struct for sas (ipr, libsas)
5806 * @host: host to initialize
5807 * @dev: device host is attached to
5811 void ata_host_init(struct ata_host *host, struct device *dev,
5814 spin_lock_init(&host->lock);
5815 mutex_init(&host->eh_mutex);
5816 host->n_tags = ATA_MAX_QUEUE;
5817 host->dev = dev;
5818 host->ops = ops;
5819 kref_init(&host->kref);
5848 * If we're not allowed to scan this host in parallel,
5854 if (!(ap->host->flags & ATA_HOST_PARALLEL_SCAN) && ap->port_no != 0)
5867 * ata_host_register - register initialized ATA host
5868 * @host: ATA host to register
5869 * @sht: template for SCSI host
5871 * Register initialized ATA host. @host is allocated using
5873 * starts ports, registers @host with ATA and SCSI layers and
5882 int ata_host_register(struct ata_host *host, const struct scsi_host_template *sht)
5886 host->n_tags = clamp(sht->can_queue, 1, ATA_MAX_QUEUE);
5888 /* host must have been started */
5889 if (!(host->flags & ATA_HOST_STARTED)) {
5890 dev_err(host->dev, "BUG: trying to register unstarted host\n");
5899 for (i = host->n_ports; host->ports[i]; i++)
5900 kfree(host->ports[i]);
5903 for (i = 0; i < host->n_ports; i++) {
5904 host->ports[i]->print_id = atomic_inc_return(&ata_print_id);
5905 host->ports[i]->local_port_no = i + 1;
5909 for (i = 0; i < host->n_ports; i++) {
5910 rc = ata_tport_add(host->dev,host->ports[i]);
5916 rc = ata_scsi_add_hosts(host, sht);
5921 for (i = 0; i < host->n_ports; i++) {
5922 struct ata_port *ap = host->ports[i];
5949 for (i = 0; i < host->n_ports; i++) {
5950 struct ata_port *ap = host->ports[i];
5958 ata_tport_delete(host->ports[i]);
5966 * ata_host_activate - start host, request IRQ and register it
5967 * @host: target ATA host
5971 * @sht: scsi_host_template to use when registering the host
5973 * After allocating an ATA host and initializing it, most libata
5974 * LLDs perform three steps to activate the host - start host,
5978 * An invalid IRQ skips the IRQ registration and expects the host to
5988 int ata_host_activate(struct ata_host *host, int irq,
5995 rc = ata_host_start(host);
6002 return ata_host_register(host, sht);
6005 irq_desc = devm_kasprintf(host->dev, GFP_KERNEL, "%s[%s]",
6006 dev_driver_string(host->dev),
6007 dev_name(host->dev));
6011 rc = devm_request_irq(host->dev, irq, irq_handler, irq_flags,
6012 irq_desc, host);
6016 for (i = 0; i < host->n_ports; i++)
6017 ata_port_desc_misc(host->ports[i], irq);
6019 rc = ata_host_register(host, sht);
6022 devm_free_irq(host->dev, irq, host);
6033 * then, remove the associated SCSI host. @ap is guaranteed to
6094 /* remove the associated SCSI host */
6100 * ata_host_detach - Detach all ports of an ATA host
6101 * @host: Host to detach
6103 * Detach all ports of @host.
6108 void ata_host_detach(struct ata_host *host)
6112 for (i = 0; i < host->n_ports; i++)
6113 ata_port_detach(host->ports[i]);
6115 /* the host is dead now, dissociate ACPI */
6116 ata_acpi_dissociate(host);
6135 struct ata_host *host = pci_get_drvdata(pdev);
6137 ata_host_detach(host);
6143 struct ata_host *host = pci_get_drvdata(pdev);
6146 for (i = 0; i < host->n_ports; i++) {
6147 struct ata_port *ap = host->ports[i];
6229 struct ata_host *host = pci_get_drvdata(pdev);
6231 ata_host_suspend(host, mesg);
6241 struct ata_host *host = pci_get_drvdata(pdev);
6246 ata_host_resume(host);
6266 struct ata_host *host = platform_get_drvdata(pdev);
6268 ata_host_detach(host);
6564 * @ap->host will be allowed to own the EH while this task is
6572 bool owns_eh = ap && ap->host->eh_owner == current;