4 #include "hw/scsi/scsi.h"
6 #include "qom/object.h"
10 typedef void (*ESPDMAMemoryReadWriteFunc
)(void *opaque
, uint8_t *buf
, int len
);
14 #define ESP_CMDBUF_SZ 32
16 typedef struct ESPState ESPState
;
26 uint8_t rregs
[ESP_REGS
];
27 uint8_t wregs
[ESP_REGS
];
33 uint32_t ti_rptr
, ti_wptr
;
35 uint32_t deferred_status
;
36 bool deferred_complete
;
38 uint8_t ti_buf
[TI_BUFSZ
];
40 SCSIDevice
*current_dev
;
41 SCSIRequest
*current_req
;
42 uint8_t cmdbuf
[ESP_CMDBUF_SZ
];
46 /* The amount of data left in the current DMA transfer. */
48 /* The size of the current DMA transfer. Zero if no transfer is in
56 ESPDMAMemoryReadWriteFunc dma_memory_read
;
57 ESPDMAMemoryReadWriteFunc dma_memory_write
;
59 void (*dma_cb
)(ESPState
*s
);
65 void (*pdma_cb
)(ESPState
*s
);
68 #define TYPE_ESP "esp"
69 OBJECT_DECLARE_SIMPLE_TYPE(SysBusESPState
, ESP
)
71 struct SysBusESPState
{
73 SysBusDevice parent_obj
;
87 #define ESP_WBUSID 0x4
91 #define ESP_WSYNTP 0x6
92 #define ESP_RFLAGS 0x7
109 #define CMD_FLUSH 0x01
110 #define CMD_RESET 0x02
111 #define CMD_BUSRESET 0x03
113 #define CMD_ICCS 0x11
114 #define CMD_MSGACC 0x12
116 #define CMD_SATN 0x1a
117 #define CMD_RSTATN 0x1b
119 #define CMD_SELATN 0x42
120 #define CMD_SELATNS 0x43
121 #define CMD_ENSEL 0x44
122 #define CMD_DISSEL 0x45
130 #define STAT_PIO_MASK 0x06
135 #define STAT_INT 0x80
137 #define BUSID_DID 0x07
142 #define INTR_RST 0x80
147 #define CFG1_RESREPT 0x40
149 #define TCHI_FAS100A 0x4
150 #define TCHI_AM53C974 0x12
152 void esp_dma_enable(ESPState
*s
, int irq
, int level
);
153 void esp_request_cancelled(SCSIRequest
*req
);
154 void esp_command_complete(SCSIRequest
*req
, size_t resid
);
155 void esp_transfer_data(SCSIRequest
*req
, uint32_t len
);
156 void esp_hard_reset(ESPState
*s
);
157 uint64_t esp_reg_read(ESPState
*s
, uint32_t saddr
);
158 void esp_reg_write(ESPState
*s
, uint32_t saddr
, uint64_t val
);
159 extern const VMStateDescription vmstate_esp
;