8 SCSI_REASON_DONE
, /* Command complete. */
9 SCSI_REASON_DATA
/* Transfer complete, more data required. */
12 typedef struct SCSIBus SCSIBus
;
13 typedef struct SCSIDevice SCSIDevice
;
14 typedef struct SCSIDeviceInfo SCSIDeviceInfo
;
15 typedef void (*scsi_completionfn
)(SCSIBus
*bus
, int reason
, uint32_t tag
,
26 int cdrom_read_toc(int nb_sectors
, uint8_t *buf
, int msf
, int start_track
);
27 int cdrom_read_toc_raw(int nb_sectors
, uint8_t *buf
, int msf
, int session_num
);
30 typedef int (*scsi_qdev_initfn
)(SCSIDevice
*dev
);
31 struct SCSIDeviceInfo
{
33 scsi_qdev_initfn init
;
34 void (*destroy
)(SCSIDevice
*s
);
35 int32_t (*send_command
)(SCSIDevice
*s
, uint32_t tag
, uint8_t *buf
,
37 void (*read_data
)(SCSIDevice
*s
, uint32_t tag
);
38 int (*write_data
)(SCSIDevice
*s
, uint32_t tag
);
39 void (*cancel_io
)(SCSIDevice
*s
, uint32_t tag
);
40 uint8_t *(*get_buf
)(SCSIDevice
*s
, uint32_t tag
);
43 typedef void (*SCSIAttachFn
)(DeviceState
*host
, BlockDriverState
*bdrv
,
50 scsi_completionfn complete
;
55 SCSIBus
*scsi_bus_new(DeviceState
*host
, int tcq
, int ndev
,
56 scsi_completionfn complete
);
57 void scsi_qdev_register(SCSIDeviceInfo
*info
);
59 static inline SCSIBus
*scsi_bus_from_device(SCSIDevice
*d
)
61 return DO_UPCAST(SCSIBus
, qbus
, d
->qdev
.parent_bus
);
64 SCSIDevice
*scsi_bus_legacy_add_drive(SCSIBus
*bus
, DriveInfo
*dinfo
, int unit
);
65 void scsi_bus_legacy_handle_cmdline(SCSIBus
*bus
);