diff options
author | Simon Glass <sjg@chromium.org> | 2017-06-14 21:28:43 -0600 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2017-07-11 10:08:19 -0600 |
commit | f6ab5a92acc78371fc088075b64bd394d1f0d45f (patch) | |
tree | a3f3ebb2d9eddd7f7009adbc4cc01abf5c63c787 /include/scsi.h | |
parent | 4e7490145800ea8da5f67a4fbaa66caab7689ce3 (diff) |
dm: scsi: Add operations for SCSI devices
The SCSI uclass currently has no operations. It just uses the global SCSI
functions. Fix this by adding operations to the only two drivers that use
the uclass, and replacing the global functions with those defined locally
in the SCSI code.
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Diffstat (limited to 'include/scsi.h')
-rw-r--r-- | include/scsi.h | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/include/scsi.h b/include/scsi.h index 20f6932602..9cdd13c795 100644 --- a/include/scsi.h +++ b/include/scsi.h @@ -191,12 +191,25 @@ struct scsi_ops { int (*bus_reset)(struct udevice *dev); }; -#ifndef CONFIG_DM_SCSI -void scsi_low_level_init(int busdevfunc); -void scsi_init(void); -#endif +#define scsi_get_ops(dev) ((struct scsi_ops *)(dev)->driver->ops) + +extern struct scsi_ops scsi_ops; + +/** + * scsi_exec() - execute a command + * + * @dev: SCSI bus + * @cmd: Command to execute + * @return 0 if OK, -ve on error + */ +int scsi_exec(struct udevice *dev, struct scsi_cmd *cmd); -int scsi_exec(struct udevice *dev, struct scsi_cmd *pccb); +/** + * scsi_bus_reset() - reset the bus + * + * @dev: SCSI bus to reset + * @return 0 if OK, -ve on error + */ int scsi_bus_reset(struct udevice *dev); /** @@ -206,6 +219,11 @@ int scsi_bus_reset(struct udevice *dev); */ int scsi_scan(bool verbose); +#ifndef CONFIG_DM_SCSI +void scsi_low_level_init(int busdevfunc); +void scsi_init(void); +#endif + #define SCSI_IDENTIFY 0xC0 /* not used */ /* Hardware errors */ |