1 /** @file
2 
3   Macros and type definitions for LSI 53C895A SCSI devices.
4 
5   Copyright (C) 2020, SUSE LLC.
6 
7   SPDX-License-Identifier: BSD-2-Clause-Patent
8 
9 **/
10 
11 #ifndef _LSI_SCSI_H_
12 #define _LSI_SCSI_H_
13 
14 //
15 // Device ID
16 //
17 #define LSI_LOGIC_PCI_VENDOR_ID   0x1000
18 #define LSI_53C895A_PCI_DEVICE_ID 0x0012
19 
20 //
21 // LSI 53C895A Registers
22 //
23 #define LSI_REG_DSTAT             0x0C
24 #define LSI_REG_ISTAT0            0x14
25 #define LSI_REG_DSP               0x2C
26 #define LSI_REG_SIST0             0x42
27 #define LSI_REG_SIST1             0x43
28 #define LSI_REG_CSBC              0xDC
29 
30 //
31 // The status bits for DMA Status (DSTAT)
32 //
33 #define LSI_DSTAT_IID             BIT0
34 #define LSI_DSTAT_R               BIT1
35 #define LSI_DSTAT_SIR             BIT2
36 #define LSI_DSTAT_SSI             BIT3
37 #define LSI_DSTAT_ABRT            BIT4
38 #define LSI_DSTAT_BF              BIT5
39 #define LSI_DSTAT_MDPE            BIT6
40 #define LSI_DSTAT_DFE             BIT7
41 
42 //
43 // The status bits for Interrupt Status Zero (ISTAT0)
44 //
45 #define LSI_ISTAT0_DIP            BIT0
46 #define LSI_ISTAT0_SIP            BIT1
47 #define LSI_ISTAT0_INTF           BIT2
48 #define LSI_ISTAT0_CON            BIT3
49 #define LSI_ISTAT0_SEM            BIT4
50 #define LSI_ISTAT0_SIGP           BIT5
51 #define LSI_ISTAT0_SRST           BIT6
52 #define LSI_ISTAT0_ABRT           BIT7
53 
54 //
55 // The status bits for SCSI Interrupt Status Zero (SIST0)
56 //
57 #define LSI_SIST0_PAR             BIT0
58 #define LSI_SIST0_RST             BIT1
59 #define LSI_SIST0_UDC             BIT2
60 #define LSI_SIST0_SGE             BIT3
61 #define LSI_SIST0_RSL             BIT4
62 #define LSI_SIST0_SEL             BIT5
63 #define LSI_SIST0_CMP             BIT6
64 #define LSI_SIST0_MA              BIT7
65 
66 //
67 // The status bits for SCSI Interrupt Status One (SIST1)
68 //
69 #define LSI_SIST1_HTH             BIT0
70 #define LSI_SIST1_GEN             BIT1
71 #define LSI_SIST1_STO             BIT2
72 #define LSI_SIST1_R3              BIT3
73 #define LSI_SIST1_SBMC            BIT4
74 #define LSI_SIST1_R5              BIT5
75 #define LSI_SIST1_R6              BIT6
76 #define LSI_SIST1_R7              BIT7
77 
78 //
79 // LSI 53C895A Script Instructions
80 //
81 #define LSI_INS_TYPE_BLK          0x00000000
82 #define LSI_INS_TYPE_IO           BIT30
83 #define LSI_INS_TYPE_TC           BIT31
84 
85 #define LSI_INS_BLK_SCSIP_DAT_OUT 0x00000000
86 #define LSI_INS_BLK_SCSIP_DAT_IN  BIT24
87 #define LSI_INS_BLK_SCSIP_CMD     BIT25
88 #define LSI_INS_BLK_SCSIP_STAT    (BIT24 | BIT25)
89 #define LSI_INS_BLK_SCSIP_MSG_OUT (BIT25 | BIT26)
90 #define LSI_INS_BLK_SCSIP_MSG_IN  (BIT24 | BIT25 | BIT26)
91 
92 #define LSI_INS_IO_OPC_SEL        0x00000000
93 #define LSI_INS_IO_OPC_WAIT_RESEL BIT28
94 
95 #define LSI_INS_TC_CP             BIT17
96 #define LSI_INS_TC_JMP            BIT19
97 #define LSI_INS_TC_RA             BIT23
98 
99 #define LSI_INS_TC_OPC_JMP        0x00000000
100 #define LSI_INS_TC_OPC_INT        (BIT27 | BIT28)
101 
102 #define LSI_INS_TC_SCSIP_DAT_OUT  0x00000000
103 #define LSI_INS_TC_SCSIP_MSG_IN   (BIT24 | BIT25 | BIT26)
104 
105 #endif // _LSI_SCSI_H_
106