From: Jeff Garzik <jgarzik@pobox.com>
To: brking@us.ibm.com
Cc: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>,
linux-ide@vger.kernel.org, linux-scsi@vger.kernel.org
Subject: Re: [PATCH 2/2] libata: Add support for SATA attachment to SAS adapters
Date: Tue, 25 Oct 2005 13:58:44 -0400 [thread overview]
Message-ID: <435E7254.4070809@pobox.com> (raw)
In-Reply-To: <435D5E32.4080902@us.ibm.com>
Brian King wrote:
> +/**
> + * ata_sas_port_alloc - Allocate port for a SAS attached SATA device
> + * @pdev: PCI device that the scsi device is attached to
> + * @port_info: Information from low-level host driver
> + *
> + * LOCKING:
> + * PCI/etc. bus probe sem.
> + *
> + * RETURNS:
> + * ata_port pointer on success / NULL on failure.
> + */
> +
> +struct ata_port *ata_sas_port_alloc(struct pci_dev *pdev,
> + struct ata_port_info *port_info)
> +{
> + struct ata_port *ap = kzalloc(sizeof(*ap), GFP_KERNEL);
> +
> + if (!ap)
> + return NULL;
> +
> + ap->dev = &pdev->dev;
> + ap->ops = port_info->port_ops;
> + ap->flags = port_info->host_flags;
> + ap->pio_mask = port_info->pio_mask;
> + ap->mwdma_mask = port_info->mwdma_mask;
> + ap->udma_mask = port_info->udma_mask;
> + ap->cbl = ATA_CBL_SATA;
> + ap->active_tag = ATA_TAG_POISON;
> + ap->last_ctl = 0xFF;
> + return ap;
> +}
> +EXPORT_SYMBOL_GPL(ata_sas_port_alloc);
> +
> +static void ata_sas_port_free(struct ata_port *ap)
> +{
> + kfree(ap);
> +}
> +
> +/**
> + * ata_sas_port_init - Initialize a SATA device
> + * @ap: SATA port to initialize
> + *
> + * LOCKING:
> + * PCI/etc. bus probe sem.
> + *
> + * RETURNS:
> + * Zero on success, non-zero on error.
> + */
> +
> +int ata_sas_port_init(struct ata_port *ap)
> +{
> + int rc = ap->ops->port_start(ap);
> +
> + if (!rc)
> + rc = ata_bus_probe(ap);
> +
> + return rc;
> +}
> +EXPORT_SYMBOL_GPL(ata_sas_port_init);
> +
> +/**
> + * ata_sas_port_destroy - Destroy a SATA port allocated by ata_sas_port_alloc
> + * @ap: SATA port to destroy
> + *
> + */
> +
> +void ata_sas_port_destroy(struct ata_port *ap)
> +{
> + if (ap) {
> + ap->ops->port_stop(ap);
> + ata_sas_port_free(ap);
> + }
> +}
> +EXPORT_SYMBOL_GPL(ata_sas_port_destroy);
> +
> +/**
> + * ata_sas_slave_configure - Default slave_config routine for libata devices
> + * @sdev: SCSI device to configure
> + * @ap: ATA port to which SCSI device is attached
> + *
> + * RETURNS:
> + * Zero.
> + */
> +
> +int ata_sas_slave_configure(struct scsi_device *sdev, struct ata_port *ap)
> +{
> + ata_scsi_sdev_config(sdev);
> + ata_scsi_dev_config(sdev, ap->device);
> + if (ata_dev_knobble(ap))
> + blk_queue_max_sectors(sdev->request_queue, ATA_MAX_SECTORS);
> + return 0;
> +}
> +EXPORT_SYMBOL_GPL(ata_sas_slave_configure);
> +
> +/**
> + * ata_sas_queuecmd - Issue SCSI cdb to libata-managed device
> + * @cmd: SCSI command to be sent
> + * @done: Completion function, called when command is complete
> + * @ap: ATA port to which the command is being sent
> + *
> + * RETURNS:
> + * Zero.
> + */
> +
> +int ata_sas_queuecmd(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *),
> + struct ata_port *ap)
> +{
> + if (unlikely(!ata_dev_present(ap->device))) {
> + cmd->result = (DID_BAD_TARGET << 16);
> + done(cmd);
> + return 0;
> + }
> +
> + if (cmd->cmd_len > ap->cdb_len) {
> + cmd->result = (DID_ABORT << 16);
> + done(cmd);
> + return 0;
> + }
> +
> + __ata_scsi_queuecmd(cmd, done, ap, ap->device);
> + return 0;
> +}
I'm still thinking about these functions, so it would be nice to split
them up into a third patch. That would allow me to apply the other
cleanups in this patch.
Jeff
next prev parent reply other threads:[~2005-10-25 17:58 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-10-03 21:56 [RFC 0/2] libata: support SATA devices on SAS HBAs Brian King
2005-10-03 21:58 ` [RFC 1/2] libata: configurable host_set lock Brian King
2005-10-03 21:58 ` [RFC 2/2] libata: support SATA devices on SAS HBAs Brian King
2005-10-04 9:56 ` [RFC 0/2] " Jeff Garzik
2005-10-04 10:22 ` Bartlomiej Zolnierkiewicz
2005-10-04 20:56 ` Bartlomiej Zolnierkiewicz
2005-10-05 20:59 ` Jeff Garzik
2005-10-24 22:17 ` [PATCH " Brian King
2005-10-24 22:19 ` [PATCH 1/2] libata: Remove dependence on host_set->dev for SAS Brian King
2005-10-25 17:53 ` Jeff Garzik
2005-10-25 19:30 ` Brian King
2005-10-25 19:43 ` Jeff Garzik
2005-10-25 22:48 ` Luben Tuikov
2005-10-27 16:05 ` Brian King
2005-10-27 20:15 ` Luben Tuikov
2005-11-24 0:53 ` Douglas Gilbert
2005-11-24 1:07 ` Jeff Garzik
2005-11-24 8:12 ` Bartlomiej Zolnierkiewicz
2005-12-02 2:05 ` Jeff Garzik
2005-12-02 8:07 ` Bartlomiej Zolnierkiewicz
2005-12-02 10:28 ` Douglas Gilbert
2005-12-02 10:48 ` Jeff Garzik
2005-11-29 22:13 ` Brian King
2005-10-24 22:20 ` [PATCH 2/2] libata: Add support for SATA attachment to SAS adapters Brian King
2005-10-25 17:58 ` Jeff Garzik [this message]
2005-10-25 12:59 ` [PATCH 0/2] libata: support SATA devices on SAS HBAs Luben Tuikov
2005-10-25 13:39 ` Brian King
2005-10-25 13:40 ` Luben Tuikov
2005-10-25 13:53 ` Brian King
2005-10-25 14:08 ` Luben Tuikov
2005-10-25 14:27 ` Brian King
2005-10-25 17:51 ` Jeff Garzik
2005-10-25 17:57 ` [RFC " Brian King
2005-10-25 18:07 ` Jeff Garzik
-- strict thread matches above, loose matches on Subject: below --
2006-07-13 13:35 [PATCH 2/2] libata: Add support for SATA attachment to SAS adapters Brian King
2006-07-20 14:17 ` Brian King
2006-07-28 14:01 ` Brian King
2006-08-03 21:25 ` Jeff Garzik
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=435E7254.4070809@pobox.com \
--to=jgarzik@pobox.com \
--cc=brking@us.ibm.com \
--cc=bzolnier@gmail.com \
--cc=linux-ide@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).