···5858 </para>5959 </chapter>60606161- <chapter id="libataThanks">6262- <title>Thanks</title>6363- <para>6464- The bulk of the ATA knowledge comes thanks to long conversations with6565- Andre Hedrick (www.linux-ide.org), and long hours pondering the ATA6666- and SCSI specifications.6767- </para>6868- <para>6969- Thanks to Alan Cox for pointing out similarities 7070- between SATA and SCSI, and in general for motivation to hack on7171- libata.7272- </para>7373- <para>7474- libata's device detection7575- method, ata_pio_devchk, and in general all the early probing was7676- based on extensive study of Hale Landis's probe/reset code in his7777- ATADRVR driver (www.ata-atapi.com).7878- </para>7979- </chapter>8080-8161 <chapter id="libataDriverApi">8262 <title>libata Driver API</title>8363 <sect1>···292312 <chapter id="SILInt">293313 <title>sata_sil Internals</title>294314!Idrivers/scsi/sata_sil.c315315+ </chapter>316316+317317+ <chapter id="libataThanks">318318+ <title>Thanks</title>319319+ <para>320320+ The bulk of the ATA knowledge comes thanks to long conversations with321321+ Andre Hedrick (www.linux-ide.org), and long hours pondering the ATA322322+ and SCSI specifications.323323+ </para>324324+ <para>325325+ Thanks to Alan Cox for pointing out similarities 326326+ between SATA and SCSI, and in general for motivation to hack on327327+ libata.328328+ </para>329329+ <para>330330+ libata's device detection331331+ method, ata_pio_devchk, and in general all the early probing was332332+ based on extensive study of Hale Landis's probe/reset code in his333333+ ATADRVR driver (www.ata-atapi.com).334334+ </para>295335 </chapter>296336297337</book>
···11901190 * ata_bus_probe - Reset and probe ATA bus11911191 * @ap: Bus to probe11921192 *11931193+ * Master ATA bus probing function. Initiates a hardware-dependent11941194+ * bus reset, then attempts to identify any devices found on11951195+ * the bus.11961196+ *11931197 * LOCKING:11981198+ * PCI/etc. bus probe sem.11941199 *11951200 * RETURNS:11961201 * Zero on success, non-zero on error.···12341229}1235123012361231/**12371237- * ata_port_probe -12381238- * @ap:12321232+ * ata_port_probe - Mark port as enabled12331233+ * @ap: Port for which we indicate enablement12391234 *12401240- * LOCKING:12351235+ * Modify @ap data structure such that the system12361236+ * thinks that the entire port is enabled.12371237+ *12381238+ * LOCKING: host_set lock, or some other form of12391239+ * serialization.12411240 */1242124112431242void ata_port_probe(struct ata_port *ap)···12571248 * PHY registers, to wake up the phy (and device), and12581249 * clear any reset condition.12591250 *12601260- * LOCKING: None. Serialized during ata_bus_probe().12511251+ * LOCKING:12521252+ * PCI/etc. bus probe sem.12611253 *12621254 */12631255void __sata_phy_reset(struct ata_port *ap)···13091299 * This function resets the SATA bus, and then probes13101300 * the bus for devices.13111301 *13121312- * LOCKING: None. Serialized during ata_bus_probe().13021302+ * LOCKING:13031303+ * PCI/etc. bus probe sem.13131304 *13141305 */13151306void sata_phy_reset(struct ata_port *ap)···14421431 *14431432 * Set ATA device disk transfer mode (PIO3, UDMA6, etc.).14441433 *14451445- * LOCKING: None. Serialized during ata_bus_probe().14341434+ * LOCKING:14351435+ * PCI/etc. bus probe sem.14461436 *14471437 */14481438static void ata_set_mode(struct ata_port *ap)···15831571}1584157215851573/**15861586- * ata_bus_edd -15871587- * @ap:15741574+ * ata_bus_edd - Issue EXECUTE DEVICE DIAGNOSTIC command.15751575+ * @ap: Port to reset and probe15881576 *15891589- * LOCKING: None. Serialized during ata_bus_probe().15771577+ * Use the EXECUTE DEVICE DIAGNOSTIC command to reset and15781578+ * probe the bus. Not often used these days.15791579+ *15801580+ * LOCKING:15811581+ * PCI/etc. bus probe sem.15901582 *15911583 */15921584···16671651 * the device is ATA or ATAPI.16681652 *16691653 * LOCKING:16701670- * Inherited from caller. Some functions called by this function16711671- * obtain the host_set lock.16541654+ * PCI/etc. bus probe sem.16551655+ * Obtains host_set lock.16721656 *16731657 * SIDE EFFECTS:16741658 * Sets ATA_FLAG_PORT_DISABLED if bus reset fails.···19101894 * @xfer_mode_out: (output) SET FEATURES - XFER MODE code19111895 * @xfer_shift_out: (output) bit shift that selects this mode19121896 *18971897+ * Based on host and device capabilities, determine the18981898+ * maximum transfer mode that is amenable to all.18991899+ *19131900 * LOCKING:19011901+ * PCI/etc. bus probe sem.19141902 *19151903 * RETURNS:19161904 * Zero on success, negative on error.···19501930 * Issue SET FEATURES - XFER MODE command to device @dev19511931 * on port @ap.19521932 *19531953- * LOCKING: None. Serialized during ata_bus_probe().19331933+ * LOCKING:19341934+ * PCI/etc. bus probe sem.19541935 */1955193619561937static void ata_dev_set_xfermode(struct ata_port *ap, struct ata_device *dev)···19891968}1990196919911970/**19921992- * ata_sg_clean -19931993- * @qc:19711971+ * ata_sg_clean - Unmap DMA memory associated with command19721972+ * @qc: Command containing DMA memory to be released19731973+ *19741974+ * Unmap all mapped DMA memory associated with this command.19941975 *19951976 * LOCKING:19771977+ * spin_lock_irqsave(host_set lock)19961978 */1997197919981980static void ata_sg_clean(struct ata_queued_cmd *qc)···20822058 * supplied PACKET command.20832059 *20842060 * LOCKING:20612061+ * spin_lock_irqsave(host_set lock)20622062+ *20852063 * RETURNS: 0 when ATAPI DMA can be used20862064 * nonzero otherwise20872065 */···21142088 ata_fill_sg(qc);21152089}2116209020912091+/**20922092+ * ata_sg_init_one - Associate command with memory buffer20932093+ * @qc: Command to be associated20942094+ * @buf: Memory buffer20952095+ * @buflen: Length of memory buffer, in bytes.20962096+ *20972097+ * Initialize the data-related elements of queued_cmd @qc20982098+ * to point to a single memory buffer, @buf of byte length @buflen.20992099+ *21002100+ * LOCKING:21012101+ * spin_lock_irqsave(host_set lock)21022102+ */21032103+21172104void ata_sg_init_one(struct ata_queued_cmd *qc, void *buf, unsigned int buflen)21182105{21192106 struct scatterlist *sg;···21442105 sg->length = buflen;21452106}2146210721082108+/**21092109+ * ata_sg_init - Associate command with scatter-gather table.21102110+ * @qc: Command to be associated21112111+ * @sg: Scatter-gather table.21122112+ * @n_elem: Number of elements in s/g table.21132113+ *21142114+ * Initialize the data-related elements of queued_cmd @qc21152115+ * to point to a scatter-gather table @sg, containing @n_elem21162116+ * elements.21172117+ *21182118+ * LOCKING:21192119+ * spin_lock_irqsave(host_set lock)21202120+ */21212121+21472122void ata_sg_init(struct ata_queued_cmd *qc, struct scatterlist *sg,21482123 unsigned int n_elem)21492124{···21672114}2168211521692116/**21702170- * ata_sg_setup_one -21712171- * @qc:21172117+ * ata_sg_setup_one - DMA-map the memory buffer associated with a command.21182118+ * @qc: Command with memory buffer to be mapped.21192119+ *21202120+ * DMA-map the memory buffer associated with queued_cmd @qc.21722121 *21732122 * LOCKING:21742123 * spin_lock_irqsave(host_set lock)21752124 *21762125 * RETURNS:21772177- *21262126+ * Zero on success, negative on error.21782127 */2179212821802129static int ata_sg_setup_one(struct ata_queued_cmd *qc)···22012146}2202214722032148/**22042204- * ata_sg_setup -22052205- * @qc:21492149+ * ata_sg_setup - DMA-map the scatter-gather table associated with a command.21502150+ * @qc: Command with scatter-gather table to be mapped.21512151+ *21522152+ * DMA-map the scatter-gather table associated with queued_cmd @qc.22062153 *22072154 * LOCKING:22082155 * spin_lock_irqsave(host_set lock)22092156 *22102157 * RETURNS:21582158+ * Zero on success, negative on error.22112159 *22122160 */22132161···22402182 * @ap:22412183 *22422184 * LOCKING:21852185+ * None. (executing in kernel thread context)22432186 *22442187 * RETURNS:22452188 *···22882229 * @ap:22892230 *22902231 * LOCKING:22322232+ * None. (executing in kernel thread context)22912233 */2292223422932235static void ata_pio_complete (struct ata_port *ap)···25062446 * @ap:25072447 *25082448 * LOCKING:24492449+ * None. (executing in kernel thread context)25092450 */2510245125112452static void ata_pio_block(struct ata_port *ap)···26752614 * transaction completed successfully.26762615 *26772616 * LOCKING:26172617+ * Inherited from SCSI layer (none, can sleep)26782618 */2679261926802620static void ata_qc_timeout(struct ata_queued_cmd *qc)···27852723 * @dev: Device from whom we request an available command structure27862724 *27872725 * LOCKING:27262726+ * None.27882727 */2789272827902729static struct ata_queued_cmd *ata_qc_new(struct ata_port *ap)···28112748 * @dev: Device from whom we request an available command structure28122749 *28132750 * LOCKING:27512751+ * None.28142752 */2815275328162754struct ata_queued_cmd *ata_qc_new_init(struct ata_port *ap,···28762812 * in case something prevents using it.28772813 *28782814 * LOCKING:28152815+ * spin_lock_irqsave(host_set lock)28792816 *28802817 */28812818void ata_qc_free(struct ata_queued_cmd *qc)···28902825/**28912826 * ata_qc_complete - Complete an active ATA command28922827 * @qc: Command to complete28932893- * @drv_stat: ATA status register contents28282828+ * @drv_stat: ATA Status register contents28292829+ *28302830+ * Indicate to the mid and upper layers that an ATA28312831+ * command has completed, with either an ok or not-ok status.28942832 *28952833 * LOCKING:28342834+ * spin_lock_irqsave(host_set lock)28962835 *28972836 */28982837···3303323433043235/**33053236 * ata_interrupt - Default ATA host interrupt handler33063306- * @irq: irq line33073307- * @dev_instance: pointer to our host information structure32373237+ * @irq: irq line (unused)32383238+ * @dev_instance: pointer to our ata_host_set information structure33083239 * @regs: unused33093240 *32413241+ * Default interrupt handler for PCI IDE devices. Calls32423242+ * ata_host_intr() for each port that is not disabled.32433243+ *33103244 * LOCKING:32453245+ * Obtains host_set lock during operation.33113246 *33123247 * RETURNS:32483248+ * IRQ_NONE or IRQ_HANDLED.33133249 *33143250 */33153251···34553381 * @ent: Probe information provided by low-level driver34563382 * @port_no: Port number associated with this ata_port34573383 *33843384+ * Initialize a new ata_port structure, and its associated33853385+ * scsi_host.33863386+ *34583387 * LOCKING:33883388+ * Inherited from caller.34593389 *34603390 */34613391···35143436 * @host_set: Collections of ports to which we add35153437 * @port_no: Port number associated with this host35163438 *34393439+ * Attach low-level ATA driver to system.34403440+ *35173441 * LOCKING:34423442+ * PCI/etc. bus probe sem.35183443 *35193444 * RETURNS:34453445+ * New ata_port on success, for NULL on error.35203446 *35213447 */35223448···35533471}3554347235553473/**35563556- * ata_device_add -35573557- * @ent:34743474+ * ata_device_add - Register hardware device with ATA and SCSI layers34753475+ * @ent: Probe information describing hardware device to be registered34763476+ *34773477+ * This function processes the information provided in the probe34783478+ * information struct @ent, allocates the necessary ATA and SCSI34793479+ * host information structures, initializes them, and registers34803480+ * everything with requisite kernel subsystems.34813481+ *34823482+ * This function requests irqs, probes the ATA bus, and probes34833483+ * the SCSI bus.35583484 *35593485 * LOCKING:34863486+ * PCI/etc. bus probe sem.35603487 *35613488 * RETURNS:34893489+ * Number of ports registered. Zero on error (no ports registered).35623490 *35633491 */35643492···38473755 * Inherited from PCI layer (may sleep).38483756 *38493757 * RETURNS:37583758+ * Zero on success, negative on errno-based value on error.38503759 *38513760 */38523761···40663973}40673974#endif /* CONFIG_PCI */4068397540694069-40704070-/**40714071- * ata_init -40724072- *40734073- * LOCKING:40744074- *40754075- * RETURNS:40764076- *40774077- */4078397640793977static int __init ata_init(void)40803978{
+1-1
drivers/scsi/libata-scsi.c
···947947}948948949949/**950950- * ata_scsiop_noop -950950+ * ata_scsiop_noop - Command handler that simply returns success.951951 * @args: device IDENTIFY data / SCSI command of interest.952952 * @rbuf: Response buffer, to which simulated SCSI cmd output is sent.953953 * @buflen: Response buffer length.