X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=include%2Fscsi.h;h=81ab43c8420a2c3818fa54559fdea526b0cb1030;hb=a84289190c60260da6df8c87c032961404217b6f;hp=7e3759140b34255debc102de76b9860c1c326189;hpb=b48b69ba10fd1fd1f0de73220438ba8052fc2a33;p=oweals%2Fu-boot.git diff --git a/include/scsi.h b/include/scsi.h index 7e3759140b..81ab43c842 100644 --- a/include/scsi.h +++ b/include/scsi.h @@ -1,13 +1,12 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ /* * (C) Copyright 2001 * Denis Peter, MPL AG Switzerland - * - * SPDX-License-Identifier: GPL-2.0+ */ #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 +26,7 @@ typedef struct SCSI_cmd_block{ unsigned long trans_bytes; /* tranfered bytes */ unsigned int priv; -}ccb; +}; /*----------------------------------------------------------- ** @@ -158,25 +157,79 @@ 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 +/** + * struct scsi_platdata - stores information about SCSI controller + * + * @base: Controller base address + * @max_lun: Maximum number of logical units + * @max_id: Maximum number of target ids + */ +struct scsi_platdata { + unsigned long base; + 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); -void scsi_print_error(ccb *pccb); -int scsi_exec(ccb *pccb); -void scsi_bus_reset(void); -void scsi_low_level_init(int busdevfunc); +/** + * 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); -/*************************************************************************** - * functions residing inside cmd_scsi.c +/** + * scsi_scan_dev() - scan a SCSI bus and create devices + * + * @dev: SCSI bus + * @verbose: true to show information about each device found */ -void scsi_init(void); -void scsi_scan(int mode); +int scsi_scan_dev(struct udevice *dev, bool verbose); -/** @return the number of scsi disks */ -int scsi_get_disk_count(void); +#ifndef CONFIG_DM_SCSI +void scsi_low_level_init(int busdevfunc); +void scsi_init(void); +#endif #define SCSI_IDENTIFY 0xC0 /* not used */