aha1542.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. #ifndef _AHA1542_H_
  2. #define _AHA1542_H_
  3. #include <linux/types.h>
  4. /* I/O Port interface 4.2 */
  5. /* READ */
  6. #define STATUS(base) base
  7. #define STST BIT(7) /* Self Test in Progress */
  8. #define DIAGF BIT(6) /* Internal Diagnostic Failure */
  9. #define INIT BIT(5) /* Mailbox Initialization Required */
  10. #define IDLE BIT(4) /* SCSI Host Adapter Idle */
  11. #define CDF BIT(3) /* Command/Data Out Port Full */
  12. #define DF BIT(2) /* Data In Port Full */
  13. /* BIT(1) is reserved */
  14. #define INVDCMD BIT(0) /* Invalid H A Command */
  15. #define STATMASK (STST | DIAGF | INIT | IDLE | CDF | DF | INVDCMD)
  16. #define INTRFLAGS(base) (STATUS(base)+2)
  17. #define ANYINTR BIT(7) /* Any Interrupt */
  18. #define SCRD BIT(3) /* SCSI Reset Detected */
  19. #define HACC BIT(2) /* HA Command Complete */
  20. #define MBOA BIT(1) /* MBO Empty */
  21. #define MBIF BIT(0) /* MBI Full */
  22. #define INTRMASK (ANYINTR | SCRD | HACC | MBOA | MBIF)
  23. /* WRITE */
  24. #define CONTROL(base) STATUS(base)
  25. #define HRST BIT(7) /* Hard Reset */
  26. #define SRST BIT(6) /* Soft Reset */
  27. #define IRST BIT(5) /* Interrupt Reset */
  28. #define SCRST BIT(4) /* SCSI Bus Reset */
  29. /* READ/WRITE */
  30. #define DATA(base) (STATUS(base)+1)
  31. #define CMD_NOP 0x00 /* No Operation */
  32. #define CMD_MBINIT 0x01 /* Mailbox Initialization */
  33. #define CMD_START_SCSI 0x02 /* Start SCSI Command */
  34. #define CMD_INQUIRY 0x04 /* Adapter Inquiry */
  35. #define CMD_EMBOI 0x05 /* Enable MailBox Out Interrupt */
  36. #define CMD_BUSON_TIME 0x07 /* Set Bus-On Time */
  37. #define CMD_BUSOFF_TIME 0x08 /* Set Bus-Off Time */
  38. #define CMD_DMASPEED 0x09 /* Set AT Bus Transfer Speed */
  39. #define CMD_RETDEVS 0x0a /* Return Installed Devices */
  40. #define CMD_RETCONF 0x0b /* Return Configuration Data */
  41. #define CMD_RETSETUP 0x0d /* Return Setup Data */
  42. #define CMD_ECHO 0x1f /* ECHO Command Data */
  43. #define CMD_EXTBIOS 0x28 /* Return extend bios information only 1542C */
  44. #define CMD_MBENABLE 0x29 /* Set Mailbox Interface enable only 1542C */
  45. /* Mailbox Definition 5.2.1 and 5.2.2 */
  46. struct mailbox {
  47. u8 status; /* Command/Status */
  48. u8 ccbptr[3]; /* msb, .., lsb */
  49. };
  50. /* This is used with scatter-gather */
  51. struct chain {
  52. u8 datalen[3]; /* Size of this part of chain */
  53. u8 dataptr[3]; /* Location of data */
  54. };
  55. /* These belong in scsi.h also */
  56. static inline void any2scsi(u8 *p, u32 v)
  57. {
  58. p[0] = v >> 16;
  59. p[1] = v >> 8;
  60. p[2] = v;
  61. }
  62. #define scsi2int(up) ( (((long)*(up)) << 16) + (((long)(up)[1]) << 8) + ((long)(up)[2]) )
  63. #define xscsi2int(up) ( (((long)(up)[0]) << 24) + (((long)(up)[1]) << 16) \
  64. + (((long)(up)[2]) << 8) + ((long)(up)[3]) )
  65. #define MAX_CDB 12
  66. #define MAX_SENSE 14
  67. struct ccb { /* Command Control Block 5.3 */
  68. u8 op; /* Command Control Block Operation Code */
  69. u8 idlun; /* op=0,2:Target Id, op=1:Initiator Id */
  70. /* Outbound data transfer, length is checked*/
  71. /* Inbound data transfer, length is checked */
  72. /* Logical Unit Number */
  73. u8 cdblen; /* SCSI Command Length */
  74. u8 rsalen; /* Request Sense Allocation Length/Disable */
  75. u8 datalen[3]; /* Data Length (msb, .., lsb) */
  76. u8 dataptr[3]; /* Data Pointer */
  77. u8 linkptr[3]; /* Link Pointer */
  78. u8 commlinkid; /* Command Linking Identifier */
  79. u8 hastat; /* Host Adapter Status (HASTAT) */
  80. u8 tarstat; /* Target Device Status */
  81. u8 reserved[2];
  82. u8 cdb[MAX_CDB+MAX_SENSE]; /* SCSI Command Descriptor Block */
  83. /* REQUEST SENSE */
  84. };
  85. #define AHA1542_REGION_SIZE 4
  86. #define AHA1542_MAILBOXES 8
  87. #endif /* _AHA1542_H_ */