X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=include%2Fscsi.h;h=0a475a8ca4c0b08a36f821d64d35540ebfe2bf27;hb=64cfeda8ae2e95751c5d2dfa4dc4a906478ae2f6;hp=182665dd0cd12f86c5ef8f94949b0248b4a89e3a;hpb=aae5ec34032610f2144542fd1b30b6a5cc559d79;p=platform%2Fkernel%2Fu-boot.git diff --git a/include/scsi.h b/include/scsi.h index 182665d..0a475a8 100644 --- a/include/scsi.h +++ b/include/scsi.h @@ -1,13 +1,17 @@ +/* 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{ +#include +#include + +struct udevice; + +struct scsi_cmd { unsigned char cmd[16]; /* command */ /* for request sense */ unsigned char sense_buf[64] @@ -27,7 +31,8 @@ typedef struct scsi_cmd{ unsigned long trans_bytes; /* tranfered bytes */ unsigned int priv; -}ccb; + enum dma_data_direction dma_dir; +}; /*----------------------------------------------------------- ** @@ -159,32 +164,80 @@ typedef struct scsi_cmd{ #define SCSI_WRITE_SAME 0x41 /* Write Same (O) */ /** - * struct scsi_platdata - stores information about SCSI controller + * struct scsi_plat - stores information about SCSI controller * * @base: Controller base address * @max_lun: Maximum number of logical units * @max_id: Maximum number of target ids + * @max_bytes_per_req: Maximum number of bytes per read/write request */ -struct scsi_platdata { +struct scsi_plat { unsigned long base; unsigned long max_lun; unsigned long max_id; + unsigned long max_bytes_per_req; }; -#if defined(CONFIG_DM_SCSI) -void scsi_low_level_init(int busdevfunc, struct udevice *dev); -#else -void scsi_low_level_init(int busdevfunc); -void scsi_init(void); -#endif +/* 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); +}; -int scsi_exec(ccb *pccb); -void scsi_bus_reset(void); +#define scsi_get_ops(dev) ((struct scsi_ops *)(dev)->driver->ops) -/*************************************************************************** - * functions residing inside cmd_scsi.c +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(int mode); +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 */