Lines Matching refs:lun

30                                        int channel, int id, int lun,  in do_scsi_device_find()  argument
41 if (dev->lun == lun) { in do_scsi_device_find()
71 SCSIDevice *scsi_device_find(SCSIBus *bus, int channel, int id, int lun) in scsi_device_find() argument
74 return do_scsi_device_find(bus, channel, id, lun, false); in scsi_device_find()
77 SCSIDevice *scsi_device_get(SCSIBus *bus, int channel, int id, int lun) in scsi_device_get() argument
81 d = do_scsi_device_find(bus, channel, id, lun, false); in scsi_device_get()
247 static SCSIRequest *scsi_device_alloc_req(SCSIDevice *s, uint32_t tag, uint32_t lun, in scsi_device_alloc_req() argument
252 return sc->alloc_req(s, tag, lun, buf, hba_private); in scsi_device_alloc_req()
315 int channel, int target, int lun, in scsi_bus_is_address_free() argument
321 d = do_scsi_device_find(bus, channel, target, lun, true); in scsi_bus_is_address_free()
322 if (d && d->lun == lun) { in scsi_bus_is_address_free()
347 if (dev->lun != -1 && dev->lun > bus->info->max_lun) { in scsi_bus_check_address()
348 error_setg(errp, "bad scsi device lun: %d", dev->lun); in scsi_bus_check_address()
352 if (dev->id != -1 && dev->lun != -1) { in scsi_bus_check_address()
354 if (!scsi_bus_is_address_free(bus, dev->channel, dev->id, dev->lun, &d)) { in scsi_bus_check_address()
372 if (dev->lun == -1) { in scsi_qdev_realize()
373 dev->lun = 0; in scsi_qdev_realize()
376 is_free = scsi_bus_is_address_free(bus, dev->channel, ++id, dev->lun, NULL); in scsi_qdev_realize()
383 } else if (dev->lun == -1) { in scsi_qdev_realize()
384 int lun = -1; in scsi_qdev_realize() local
386 is_free = scsi_bus_is_address_free(bus, dev->channel, dev->id, ++lun, NULL); in scsi_qdev_realize()
387 } while (!is_free && lun < bus->info->max_lun); in scsi_qdev_realize()
392 dev->lun = lun; in scsi_qdev_realize()
577 static void store_lun(uint8_t *outbuf, int lun) in store_lun() argument
579 if (lun < 256) { in store_lun()
582 outbuf[1] = lun; in store_lun()
585 outbuf[0] = 0x40 | (lun >> 8); in store_lun()
586 outbuf[1] = (lun & 255); in store_lun()
624 if (dev->channel == channel && dev->id == id && dev->lun != 0 && in scsi_target_emulate_report_luns()
626 store_lun(tmp, dev->lun); in scsi_target_emulate_report_luns()
652 assert(r->req.dev->lun != r->req.lun); in scsi_target_emulate_inquiry()
693 if (r->req.lun != 0) { in scsi_target_emulate_inquiry()
721 if (req->lun != 0 && in scsi_target_send_command()
740 if (req->lun != 0) { in scsi_target_send_command()
822 uint32_t tag, uint32_t lun, void *hba_private) in scsi_req_alloc() argument
836 req->lun = lun; in scsi_req_alloc()
849 trace_scsi_req_alloc(req->dev->id, req->lun, req->tag); in scsi_req_alloc()
853 SCSIRequest *scsi_req_new(SCSIDevice *d, uint32_t tag, uint32_t lun, in scsi_req_new() argument
864 trace_scsi_req_parse_bad(d->id, lun, tag, 0); in scsi_req_new()
881 } else if (lun != d->lun || in scsi_req_new()
896 trace_scsi_req_parse_bad(d->id, lun, tag, buf[0]); in scsi_req_new()
898 req = scsi_req_alloc(&reqops_invalid_opcode, d, tag, lun, hba_private); in scsi_req_new()
901 trace_scsi_req_parsed(d->id, lun, tag, buf[0], in scsi_req_new()
904 trace_scsi_req_parsed_lba(d->id, lun, tag, buf[0], in scsi_req_new()
909 req = scsi_req_alloc(&reqops_invalid_field, d, tag, lun, hba_private); in scsi_req_new()
911 req = scsi_req_alloc(ops, d, tag, lun, hba_private); in scsi_req_new()
913 req = scsi_device_alloc_req(d, tag, lun, buf, hba_private); in scsi_req_new()
923 trace_scsi_inquiry(d->id, lun, tag, cmd.buf[1], cmd.buf[2]); in scsi_req_new()
926 trace_scsi_test_unit_ready(d->id, lun, tag); in scsi_req_new()
929 trace_scsi_report_luns(d->id, lun, tag); in scsi_req_new()
932 trace_scsi_request_sense(d->id, lun, tag); in scsi_req_new()
999 trace_scsi_req_build_sense(req->dev->id, req->lun, req->tag, in scsi_req_build_sense()
1034 trace_scsi_req_dequeue(req->dev->id, req->lun, req->tag); in scsi_req_dequeue()
1528 trace_scsi_req_continue_canceled(req->dev->id, req->lun, req->tag); in scsi_req_continue()
1531 trace_scsi_req_continue(req->dev->id, req->lun, req->tag); in scsi_req_continue()
1546 trace_scsi_req_data_canceled(req->dev->id, req->lun, req->tag, len); in scsi_req_data()
1549 trace_scsi_req_data(req->dev->id, req->lun, req->tag, len); in scsi_req_data()
1675 trace_scsi_req_cancel(req->dev->id, req->lun, req->tag); in scsi_req_cancel_async()
1700 trace_scsi_req_cancel(req->dev->id, req->lun, req->tag); in scsi_req_cancel()
1769 trace_scsi_device_set_ua(sdev->id, sdev->lun, sense.key, in scsi_device_set_ua()
1854 path = g_strdup_printf("%s/%d:%d:%d", id, d->channel, d->id, d->lun); in scsibus_get_dev_path()
1856 path = g_strdup_printf("%d:%d:%d", d->channel, d->id, d->lun); in scsibus_get_dev_path()
1866 qdev_fw_name(dev), d->id, d->lun); in scsibus_get_fw_dev_path()
1882 qemu_put_be32s(f, &req->lun); in put_scsi_req()
1911 uint32_t lun; in get_scsi_requests() local
1916 qemu_get_be32s(f, &lun); in get_scsi_requests()
1921 req = scsi_req_new(s, tag, lun, buf, sizeof(buf), NULL); in get_scsi_requests()
2001 DEFINE_PROP_UINT32("lun", SCSIDevice, lun, -1),