9 SCSI_REASON_DONE
, /* Command complete. */
10 SCSI_REASON_DATA
/* Transfer complete, more data required. */
13 typedef struct SCSIBus SCSIBus
;
14 typedef struct SCSIDevice SCSIDevice
;
15 typedef struct SCSIDeviceInfo SCSIDeviceInfo
;
16 typedef void (*scsi_completionfn
)(SCSIBus
*bus
, int reason
, uint32_t tag
,
19 typedef struct SCSIRequest
{
23 BlockDriverAIOCB
*aiocb
;
34 int cdrom_read_toc(int nb_sectors
, uint8_t *buf
, int msf
, int start_track
);
35 int cdrom_read_toc_raw(int nb_sectors
, uint8_t *buf
, int msf
, int session_num
);
38 typedef int (*scsi_qdev_initfn
)(SCSIDevice
*dev
);
39 struct SCSIDeviceInfo
{
41 scsi_qdev_initfn init
;
42 void (*destroy
)(SCSIDevice
*s
);
43 int32_t (*send_command
)(SCSIDevice
*s
, uint32_t tag
, uint8_t *buf
,
45 void (*read_data
)(SCSIDevice
*s
, uint32_t tag
);
46 int (*write_data
)(SCSIDevice
*s
, uint32_t tag
);
47 void (*cancel_io
)(SCSIDevice
*s
, uint32_t tag
);
48 uint8_t *(*get_buf
)(SCSIDevice
*s
, uint32_t tag
);
51 typedef void (*SCSIAttachFn
)(DeviceState
*host
, BlockDriverState
*bdrv
,
58 scsi_completionfn complete
;
63 void scsi_bus_new(SCSIBus
*bus
, DeviceState
*host
, int tcq
, int ndev
,
64 scsi_completionfn complete
);
65 void scsi_qdev_register(SCSIDeviceInfo
*info
);
67 static inline SCSIBus
*scsi_bus_from_device(SCSIDevice
*d
)
69 return DO_UPCAST(SCSIBus
, qbus
, d
->qdev
.parent_bus
);
72 SCSIDevice
*scsi_bus_legacy_add_drive(SCSIBus
*bus
, DriveInfo
*dinfo
, int unit
);
73 void scsi_bus_legacy_handle_cmdline(SCSIBus
*bus
);