#include "scsi.h" #include #include #include "hosts.h" #include "scsi_logging.h" #include /* * This file contains the symbol table used by scsi loadable * modules. */ Covered in scsi_mid_low_api.txt: scsi_add_device scsi_add_host scsi_add_timer scsi_adjust_queue_depth scsi_bios_ptable scsi_block_requests scsi_delete_timer scsi_host_alloc scsi_host_get scsi_host_put scsi_partsize scsi_register scsi_remove_device scsi_remove_host scsi_report_bus_reset scsi_track_queue_full scsi_unblock_requests scsi_unregister scsi_assign_lock scsi_set_device scsi_to_pci_dma_dir scsi_to_sbus_dma_dir Missing: #if defined(CONFIG_SCSI_LOGGING) EXPORT_SYMBOL(scsi_logging_level); module_param(scsi_logging_level, int, S_IRUGO|S_IWUSR); MODULE_PARM_DESC(scsi_logging_level, "a bit mask of logging levels"); #endif /** * scsi_register_driver - register a SCSI driver * @drv: the struct device_driver to register * * Sets the driver's bus type to &scsi_bus_type and * registers the driver. * * Return value: * TBD: result of calling driver_register(drv); **/ int scsi_register_driver(struct device_driver *drv); /** * scsi_register_interface - register a SCSI interface class * @intf: the struct class_interface to register * * Sets the interface class to &sdev_class and * registers the interface. * * Return value: * TBD: result of calling class_interface_register(intf); **/ int scsi_register_interface(struct class_interface *intf); /** * scsi_scan_host - scan the given adapter * @shost: adapter (struct Scsi_Host) to scan **/ void scsi_scan_host(struct Scsi_Host *shost); /** * scsi_host_lookup - get a reference to a Scsi_Host by host number * @hostnum: host number to locate * * Return value: * A pointer to located Scsi_Host or NULL. **/ struct Scsi_Host *scsi_host_lookup(unsigned short hostnum) /** * scsi_get_host_dev() - create a Scsi_Device that points to the * host adapter itself. * @SHpnt: Host that needs a Scsi_Device * * Lock status: None assumed. * * Return value: * The Scsi_Device or NULL * * Notes: * Attach a single Scsi_Device to the Scsi_Host - this should * be made to look like a "pseudo-device" that points to the * HA itself. * * Note - this device is not accessible from any high-level * drivers (including generics), which is probably not * optimal. We can add hooks later to attach **/ struct scsi_device *scsi_get_host_dev(struct Scsi_Host *shost); /** * scsi_free_host_dev() - free a scsi_device that points to the * host adapter itself. * @SHpnt: Host that needs a Scsi_Device * * Lock status: None assumed. * * Returns: Nothing * * Notes: **/ void scsi_free_host_dev(struct scsi_device *sdev); int scsi_device_get(struct scsi_device *sdev); void scsi_device_put(struct scsi_device *sdev); int scsi_device_cancel_cb(struct device *dev, void *data); TBD??? /** * scsi_device_cancel - cancel outstanding IO to this device * @sdev: pointer to struct scsi_device * @data: pointer to cancel value. * **/ int scsi_device_cancel(struct scsi_device *sdev, int recovery); * An array of pointers to SCSI device type strings. const char *const scsi_device_types[MAX_SCSI_DEVICE_CODE] = {...}; /** * scsi_get_command() - Allocate and setup a scsi command block * @dev: parent scsi device * @gfp_mask: allocator flags * * Return value: * The allocated scsi command structure. **/ struct scsi_cmnd *scsi_get_command(struct scsi_device *dev, int gfp_mask); /** * scsi_put_command() - Free a scsi command block * @cmd: command block to free * * Returns: Nothing. * * Notes: The command must not belong to any lists. **/ void scsi_put_command(struct scsi_cmnd *cmd); /* ioctl family */ /* * the scsi_ioctl() function differs from most ioctls in that it does * not take a major/minor number as the dev field. Rather, it takes * a pointer to a scsi_devices[] element, a structure. */ int scsi_ioctl(struct scsi_device *sdev, int cmd, void *arg); /* * Just like scsi_ioctl, only callable from kernel space with no * fs segment fiddling. */ int kernel_scsi_ioctl(struct scsi_device *sdev, int cmd, void *arg); int scsi_set_medium_removal(struct scsi_device *sdev, char state); /* end ioctl family */ /** * scsi_allocate_request - Allocate a request descriptor. * @device: device for which we want a request * @gfp_mask: allocation flags passed to kmalloc * * Lock status: No locks assumed to be held. This function is SMP-safe. * * Return value: * Pointer to request block. **/ struct scsi_request *scsi_allocate_request(struct scsi_device *sdev, int gfp_mask); /** * scsi_release_request - Release a request descriptor. * @sreq: request to release * * Lock status: No locks assumed to be held. This function is SMP-safe. **/ void scsi_release_request(struct scsi_request *sreq); void scsi_wait_req(struct scsi_request *sreq, const void *cmnd, void *buffer, unsigned bufflen, int timeout, int retries); /** * scsi_do_req - Queue a SCSI request * @sreq: command descriptor. * @cmnd: actual SCSI command to be performed. * @buffer: data buffer. * @bufflen: size of data buffer. * @done: completion function to be run. * @timeout: how long to let it run before timeout. * @retries: number of retries we allow. * * Lock status: No locks held upon entry. * * Returns: Nothing. * * Notes: This function is only used for queueing requests for things * like ioctls and character device requests - this is because * we essentially just inject a request into the queue for the * device. **/ void scsi_do_req(struct scsi_request *sreq, const void *cmnd, void *buffer, unsigned bufflen, void (*done)(struct scsi_cmnd *), int timeout, int retries); /** * scsi_sleep - sleep for specified timeout * @timeout: timeout value * **/ void scsi_sleep(int timeout); /* * scsi_io_completion - Completion processing for block device I/O requests. * @cmd: command that is finished. * * Lock status: Assumed that no lock is held upon entry. * * Returns: Nothing * * Notes: This function is matched in terms of capabilities to * the function that created the scatter-gather list. * In other words, if there are no bounce buffers * (the normal case for most drivers), we don't need * the logic to deal with cleaning up afterwards. * * We must do one of several things here: * * a) Call scsi_end_request. This will finish off the * specified number of sectors. If we are done, the * command block will be released, and the queue * function will be goosed. If we are not done, then * scsi_end_request will directly goose the queue. * * b) We can just use scsi_requeue_command() here. This would * be used if we just wanted to retry, for example. **/ void scsi_io_completion(struct scsi_cmnd *cmd, int good_sectors, int block_sectors); /** * scsi_report_device_reset - Utility function used by low-level drivers * to report that they have observed a device reset on the device being handled. * @shost: Host in question * @channel: channel on which reset was observed * @target: target on which reset was observed * * Returns: Nothing * * Lock status: No locks are assumed held. * * Notes: This only needs to be called if the reset is one which * originates from an unknown location. Resets originated * by the mid-level itself don't need to call this, but there * should be no harm. * * The main purpose of this is to make sure that a CHECK_CONDITION * is properly treated. **/ void scsi_report_device_reset(struct Scsi_Host *shost, int channel, int target) /** * scsi_sense_key_string - Get sense key string * @key: sense key to convert to a string * * Return value: * pointer to sense key string or NULL if not available **/ const char * scsi_sense_key_string(unsigned char key); /** * scsi_extd_sense_format - Get extended sense key string * @asc: TBD * @ascq: TBD * * Return value: * pointer to extended sense key string or NULL if not available * * Notes: This string may contain a %x and must be printed with * ascq as arg. **/ const char * scsi_extd_sense_format(unsigned char asc, unsigned char ascq); /** * __scsi_mode_sense - issue a mode sense, falling back from 10 to * six bytes if necessary. * @sreq: SCSI request to fill in with the MODE_SENSE * @dbd: set if mode sense will allow block descriptors to be returned * @modepage: mode page being requested * @buffer: request buffer (may not be smaller than eight bytes) * @len: length of request buffer. * @timeout: command timeout * @retries: number of retries before failing * @data: returns a structure abstracting the mode header data * * Returns zero if unsuccessful, or the header offset (either 4 * or 8 depending on whether a six or ten byte command was * issued) if successful. **/ int __scsi_mode_sense(struct scsi_request *sreq, int dbd, int modepage, unsigned char *buffer, int len, int timeout, int retries, struct scsi_mode_data *data); /** * scsi_mode_sense - issue a mode sense, falling back from 10 to * six bytes if necessary. * @sdev: scsi device to send command to. * @dbd: set if mode sense will disable block descriptors in the return * @modepage: mode page being requested * @buffer: request buffer (may not be smaller than eight bytes) * @len: length of request buffer. * @timeout: command timeout * @retries: number of retries before failing * * Returns zero if unsuccessful, or the header offset (either 4 * or 8 depending on whether a six or ten byte command was * issued) if successful. **/ int scsi_mode_sense(struct scsi_device *sdev, int dbd, int modepage, unsigned char *buffer, int len, int timeout, int retries, struct scsi_mode_data *data); /** * scsi_block_when_processing_errors - Prevent cmds from being queued. * @sdev: Device on which we are performing recovery. * * Description: * We block until the host is out of error recovery, and then check to * see whether the host or the device is offline. * * Return value: * 0 when dev was taken offline by error recovery. 1 OK to proceed. **/ int scsi_block_when_processing_errors(struct scsi_device *sdev); /** * scsicam_bios_param - determine the BIOS mapping used for a drive in a * SCSI-CAM system, storing the results in ip as required * by the HDIO_GETGEO ioctl(). * @bdev: TBD * @capacity: TBD * @ip: TBD * * Return value: * -1 on failure, 0 on success. **/ int scsicam_bios_param(struct block_device *bdev, sector_t capacity, int *ip); /** * scsi_reset_provider - Send requested reset to a bus or device at any phase. * @device: device to send reset to * @flag: reset type (see scsi.h) * * Return value: * SUCCESS/FAILURE. * * Notes: This is used by the SCSI Generic driver to provide * Bus/Device reset capability. * This symbol is for the highlevel drivers (e.g. sg) only. **/ int scsi_reset_provider(struct scsi_device *dev, int flag); /* This is for st to find the bounce limit. */ u64 scsi_calculate_bounce_limit(struct Scsi_Host *shost); /* print family */ void print_command (unsigned char *command); void print_sense(const char *devclass, struct scsi_cmnd *cmd); void print_req_sense(const char *devclass, struct scsi_request *sreq); int print_msg (const unsigned char *msg); /** * print_status - print scsi status description * @scsi_status: scsi status value * * If the status is recognized, the description is printed. * Otherwise "Unknown status" is output. No trailing space. * If CONFIG_SCSI_CONSTANTS is not set, then print status in hex * (e.g. "0x2" for Check Condition). **/ void print_status(unsigned char scsi_status); void print_Scsi_Cmnd(struct scsi_cmnd *cmd); ###