scsiio.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. /* $OpenBSD: scsiio.h,v 1.10 2012/09/05 17:17:47 deraadt Exp $ */
  2. /* $NetBSD: scsiio.h,v 1.3 1994/06/29 06:45:09 cgd Exp $ */
  3. #ifndef _SYS_SCSIIO_H_
  4. #define _SYS_SCSIIO_H_
  5. #include <sys/types.h>
  6. #include <sys/ioctl.h>
  7. #define SENSEBUFLEN 48
  8. #define CMDBUFLEN 16
  9. typedef struct scsireq {
  10. u_long flags; /* info about the request status and type */
  11. u_long timeout;
  12. u_char cmd[CMDBUFLEN];
  13. u_char cmdlen;
  14. caddr_t databuf; /* address in user space of buffer */
  15. u_long datalen; /* size of user buffer (request) */
  16. u_long datalen_used; /* size of user buffer (used)*/
  17. u_char sense[SENSEBUFLEN]; /* returned sense will be in here */
  18. u_char senselen; /* sensedata request size (MAX of SENSEBUFLEN)*/
  19. u_char senselen_used; /* return value only */
  20. u_char status; /* what the scsi status was from the adapter */
  21. u_char retsts; /* the return status for the command */
  22. int error; /* error bits */
  23. } scsireq_t;
  24. /* bit definitions for flags */
  25. #define SCCMD_READ 0x00000001
  26. #define SCCMD_WRITE 0x00000002
  27. #define SCCMD_IOV 0x00000004
  28. #define SCCMD_ESCAPE 0x00000010
  29. #define SCCMD_TARGET 0x00000020
  30. /* definitions for the return status (retsts) */
  31. #define SCCMD_OK 0x00
  32. #define SCCMD_TIMEOUT 0x01
  33. #define SCCMD_BUSY 0x02
  34. #define SCCMD_SENSE 0x03
  35. #define SCCMD_UNKNOWN 0x04
  36. #define SCIOCCOMMAND _IOWR('Q', 1, scsireq_t)
  37. #define SC_DB_CMDS 0x00000001 /* show all scsi cmds and errors */
  38. #define SC_DB_FLOW 0x00000002 /* show routines entered */
  39. #define SC_DB_FLOW2 0x00000004 /* show path INSIDE routines */
  40. #define SC_DB_DMA 0x00000008 /* show DMA segments etc */
  41. #define SCIOCDEBUG _IOW('Q', 2, int) /* from 0 to 15 */
  42. struct scsi_addr {
  43. int type;
  44. #define TYPE_SCSI 0
  45. #define TYPE_ATAPI 1
  46. int scbus; /* -1 if wildcard */
  47. int target; /* -1 if wildcard */
  48. int lun; /* -1 if wildcard */
  49. };
  50. #define SCIOCRESET _IO('Q', 7) /* reset the device */
  51. #define SCIOCIDENTIFY _IOR('Q', 9, struct scsi_addr)
  52. struct sbioc_device {
  53. void *sd_cookie;
  54. int sd_target;
  55. int sd_lun;
  56. };
  57. #define SBIOCPROBE _IOWR('Q', 127, struct sbioc_device)
  58. #define SBIOCDETACH _IOWR('Q', 128, struct sbioc_device)
  59. #endif /* _SYS_SCSIIO_H_ */