libata: update inline source docs

authored by

Edward Falk and committed by
Jeff Garzik
0baab86b 92bab26b

+334 -7
+276 -7
drivers/scsi/libata-core.c
··· 186 ata_wait_idle(ap); 187 } 188 189 void ata_tf_load(struct ata_port *ap, struct ata_taskfile *tf) 190 { 191 if (ap->flags & ATA_FLAG_MMIO) ··· 217 } 218 219 /** 220 - * ata_exec_command - issue ATA command to host controller 221 * @ap: port to which command is being issued 222 * @tf: ATA taskfile register set 223 * 224 - * Issues PIO/MMIO write to ATA command register, with proper 225 * synchronization with interrupt handler / other threads. 226 * 227 * LOCKING: ··· 257 ata_pause(ap); 258 } 259 260 void ata_exec_command(struct ata_port *ap, struct ata_taskfile *tf) 261 { 262 if (ap->flags & ATA_FLAG_MMIO) ··· 339 } 340 341 /** 342 - * ata_tf_read - input device's ATA taskfile shadow registers 343 * @ap: Port from which input is read 344 * @tf: ATA taskfile register set for storing input 345 * ··· 402 } 403 } 404 405 void ata_tf_read(struct ata_port *ap, struct ata_taskfile *tf) 406 { 407 if (ap->flags & ATA_FLAG_MMIO) ··· 432 * @ap: port where the device is 433 * 434 * Reads ATA taskfile status register for currently-selected device 435 - * and return it's value. This also clears pending interrupts 436 * from this device 437 * 438 * LOCKING: ··· 448 * @ap: port where the device is 449 * 450 * Reads ATA taskfile status register for currently-selected device 451 - * via MMIO and return it's value. This also clears pending interrupts 452 * from this device 453 * 454 * LOCKING: ··· 459 return readb((void __iomem *) ap->ioaddr.status_addr); 460 } 461 462 u8 ata_check_status(struct ata_port *ap) 463 { 464 if (ap->flags & ATA_FLAG_MMIO) ··· 480 return ata_check_status_pio(ap); 481 } 482 483 u8 ata_altstatus(struct ata_port *ap) 484 { 485 if (ap->ops->check_altstatus) ··· 504 return inb(ap->ioaddr.altstatus_addr); 505 } 506 507 u8 ata_chk_err(struct ata_port *ap) 508 { 509 if (ap->ops->check_err) ··· 966 } 967 } 968 969 void ata_noop_dev_select (struct ata_port *ap, unsigned int device) 970 { 971 } 972 973 /** 974 * ata_std_dev_select - Select device 0/1 on ATA bus ··· 991 * 992 * Use the method defined in the ATA specification to 993 * make either device 0, or device 1, active on the 994 - * ATA channel. 995 * 996 * LOCKING: 997 * caller. ··· 2236 * spin_lock_irqsave(host_set lock) 2237 */ 2238 2239 void ata_sg_init_one(struct ata_queued_cmd *qc, void *buf, unsigned int buflen) 2240 { 2241 struct scatterlist *sg; ··· 2278 * 2279 * LOCKING: 2280 * spin_lock_irqsave(host_set lock) 2281 */ 2282 2283 void ata_sg_init(struct ata_queued_cmd *qc, struct scatterlist *sg, ··· 2465 ata_qc_complete(qc, drv_stat); 2466 } 2467 2468 void swap_buf_le16(u16 *buf, unsigned int buf_words) 2469 { 2470 #ifdef __BIG_ENDIAN ··· 3138 return -1; 3139 } 3140 3141 /** 3142 * ata_qc_issue_prot - issue taskfile to device in proto-dependent manner 3143 * @qc: command to issue to device ··· 3147 * starts an ATA command. ATA commands are grouped into 3148 * classes called "protocols", and issuing each type of protocol 3149 * is slightly different. 3150 * 3151 * LOCKING: 3152 * spin_lock_irqsave(host_set lock) ··· 3207 } 3208 3209 /** 3210 - * ata_bmdma_setup - Set up PCI IDE BMDMA transaction 3211 * @qc: Info associated with this ATA transaction. 3212 * 3213 * LOCKING: ··· 3314 ap->ioaddr.bmdma_addr + ATA_DMA_CMD); 3315 } 3316 3317 void ata_bmdma_start(struct ata_queued_cmd *qc) 3318 { 3319 if (qc->ap->flags & ATA_FLAG_MMIO) ··· 3334 ata_bmdma_start_pio(qc); 3335 } 3336 3337 void ata_bmdma_setup(struct ata_queued_cmd *qc) 3338 { 3339 if (qc->ap->flags & ATA_FLAG_MMIO) ··· 3355 else 3356 ata_bmdma_setup_pio(qc); 3357 } 3358 3359 void ata_bmdma_irq_clear(struct ata_port *ap) 3360 { ··· 3381 3382 } 3383 3384 u8 ata_bmdma_status(struct ata_port *ap) 3385 { 3386 u8 host_stat; ··· 3404 host_stat = inb(ap->ioaddr.bmdma_addr + ATA_DMA_STATUS); 3405 return host_stat; 3406 } 3407 3408 void ata_bmdma_stop(struct ata_port *ap) 3409 { ··· 3621 ata_qc_complete(qc, ATA_ERR); 3622 } 3623 3624 int ata_port_start (struct ata_port *ap) 3625 { 3626 struct device *dev = ap->host_set->dev; ··· 3646 3647 return 0; 3648 } 3649 3650 void ata_port_stop (struct ata_port *ap) 3651 { ··· 3959 /** 3960 * ata_std_ports - initialize ioaddr with standard port offsets. 3961 * @ioaddr: IO address structure to be initialized 3962 */ 3963 void ata_std_ports(struct ata_ioports *ioaddr) 3964 { 3965 ioaddr->data_addr = ioaddr->cmd_addr + ATA_REG_DATA; ··· 4008 4009 return probe_ent; 4010 } 4011 4012 #ifdef CONFIG_PCI 4013 struct ata_probe_ent * ··· 4103 * @pdev: Controller to be initialized 4104 * @port_info: Information from low-level host driver 4105 * @n_ports: Number of ports attached to host controller 4106 * 4107 * LOCKING: 4108 * Inherited from PCI layer (may sleep).
··· 186 ata_wait_idle(ap); 187 } 188 189 + 190 + /** 191 + * ata_tf_load - send taskfile registers to host controller 192 + * @ap: Port to which output is sent 193 + * @tf: ATA taskfile register set 194 + * 195 + * Outputs ATA taskfile to standard ATA host controller using MMIO 196 + * or PIO as indicated by the ATA_FLAG_MMIO flag. 197 + * Writes the control, feature, nsect, lbal, lbam, and lbah registers. 198 + * Optionally (ATA_TFLAG_LBA48) writes hob_feature, hob_nsect, 199 + * hob_lbal, hob_lbam, and hob_lbah. 200 + * 201 + * This function waits for idle (!BUSY and !DRQ) after writing 202 + * registers. If the control register has a new value, this 203 + * function also waits for idle after writing control and before 204 + * writing the remaining registers. 205 + * 206 + * May be used as the tf_load() entry in ata_port_operations. 207 + * 208 + * LOCKING: 209 + * Inherited from caller. 210 + */ 211 void ata_tf_load(struct ata_port *ap, struct ata_taskfile *tf) 212 { 213 if (ap->flags & ATA_FLAG_MMIO) ··· 195 } 196 197 /** 198 + * ata_exec_command_pio - issue ATA command to host controller 199 * @ap: port to which command is being issued 200 * @tf: ATA taskfile register set 201 * 202 + * Issues PIO write to ATA command register, with proper 203 * synchronization with interrupt handler / other threads. 204 * 205 * LOCKING: ··· 235 ata_pause(ap); 236 } 237 238 + 239 + /** 240 + * ata_exec_command - issue ATA command to host controller 241 + * @ap: port to which command is being issued 242 + * @tf: ATA taskfile register set 243 + * 244 + * Issues PIO/MMIO write to ATA command register, with proper 245 + * synchronization with interrupt handler / other threads. 246 + * 247 + * LOCKING: 248 + * spin_lock_irqsave(host_set lock) 249 + */ 250 void ata_exec_command(struct ata_port *ap, struct ata_taskfile *tf) 251 { 252 if (ap->flags & ATA_FLAG_MMIO) ··· 305 } 306 307 /** 308 + * ata_tf_read_pio - input device's ATA taskfile shadow registers 309 * @ap: Port from which input is read 310 * @tf: ATA taskfile register set for storing input 311 * ··· 368 } 369 } 370 371 + 372 + /** 373 + * ata_tf_read - input device's ATA taskfile shadow registers 374 + * @ap: Port from which input is read 375 + * @tf: ATA taskfile register set for storing input 376 + * 377 + * Reads ATA taskfile registers for currently-selected device 378 + * into @tf. 379 + * 380 + * Reads nsect, lbal, lbam, lbah, and device. If ATA_TFLAG_LBA48 381 + * is set, also reads the hob registers. 382 + * 383 + * May be used as the tf_read() entry in ata_port_operations. 384 + * 385 + * LOCKING: 386 + * Inherited from caller. 387 + */ 388 void ata_tf_read(struct ata_port *ap, struct ata_taskfile *tf) 389 { 390 if (ap->flags & ATA_FLAG_MMIO) ··· 381 * @ap: port where the device is 382 * 383 * Reads ATA taskfile status register for currently-selected device 384 + * and return its value. This also clears pending interrupts 385 * from this device 386 * 387 * LOCKING: ··· 397 * @ap: port where the device is 398 * 399 * Reads ATA taskfile status register for currently-selected device 400 + * via MMIO and return its value. This also clears pending interrupts 401 * from this device 402 * 403 * LOCKING: ··· 408 return readb((void __iomem *) ap->ioaddr.status_addr); 409 } 410 411 + 412 + /** 413 + * ata_check_status - Read device status reg & clear interrupt 414 + * @ap: port where the device is 415 + * 416 + * Reads ATA taskfile status register for currently-selected device 417 + * and return its value. This also clears pending interrupts 418 + * from this device 419 + * 420 + * May be used as the check_status() entry in ata_port_operations. 421 + * 422 + * LOCKING: 423 + * Inherited from caller. 424 + */ 425 u8 ata_check_status(struct ata_port *ap) 426 { 427 if (ap->flags & ATA_FLAG_MMIO) ··· 415 return ata_check_status_pio(ap); 416 } 417 418 + 419 + /** 420 + * ata_altstatus - Read device alternate status reg 421 + * @ap: port where the device is 422 + * 423 + * Reads ATA taskfile alternate status register for 424 + * currently-selected device and return its value. 425 + * 426 + * Note: may NOT be used as the check_altstatus() entry in 427 + * ata_port_operations. 428 + * 429 + * LOCKING: 430 + * Inherited from caller. 431 + */ 432 u8 ata_altstatus(struct ata_port *ap) 433 { 434 if (ap->ops->check_altstatus) ··· 425 return inb(ap->ioaddr.altstatus_addr); 426 } 427 428 + 429 + /** 430 + * ata_chk_err - Read device error reg 431 + * @ap: port where the device is 432 + * 433 + * Reads ATA taskfile error register for 434 + * currently-selected device and return its value. 435 + * 436 + * Note: may NOT be used as the check_err() entry in 437 + * ata_port_operations. 438 + * 439 + * LOCKING: 440 + * Inherited from caller. 441 + */ 442 u8 ata_chk_err(struct ata_port *ap) 443 { 444 if (ap->ops->check_err) ··· 873 } 874 } 875 876 + 877 + /** 878 + * ata_noop_dev_select - Select device 0/1 on ATA bus 879 + * @ap: ATA channel to manipulate 880 + * @device: ATA device (numbered from zero) to select 881 + * 882 + * This function performs no actual function. 883 + * 884 + * May be used as the dev_select() entry in ata_port_operations. 885 + * 886 + * LOCKING: 887 + * caller. 888 + */ 889 void ata_noop_dev_select (struct ata_port *ap, unsigned int device) 890 { 891 } 892 + 893 894 /** 895 * ata_std_dev_select - Select device 0/1 on ATA bus ··· 884 * 885 * Use the method defined in the ATA specification to 886 * make either device 0, or device 1, active on the 887 + * ATA channel. Works with both PIO and MMIO. 888 + * 889 + * May be used as the dev_select() entry in ata_port_operations. 890 * 891 * LOCKING: 892 * caller. ··· 2127 * spin_lock_irqsave(host_set lock) 2128 */ 2129 2130 + 2131 + 2132 + /** 2133 + * ata_sg_init_one - Prepare a one-entry scatter-gather list. 2134 + * @qc: Queued command 2135 + * @buf: transfer buffer 2136 + * @buflen: length of buf 2137 + * 2138 + * Builds a single-entry scatter-gather list to initiate a 2139 + * transfer utilizing the specified buffer. 2140 + * 2141 + * LOCKING: 2142 + */ 2143 void ata_sg_init_one(struct ata_queued_cmd *qc, void *buf, unsigned int buflen) 2144 { 2145 struct scatterlist *sg; ··· 2156 * 2157 * LOCKING: 2158 * spin_lock_irqsave(host_set lock) 2159 + */ 2160 + 2161 + 2162 + /** 2163 + * ata_sg_init - Assign a scatter gather list to a queued command 2164 + * @qc: Queued command 2165 + * @sg: Scatter-gather list 2166 + * @n_elem: length of sg list 2167 + * 2168 + * Attaches a scatter-gather list to a queued command. 2169 + * 2170 + * LOCKING: 2171 */ 2172 2173 void ata_sg_init(struct ata_queued_cmd *qc, struct scatterlist *sg, ··· 2331 ata_qc_complete(qc, drv_stat); 2332 } 2333 2334 + 2335 + /** 2336 + * swap_buf_le16 - 2337 + * @buf: Buffer to swap 2338 + * @buf_words: Number of 16-bit words in buffer. 2339 + * 2340 + * Swap halves of 16-bit words if needed to convert from 2341 + * little-endian byte order to native cpu byte order, or 2342 + * vice-versa. 2343 + * 2344 + * LOCKING: 2345 + */ 2346 void swap_buf_le16(u16 *buf, unsigned int buf_words) 2347 { 2348 #ifdef __BIG_ENDIAN ··· 2992 return -1; 2993 } 2994 2995 + 2996 /** 2997 * ata_qc_issue_prot - issue taskfile to device in proto-dependent manner 2998 * @qc: command to issue to device ··· 3000 * starts an ATA command. ATA commands are grouped into 3001 * classes called "protocols", and issuing each type of protocol 3002 * is slightly different. 3003 + * 3004 + * May be used as the qc_issue() entry in ata_port_operations. 3005 * 3006 * LOCKING: 3007 * spin_lock_irqsave(host_set lock) ··· 3058 } 3059 3060 /** 3061 + * ata_bmdma_setup_mmio - Set up PCI IDE BMDMA transaction 3062 * @qc: Info associated with this ATA transaction. 3063 * 3064 * LOCKING: ··· 3165 ap->ioaddr.bmdma_addr + ATA_DMA_CMD); 3166 } 3167 3168 + 3169 + /** 3170 + * ata_bmdma_start - Start a PCI IDE BMDMA transaction 3171 + * @qc: Info associated with this ATA transaction. 3172 + * 3173 + * Writes the ATA_DMA_START flag to the DMA command register. 3174 + * 3175 + * May be used as the bmdma_start() entry in ata_port_operations. 3176 + * 3177 + * LOCKING: 3178 + * spin_lock_irqsave(host_set lock) 3179 + */ 3180 void ata_bmdma_start(struct ata_queued_cmd *qc) 3181 { 3182 if (qc->ap->flags & ATA_FLAG_MMIO) ··· 3173 ata_bmdma_start_pio(qc); 3174 } 3175 3176 + 3177 + /** 3178 + * ata_bmdma_setup - Set up PCI IDE BMDMA transaction 3179 + * @qc: Info associated with this ATA transaction. 3180 + * 3181 + * Writes address of PRD table to device's PRD Table Address 3182 + * register, sets the DMA control register, and calls 3183 + * ops->exec_command() to start the transfer. 3184 + * 3185 + * May be used as the bmdma_setup() entry in ata_port_operations. 3186 + * 3187 + * LOCKING: 3188 + * spin_lock_irqsave(host_set lock) 3189 + */ 3190 void ata_bmdma_setup(struct ata_queued_cmd *qc) 3191 { 3192 if (qc->ap->flags & ATA_FLAG_MMIO) ··· 3180 else 3181 ata_bmdma_setup_pio(qc); 3182 } 3183 + 3184 + 3185 + /** 3186 + * ata_bmdma_irq_clear - Clear PCI IDE BMDMA interrupt. 3187 + * @qc: Info associated with this ATA transaction. 3188 + * 3189 + * Clear interrupt and error flags in DMA status register. 3190 + * 3191 + * May be used as the irq_clear() entry in ata_port_operations. 3192 + * 3193 + * LOCKING: 3194 + * spin_lock_irqsave(host_set lock) 3195 + */ 3196 3197 void ata_bmdma_irq_clear(struct ata_port *ap) 3198 { ··· 3193 3194 } 3195 3196 + 3197 + /** 3198 + * ata_bmdma_status - Read PCI IDE BMDMA status 3199 + * @qc: Info associated with this ATA transaction. 3200 + * 3201 + * Read and return BMDMA status register. 3202 + * 3203 + * May be used as the bmdma_status() entry in ata_port_operations. 3204 + * 3205 + * LOCKING: 3206 + * spin_lock_irqsave(host_set lock) 3207 + */ 3208 + 3209 u8 ata_bmdma_status(struct ata_port *ap) 3210 { 3211 u8 host_stat; ··· 3203 host_stat = inb(ap->ioaddr.bmdma_addr + ATA_DMA_STATUS); 3204 return host_stat; 3205 } 3206 + 3207 + 3208 + /** 3209 + * ata_bmdma_stop - Stop PCI IDE BMDMA transfer 3210 + * @qc: Info associated with this ATA transaction. 3211 + * 3212 + * Clears the ATA_DMA_START flag in the dma control register 3213 + * 3214 + * May be used as the bmdma_stop() entry in ata_port_operations. 3215 + * 3216 + * LOCKING: 3217 + * spin_lock_irqsave(host_set lock) 3218 + */ 3219 3220 void ata_bmdma_stop(struct ata_port *ap) 3221 { ··· 3407 ata_qc_complete(qc, ATA_ERR); 3408 } 3409 3410 + 3411 + /** 3412 + * ata_port_start - Set port up for dma. 3413 + * @ap: Port to initialize 3414 + * 3415 + * Called just after data structures for each port are 3416 + * initialized. Allocates space for PRD table. 3417 + * 3418 + * May be used as the port_start() entry in ata_port_operations. 3419 + * 3420 + * LOCKING: 3421 + */ 3422 + 3423 int ata_port_start (struct ata_port *ap) 3424 { 3425 struct device *dev = ap->host_set->dev; ··· 3419 3420 return 0; 3421 } 3422 + 3423 + 3424 + /** 3425 + * ata_port_stop - Undo ata_port_start() 3426 + * @ap: Port to shut down 3427 + * 3428 + * Frees the PRD table. 3429 + * 3430 + * May be used as the port_stop() entry in ata_port_operations. 3431 + * 3432 + * LOCKING: 3433 + */ 3434 3435 void ata_port_stop (struct ata_port *ap) 3436 { ··· 3720 /** 3721 * ata_std_ports - initialize ioaddr with standard port offsets. 3722 * @ioaddr: IO address structure to be initialized 3723 + * 3724 + * Utility function which initializes data_addr, error_addr, 3725 + * feature_addr, nsect_addr, lbal_addr, lbam_addr, lbah_addr, 3726 + * device_addr, status_addr, and command_addr to standard offsets 3727 + * relative to cmd_addr. 3728 + * 3729 + * Does not set ctl_addr, altstatus_addr, bmdma_addr, or scr_addr. 3730 */ 3731 + 3732 void ata_std_ports(struct ata_ioports *ioaddr) 3733 { 3734 ioaddr->data_addr = ioaddr->cmd_addr + ATA_REG_DATA; ··· 3761 3762 return probe_ent; 3763 } 3764 + 3765 + 3766 + 3767 + /** 3768 + * ata_pci_init_native_mode - Initialize native-mode driver 3769 + * @pdev: pci device to be initialized 3770 + * @port: array[2] of pointers to port info structures. 3771 + * 3772 + * Utility function which allocates and initializes an 3773 + * ata_probe_ent structure for a standard dual-port 3774 + * PIO-based IDE controller. The returned ata_probe_ent 3775 + * structure can be passed to ata_device_add(). The returned 3776 + * ata_probe_ent structure should then be freed with kfree(). 3777 + */ 3778 3779 #ifdef CONFIG_PCI 3780 struct ata_probe_ent * ··· 3842 * @pdev: Controller to be initialized 3843 * @port_info: Information from low-level host driver 3844 * @n_ports: Number of ports attached to host controller 3845 + * 3846 + * This is a helper function which can be called from a driver's 3847 + * xxx_init_one() probe function if the hardware uses traditional 3848 + * IDE taskfile registers. 3849 + * 3850 + * This function calls pci_enable_device(), reserves its register 3851 + * regions, sets the dma mask, enables bus master mode, and calls 3852 + * ata_device_add() 3853 * 3854 * LOCKING: 3855 * Inherited from PCI layer (may sleep).
+58
include/linux/libata.h
··· 466 return ap->ops->check_status(ap); 467 } 468 469 static inline void ata_pause(struct ata_port *ap) 470 { 471 ata_altstatus(ap); 472 ndelay(400); 473 } 474 475 static inline u8 ata_busy_wait(struct ata_port *ap, unsigned int bits, 476 unsigned int max) ··· 507 508 return status; 509 } 510 511 static inline u8 ata_wait_idle(struct ata_port *ap) 512 { ··· 558 tf->device = ATA_DEVICE_OBS | ATA_DEV1; 559 } 560 561 static inline u8 ata_irq_on(struct ata_port *ap) 562 { 563 struct ata_ioports *ioaddr = &ap->ioaddr; ··· 588 589 return tmp; 590 } 591 592 static inline u8 ata_irq_ack(struct ata_port *ap, unsigned int chk_drq) 593 {
··· 466 return ap->ops->check_status(ap); 467 } 468 469 + 470 + /** 471 + * ata_pause - Flush writes and pause 400 nanoseconds. 472 + * @ap: Port to wait for. 473 + * 474 + * LOCKING: 475 + * Inherited from caller. 476 + */ 477 + 478 static inline void ata_pause(struct ata_port *ap) 479 { 480 ata_altstatus(ap); 481 ndelay(400); 482 } 483 + 484 + 485 + /** 486 + * ata_busy_wait - Wait for a port status register 487 + * @ap: Port to wait for. 488 + * 489 + * Waits up to max*10 microseconds for the selected bits in the port's 490 + * status register to be cleared. 491 + * Returns final value of status register. 492 + * 493 + * LOCKING: 494 + * Inherited from caller. 495 + */ 496 497 static inline u8 ata_busy_wait(struct ata_port *ap, unsigned int bits, 498 unsigned int max) ··· 485 486 return status; 487 } 488 + 489 + 490 + /** 491 + * ata_wait_idle - Wait for a port to be idle. 492 + * @ap: Port to wait for. 493 + * 494 + * Waits up to 10ms for port's BUSY and DRQ signals to clear. 495 + * Returns final value of status register. 496 + * 497 + * LOCKING: 498 + * Inherited from caller. 499 + */ 500 501 static inline u8 ata_wait_idle(struct ata_port *ap) 502 { ··· 524 tf->device = ATA_DEVICE_OBS | ATA_DEV1; 525 } 526 527 + 528 + /** 529 + * ata_irq_on - Enable interrupts on a port. 530 + * @ap: Port on which interrupts are enabled. 531 + * 532 + * Enable interrupts on a legacy IDE device using MMIO or PIO, 533 + * wait for idle, clear any pending interrupts. 534 + * 535 + * LOCKING: 536 + * Inherited from caller. 537 + */ 538 + 539 static inline u8 ata_irq_on(struct ata_port *ap) 540 { 541 struct ata_ioports *ioaddr = &ap->ioaddr; ··· 542 543 return tmp; 544 } 545 + 546 + 547 + /** 548 + * ata_irq_ack - Acknowledge a device interrupt. 549 + * @ap: Port on which interrupts are enabled. 550 + * 551 + * Wait up to 10 ms for legacy IDE device to become idle (BUSY 552 + * or BUSY+DRQ clear). Obtain dma status and port status from 553 + * device. Clear the interrupt. Return port status. 554 + * 555 + * LOCKING: 556 + */ 557 558 static inline u8 ata_irq_ack(struct ata_port *ap, unsigned int chk_drq) 559 {