Revision 5c6c0e51 hw/scsi.h
b/hw/scsi.h | ||
---|---|---|
19 | 19 |
typedef struct SCSIBusOps SCSIBusOps; |
20 | 20 |
typedef struct SCSIDevice SCSIDevice; |
21 | 21 |
typedef struct SCSIDeviceInfo SCSIDeviceInfo; |
22 |
typedef struct SCSIRequest SCSIRequest; |
|
22 | 23 |
|
23 | 24 |
enum SCSIXferMode { |
24 | 25 |
SCSI_XFER_NONE, /* TEST_UNIT_READY, ... */ |
... | ... | |
26 | 27 |
SCSI_XFER_TO_DEV, /* WRITE, MODE_SELECT, ... */ |
27 | 28 |
}; |
28 | 29 |
|
29 |
typedef struct SCSIRequest {
|
|
30 |
struct SCSIRequest { |
|
30 | 31 |
SCSIBus *bus; |
31 | 32 |
SCSIDevice *dev; |
32 | 33 |
uint32_t refcount; |
... | ... | |
43 | 44 |
BlockDriverAIOCB *aiocb; |
44 | 45 |
bool enqueued; |
45 | 46 |
QTAILQ_ENTRY(SCSIRequest) next; |
46 |
} SCSIRequest;
|
|
47 |
}; |
|
47 | 48 |
|
48 | 49 |
struct SCSIDevice |
49 | 50 |
{ |
... | ... | |
66 | 67 |
DeviceInfo qdev; |
67 | 68 |
scsi_qdev_initfn init; |
68 | 69 |
void (*destroy)(SCSIDevice *s); |
70 |
SCSIRequest *(*alloc_req)(SCSIDevice *s, uint32_t tag, uint32_t lun); |
|
69 | 71 |
void (*free_req)(SCSIRequest *req); |
70 |
int32_t (*send_command)(SCSIDevice *s, uint32_t tag, uint8_t *buf, |
|
71 |
int lun); |
|
72 |
void (*read_data)(SCSIDevice *s, uint32_t tag); |
|
73 |
int (*write_data)(SCSIDevice *s, uint32_t tag); |
|
74 |
void (*cancel_io)(SCSIDevice *s, uint32_t tag); |
|
75 |
uint8_t *(*get_buf)(SCSIDevice *s, uint32_t tag); |
|
72 |
int32_t (*send_command)(SCSIRequest *req, uint8_t *buf); |
|
73 |
void (*read_data)(SCSIRequest *req); |
|
74 |
int (*write_data)(SCSIRequest *req); |
|
75 |
void (*cancel_io)(SCSIRequest *req); |
|
76 |
uint8_t *(*get_buf)(SCSIRequest *req); |
|
76 | 77 |
}; |
77 | 78 |
|
78 | 79 |
struct SCSIBusOps { |
79 |
void (*complete)(SCSIBus *bus, int reason, uint32_t tag, uint32_t arg);
|
|
80 |
void (*complete)(SCSIRequest *req, int reason, uint32_t arg);
|
|
80 | 81 |
}; |
81 | 82 |
|
82 | 83 |
struct SCSIBus { |
... | ... | |
103 | 104 |
int scsi_bus_legacy_handle_cmdline(SCSIBus *bus); |
104 | 105 |
|
105 | 106 |
SCSIRequest *scsi_req_alloc(size_t size, SCSIDevice *d, uint32_t tag, uint32_t lun); |
106 |
SCSIRequest *scsi_req_find(SCSIDevice *d, uint32_t tag);
|
|
107 |
void scsi_req_enqueue(SCSIRequest *req);
|
|
107 | 108 |
void scsi_req_free(SCSIRequest *req); |
108 | 109 |
void scsi_req_dequeue(SCSIRequest *req); |
109 | 110 |
SCSIRequest *scsi_req_ref(SCSIRequest *req); |
Also available in: Unified diff