diff options
author | Tom Rini <trini@konsulko.com> | 2017-07-12 00:28:46 (GMT) |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2017-07-12 00:28:46 (GMT) |
commit | 8d3a25685e4aac7070365a2b3c53c2c81b27930f (patch) | |
tree | 7956bf5e00e3490169a7fc41c42a4416da8db51f /include/scsi.h | |
parent | d43ef73bf26614af9b01fd57baa1a1fcf24bfade (diff) | |
parent | 8c9eaadaaad888e0cd77512553d0d02d476b4dde (diff) | |
download | u-boot-8d3a25685e4aac7070365a2b3c53c2c81b27930f.tar.xz |
Merge git://git.denx.de/u-boot-dm
Diffstat (limited to 'include/scsi.h')
-rw-r--r-- | include/scsi.h | 85 |
1 files changed, 62 insertions, 23 deletions
diff --git a/include/scsi.h b/include/scsi.h index 190dacd..7173912 100644 --- a/include/scsi.h +++ b/include/scsi.h @@ -7,7 +7,7 @@ #ifndef _SCSI_H #define _SCSI_H -typedef struct SCSI_cmd_block{ +struct scsi_cmd { unsigned char cmd[16]; /* command */ /* for request sense */ unsigned char sense_buf[64] @@ -27,7 +27,7 @@ typedef struct SCSI_cmd_block{ unsigned long trans_bytes; /* tranfered bytes */ unsigned int priv; -}ccb; +}; /*----------------------------------------------------------- ** @@ -158,27 +158,6 @@ typedef struct SCSI_cmd_block{ #define SCSI_WRITE_LONG 0x3F /* Write Long (O) */ #define SCSI_WRITE_SAME 0x41 /* Write Same (O) */ - -/**************************************************************************** - * decleration of functions which have to reside in the LowLevel Part Driver - */ - -void scsi_print_error(ccb *pccb); -int scsi_exec(ccb *pccb); -void scsi_bus_reset(void); -#if !defined(CONFIG_DM_SCSI) -void scsi_low_level_init(int busdevfunc); -#else -void scsi_low_level_init(int busdevfunc, struct udevice *dev); -#endif - -/*************************************************************************** - * functions residing inside cmd_scsi.c - */ -void scsi_init(void); -int scsi_scan(int mode); - -#if defined(CONFIG_DM_SCSI) /** * struct scsi_platdata - stores information about SCSI controller * @@ -191,6 +170,66 @@ struct scsi_platdata { unsigned long max_lun; unsigned long max_id; }; + +/* Operations for SCSI */ +struct scsi_ops { + /** + * exec() - execute a command + * + * @dev: SCSI bus + * @cmd: Command to execute + * @return 0 if OK, -ve on error + */ + int (*exec)(struct udevice *dev, struct scsi_cmd *cmd); + + /** + * bus_reset() - reset the bus + * + * @dev: SCSI bus to reset + * @return 0 if OK, -ve on error + */ + int (*bus_reset)(struct udevice *dev); +}; + +#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); + +/** + * 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); + +/** + * scsi_scan() - Scan all SCSI controllers for available devices + * + * @vebose: true to show information about each device found + */ +int scsi_scan(bool verbose); + +/** + * scsi_scan_dev() - scan a SCSI bus and create devices + * + * @dev: SCSI bus + * @verbose: true to show information about each device found + */ +int scsi_scan_dev(struct udevice *dev, bool verbose); + +#ifndef CONFIG_DM_SCSI +void scsi_low_level_init(int busdevfunc); +void scsi_init(void); #endif #define SCSI_IDENTIFY 0xC0 /* not used */ |