Signed-off-by: Don Koch <dk...@verizon.com> --- hw/scsi/scsi-bus.c | 16 ++++++++++++++++ trace-events | 10 ++++++++++ 2 files changed, 26 insertions(+)
diff --git a/hw/scsi/scsi-bus.c b/hw/scsi/scsi-bus.c index 24f7b74..5604b87 100644 --- a/hw/scsi/scsi-bus.c +++ b/hw/scsi/scsi-bus.c @@ -278,6 +278,7 @@ void scsi_bus_legacy_handle_cmdline(SCSIBus *bus, Error **errp) static int32_t scsi_invalid_field(SCSIRequest *req, uint8_t *buf) { + trace_scsi_err_invalid_field(req); scsi_req_build_sense(req, SENSE_CODE(INVALID_FIELD)); scsi_req_complete(req, CHECK_CONDITION); return 0; @@ -292,6 +293,7 @@ static const struct SCSIReqOps reqops_invalid_field = { static int32_t scsi_invalid_command(SCSIRequest *req, uint8_t *buf) { + trace_scsi_err_invalid_command(req); scsi_req_build_sense(req, SENSE_CODE(INVALID_OPCODE)); scsi_req_complete(req, CHECK_CONDITION); return 0; @@ -306,6 +308,10 @@ static const struct SCSIReqOps reqops_invalid_opcode = { static int32_t scsi_unit_attention(SCSIRequest *req, uint8_t *buf) { + trace_scsi_err_unit_attention(req, + (req->dev && req->dev->unit_attention.key == UNIT_ATTENTION), + (req->bus && req->bus->unit_attention.key == UNIT_ATTENTION)); + if (req->dev->unit_attention.key == UNIT_ATTENTION) { scsi_req_build_sense(req, req->dev->unit_attention); } else if (req->bus->unit_attention.key == UNIT_ATTENTION) { @@ -391,6 +397,7 @@ static bool scsi_target_emulate_report_luns(SCSITargetReq *r) } assert(i == n + 8); r->len = len; + trace_scsi_report_luns_extra(channel, id, i, n, found_lun0, len); return true; } @@ -402,6 +409,7 @@ static bool scsi_target_emulate_inquiry(SCSITargetReq *r) if (r->req.cmd.buf[1] & 0x2) { /* Command support data - optional, not implemented */ + trace_scsi_inquiry_err_support(r->req.lun, r->req.dev->lun); return false; } @@ -421,6 +429,8 @@ static bool scsi_target_emulate_inquiry(SCSITargetReq *r) break; } default: + trace_scsi_inquiry_err_page_code(r->req.lun, r->req.dev->lun, + page_code); return false; } /* done with EVPD */ @@ -431,6 +441,8 @@ static bool scsi_target_emulate_inquiry(SCSITargetReq *r) /* Standard INQUIRY data */ if (r->req.cmd.buf[2] != 0) { + trace_scsi_inquiry_err_standard(r->req.lun, r->req.dev->lun, + r->req.cmd.buf[2]); return false; } @@ -481,10 +493,12 @@ static int32_t scsi_target_send_command(SCSIRequest *req, uint8_t *buf) case TEST_UNIT_READY: break; default: + trace_scsi_err_lun_not_supported(req); scsi_req_build_sense(req, SENSE_CODE(LUN_NOT_SUPPORTED)); scsi_req_complete(req, CHECK_CONDITION); return 0; illegal_request: + trace_scsi_err_illegal_field(req); scsi_req_build_sense(req, SENSE_CODE(INVALID_FIELD)); scsi_req_complete(req, CHECK_CONDITION); return 0; @@ -691,6 +705,8 @@ static void scsi_clear_unit_attention(SCSIRequest *req) return; } + trace_scsi_clear_unit_attention(req, (req->dev && + ua == &req->dev->unit_attention)); *ua = SENSE_CODE(NO_SENSE); } diff --git a/trace-events b/trace-events index 43fb0db..6c8f26a 100644 --- a/trace-events +++ b/trace-events @@ -587,6 +587,16 @@ scsi_report_luns(int target, int lun, int tag) "target %d lun %d tag %d" scsi_inquiry(int target, int lun, int tag, int cdb1, int cdb2) "target %d lun %d tag %d page %#02x/%#02x" scsi_test_unit_ready(int target, int lun, int tag) "target %d lun %d tag %d" scsi_request_sense(int target, int lun, int tag) "target %d lun %d tag %d" +scsi_report_luns_extra(int channel, int id, int i, int n, int found_lun0, int len) "channel=%d id=%d i=%d n=%d found_lun0=%d len=%d" +scsi_err_invalid_field(void *req) "req=%p" +scsi_err_invalid_command(void *req) "req=%p" +scsi_err_unit_attention(void *req, int dev_attention, int bus_attention) "req=%p dev_attention=%d bus_attention=%d" +scsi_err_lun_not_supported(void *req) "req=%p" +scsi_err_illegal_field(void *req) "req=%p" +scsi_clear_unit_attention(void *req, int isdev) "req=%p isdev=%d" +scsi_inquiry_err_support(int reqlun, int devlun) "req.lun=%u dev.lun=%u" +scsi_inquiry_err_page_code(int reqlun, int devlun, int page_code) "req.lun=%u dev.lun=%u page_code=0x%x" +scsi_inquiry_err_standard(int reqlun, int devlun, int cmd2) "req.lun=%u dev.lun=%u buf[2]=%u" # hw/scsi/scsi-disk.c scsi_disk_inquiry_err_standard(int buf2) "buf[2]=%u" -- 1.8.3.1