Lines Matching +full:use +full:- +full:ring +full:- +full:sense

9  * http://lists.gnu.org/archive/html/qemu-devel/2011-08/msg00729.html
17 * See the COPYING file in the top-level directory.
19 * NOTE about MSI-X:
20 * MSI-X support has been removed for the moment because it leads Windows OS
22 * MSI-X shared memory to be part of the same BAR used for rings state
24 * BAR created from MSI-X purposes. Windows driver fails to deal with 2 BARs.
30 #include "qemu/main-loop.h"
36 #include "hw/qdev-properties.h"
54 ldl_le_pci_dma(&container_of(m, PVSCSIState, rings)->parent_obj, \
55 (m)->rs_pa + offsetof(struct PVSCSIRingsState, field), \
58 (stl_le_pci_dma(&container_of(m, PVSCSIState, rings)->parent_obj, \
59 (m)->rs_pa + offsetof(struct PVSCSIRingsState, field), val, \
80 ((s)->compat_flags & PVSCSI_COMPAT_OLD_PCI_CONFIGURATION)
126 uint8_t msg_ring_info_valid; /* Whether message ring initialized */
127 uint8_t use_msg; /* Whether to use message ring */
166 m->rs_pa = ri->ringsStatePPN << VMW_PAGE_SHIFT; in pvscsi_ring_init_data()
168 req_ring_size = ri->reqRingNumPages * PVSCSI_MAX_NUM_REQ_ENTRIES_PER_PAGE; in pvscsi_ring_init_data()
169 cmp_ring_size = ri->cmpRingNumPages * PVSCSI_MAX_NUM_CMP_ENTRIES_PER_PAGE; in pvscsi_ring_init_data()
170 txr_len_log2 = pvscsi_log2(req_ring_size - 1); in pvscsi_ring_init_data()
171 rxr_len_log2 = pvscsi_log2(cmp_ring_size - 1); in pvscsi_ring_init_data()
173 m->txr_len_mask = MASK(txr_len_log2); in pvscsi_ring_init_data()
174 m->rxr_len_mask = MASK(rxr_len_log2); in pvscsi_ring_init_data()
176 m->consumed_ptr = 0; in pvscsi_ring_init_data()
177 m->filled_cmp_ptr = 0; in pvscsi_ring_init_data()
179 for (i = 0; i < ri->reqRingNumPages; i++) { in pvscsi_ring_init_data()
180 m->req_ring_pages_pa[i] = ri->reqRingPPNs[i] << VMW_PAGE_SHIFT; in pvscsi_ring_init_data()
183 for (i = 0; i < ri->cmpRingNumPages; i++) { in pvscsi_ring_init_data()
184 m->cmp_ring_pages_pa[i] = ri->cmpRingPPNs[i] << VMW_PAGE_SHIFT; in pvscsi_ring_init_data()
197 /* Flush ring state page changes */ in pvscsi_ring_init_data()
208 if (!ri->numPages || ri->numPages > PVSCSI_SETUP_MSG_RING_MAX_NUM_PAGES) { in pvscsi_ring_init_msg()
209 return -1; in pvscsi_ring_init_msg()
211 ring_size = ri->numPages * PVSCSI_MAX_NUM_MSG_ENTRIES_PER_PAGE; in pvscsi_ring_init_msg()
212 len_log2 = pvscsi_log2(ring_size - 1); in pvscsi_ring_init_msg()
214 m->msg_len_mask = MASK(len_log2); in pvscsi_ring_init_msg()
216 m->filled_msg_ptr = 0; in pvscsi_ring_init_msg()
218 for (i = 0; i < ri->numPages; i++) { in pvscsi_ring_init_msg()
219 m->msg_ring_pages_pa[i] = ri->ringPPNs[i] << VMW_PAGE_SHIFT; in pvscsi_ring_init_msg()
228 /* Flush ring state page changes */ in pvscsi_ring_init_msg()
237 mgr->rs_pa = 0; in pvscsi_ring_cleanup()
238 mgr->txr_len_mask = 0; in pvscsi_ring_cleanup()
239 mgr->rxr_len_mask = 0; in pvscsi_ring_cleanup()
240 mgr->msg_len_mask = 0; in pvscsi_ring_cleanup()
241 mgr->consumed_ptr = 0; in pvscsi_ring_cleanup()
242 mgr->filled_cmp_ptr = 0; in pvscsi_ring_cleanup()
243 mgr->filled_msg_ptr = 0; in pvscsi_ring_cleanup()
244 memset(mgr->req_ring_pages_pa, 0, sizeof(mgr->req_ring_pages_pa)); in pvscsi_ring_cleanup()
245 memset(mgr->cmp_ring_pages_pa, 0, sizeof(mgr->cmp_ring_pages_pa)); in pvscsi_ring_cleanup()
246 memset(mgr->msg_ring_pages_pa, 0, sizeof(mgr->msg_ring_pages_pa)); in pvscsi_ring_cleanup()
257 if (ready_ptr != mgr->consumed_ptr in pvscsi_ring_pop_req_descr()
258 && ready_ptr - mgr->consumed_ptr < ring_size) { in pvscsi_ring_pop_req_descr()
260 mgr->consumed_ptr++ & mgr->txr_len_mask; in pvscsi_ring_pop_req_descr()
266 return mgr->req_ring_pages_pa[next_ready_page] + in pvscsi_ring_pop_req_descr()
276 RS_SET_FIELD(mgr, reqConsIdx, mgr->consumed_ptr); in pvscsi_ring_flush_req()
291 mgr->filled_cmp_ptr++ & mgr->rxr_len_mask; in pvscsi_ring_pop_cmp_descr()
296 return mgr->cmp_ring_pages_pa[free_cmp_page] + in pvscsi_ring_pop_cmp_descr()
304 mgr->filled_msg_ptr++ & mgr->msg_len_mask; in pvscsi_ring_pop_msg_descr()
309 return mgr->msg_ring_pages_pa[free_msg_page] + in pvscsi_ring_pop_msg_descr()
319 trace_pvscsi_ring_flush_cmp(mgr->filled_cmp_ptr); in pvscsi_ring_flush_cmp()
321 RS_SET_FIELD(mgr, cmpProdIdx, mgr->filled_cmp_ptr); in pvscsi_ring_flush_cmp()
333 return (prodIdx - consIdx) < (mgr->msg_len_mask + 1); in pvscsi_ring_msg_has_room()
342 trace_pvscsi_ring_flush_msg(mgr->filled_msg_ptr); in pvscsi_ring_flush_msg()
344 RS_SET_FIELD(mgr, msgProdIdx, mgr->filled_msg_ptr); in pvscsi_ring_flush_msg()
350 s->curr_cmd = PVSCSI_CMD_FIRST; in pvscsi_reset_state()
351 s->curr_cmd_data_cntr = 0; in pvscsi_reset_state()
352 s->reg_command_status = PVSCSI_COMMAND_PROCESSING_SUCCEEDED; in pvscsi_reset_state()
353 s->reg_interrupt_status = 0; in pvscsi_reset_state()
354 pvscsi_ring_cleanup(&s->rings); in pvscsi_reset_state()
355 s->rings_info_valid = FALSE; in pvscsi_reset_state()
356 s->msg_ring_info_valid = FALSE; in pvscsi_reset_state()
357 QTAILQ_INIT(&s->pending_queue); in pvscsi_reset_state()
358 QTAILQ_INIT(&s->completion_queue); in pvscsi_reset_state()
365 bool should_raise = s->reg_interrupt_enabled & s->reg_interrupt_status; in pvscsi_update_irq_status()
367 trace_pvscsi_update_irq_level(should_raise, s->reg_interrupt_enabled, in pvscsi_update_irq_status()
368 s->reg_interrupt_status); in pvscsi_update_irq_status()
384 s->reg_interrupt_status |= PVSCSI_INTR_CMPL_0; in pvscsi_raise_completion_interrupt()
395 s->reg_interrupt_status |= PVSCSI_INTR_MSG_0; in pvscsi_raise_message_interrupt()
408 cmp_descr_pa = pvscsi_ring_pop_cmp_descr(&s->rings); in pvscsi_cmp_ring_put()
418 msg_descr_pa = pvscsi_ring_pop_msg_descr(&s->rings); in pvscsi_msg_ring_put()
430 while (!QTAILQ_EMPTY(&s->completion_queue)) { in pvscsi_process_completion_queue()
431 pvscsi_req = QTAILQ_FIRST(&s->completion_queue); in pvscsi_process_completion_queue()
432 QTAILQ_REMOVE(&s->completion_queue, pvscsi_req, next); in pvscsi_process_completion_queue()
433 pvscsi_cmp_ring_put(s, &pvscsi_req->cmp); in pvscsi_process_completion_queue()
439 pvscsi_ring_flush_cmp(&s->rings); in pvscsi_process_completion_queue()
447 s->resetting++; in pvscsi_reset_adapter()
448 bus_cold_reset(BUS(&s->bus)); in pvscsi_reset_adapter()
449 s->resetting--; in pvscsi_reset_adapter()
451 assert(QTAILQ_EMPTY(&s->pending_queue)); in pvscsi_reset_adapter()
458 /* Try putting more complete requests on the ring. */ in pvscsi_schedule_completion_processing()
459 if (!QTAILQ_EMPTY(&s->completion_queue)) { in pvscsi_schedule_completion_processing()
460 qemu_bh_schedule(s->completion_worker); in pvscsi_schedule_completion_processing()
467 assert(!r->completed); in pvscsi_complete_request()
469 trace_pvscsi_complete_request(r->cmp.context, r->cmp.dataLen, in pvscsi_complete_request()
470 r->sense_key); in pvscsi_complete_request()
471 if (r->sreq != NULL) { in pvscsi_complete_request()
472 scsi_req_unref(r->sreq); in pvscsi_complete_request()
473 r->sreq = NULL; in pvscsi_complete_request()
475 r->completed = 1; in pvscsi_complete_request()
476 QTAILQ_REMOVE(&s->pending_queue, r, next); in pvscsi_complete_request()
477 QTAILQ_INSERT_TAIL(&s->completion_queue, r, next); in pvscsi_complete_request()
483 PVSCSIRequest *req = r->hba_private; in pvscsi_get_sg_list()
485 trace_pvscsi_get_sg_list(req->sgl.nsg, req->sgl.size); in pvscsi_get_sg_list()
487 return &req->sgl; in pvscsi_get_sg_list()
495 cpu_physical_memory_read(sg->elemAddr, &elem, sizeof(elem)); in pvscsi_get_next_sg_elem()
506 sg->elemAddr += sizeof(elem); in pvscsi_get_next_sg_elem()
507 sg->dataAddr = elem.addr; in pvscsi_get_next_sg_elem()
508 sg->resid = elem.length; in pvscsi_get_next_sg_elem()
512 pvscsi_write_sense(PVSCSIRequest *r, uint8_t *sense, int len) in pvscsi_write_sense() argument
514 r->cmp.senseLen = MIN(r->req.senseLen, len); in pvscsi_write_sense()
515 r->sense_key = sense[(sense[0] & 2) ? 1 : 2]; in pvscsi_write_sense()
516 cpu_physical_memory_write(r->req.senseAddr, sense, r->cmp.senseLen); in pvscsi_write_sense()
522 PVSCSIRequest *pvscsi_req = req->hba_private; in pvscsi_command_failed()
526 trace_pvscsi_command_complete_not_found(req->tag); in pvscsi_command_failed()
529 s = pvscsi_req->dev; in pvscsi_command_failed()
531 switch (req->host_status) { in pvscsi_command_failed()
533 pvscsi_req->cmp.hostStatus = BTSTAT_LUNMISMATCH; in pvscsi_command_failed()
536 pvscsi_req->cmp.hostStatus = BTSTAT_ABORTQUEUE; in pvscsi_command_failed()
540 pvscsi_req->cmp.hostStatus = BTSTAT_SENTRST; in pvscsi_command_failed()
543 pvscsi_req->cmp.hostStatus = BTSTAT_SELTIMEO; in pvscsi_command_failed()
546 pvscsi_req->cmp.hostStatus = BTSTAT_BUSRESET; in pvscsi_command_failed()
549 pvscsi_req->cmp.hostStatus = BTSTAT_HASOFTWARE; in pvscsi_command_failed()
552 pvscsi_req->cmp.scsiStatus = GOOD; in pvscsi_command_failed()
553 qemu_sglist_destroy(&pvscsi_req->sgl); in pvscsi_command_failed()
560 PVSCSIRequest *pvscsi_req = req->hba_private; in pvscsi_command_complete()
564 trace_pvscsi_command_complete_not_found(req->tag); in pvscsi_command_complete()
567 s = pvscsi_req->dev; in pvscsi_command_complete()
572 pvscsi_req->cmp.hostStatus = BTSTAT_DATARUN; in pvscsi_command_complete()
575 pvscsi_req->cmp.scsiStatus = req->status; in pvscsi_command_complete()
576 if (pvscsi_req->cmp.scsiStatus == CHECK_CONDITION) { in pvscsi_command_complete()
577 uint8_t sense[SCSI_SENSE_BUF_SIZE]; in pvscsi_command_complete() local
579 scsi_req_get_sense(pvscsi_req->sreq, sense, sizeof(sense)); in pvscsi_command_complete()
582 pvscsi_write_sense(pvscsi_req, sense, sense_len); in pvscsi_command_complete()
584 qemu_sglist_destroy(&pvscsi_req->sgl); in pvscsi_command_complete()
591 if (s->msg_ring_info_valid && pvscsi_ring_msg_has_room(&s->rings)) { in pvscsi_send_msg()
595 msg.bus = dev->channel; in pvscsi_send_msg()
596 msg.target = dev->id; in pvscsi_send_msg()
597 msg.lun[1] = dev->lun; in pvscsi_send_msg()
600 pvscsi_ring_flush_msg(&s->rings); in pvscsi_send_msg()
625 PVSCSIRequest *pvscsi_req = req->hba_private; in pvscsi_request_cancelled()
626 PVSCSIState *s = pvscsi_req->dev; in pvscsi_request_cancelled()
628 if (pvscsi_req->completed) { in pvscsi_request_cancelled()
632 if (pvscsi_req->dev->resetting) { in pvscsi_request_cancelled()
633 pvscsi_req->cmp.hostStatus = BTSTAT_BUSRESET; in pvscsi_request_cancelled()
635 pvscsi_req->cmp.hostStatus = BTSTAT_ABORTQUEUE; in pvscsi_request_cancelled()
651 return scsi_device_find(&s->bus, channel, target, *target_lun); in pvscsi_device_find()
663 pvscsi_req->dev = s; in pvscsi_queue_pending_descriptor()
664 pvscsi_req->req = *descr; in pvscsi_queue_pending_descriptor()
665 pvscsi_req->cmp.context = pvscsi_req->req.context; in pvscsi_queue_pending_descriptor()
666 QTAILQ_INSERT_TAIL(&s->pending_queue, pvscsi_req, next); in pvscsi_queue_pending_descriptor()
668 *d = pvscsi_device_find(s, descr->bus, descr->target, descr->lun, &lun); in pvscsi_queue_pending_descriptor()
670 pvscsi_req->lun = lun; in pvscsi_queue_pending_descriptor()
680 uint64_t data_length = r->req.dataLen; in pvscsi_convert_sglist()
681 PVSCSISGState sg = r->sg; in pvscsi_convert_sglist()
685 trace_pvscsi_convert_sglist(r->req.context, r->sg.dataAddr, in pvscsi_convert_sglist()
686 r->sg.resid); in pvscsi_convert_sglist()
690 qemu_sglist_add(&r->sgl, sg.dataAddr, chunk_size); in pvscsi_convert_sglist()
694 data_length -= chunk_size; in pvscsi_convert_sglist()
695 sg.resid -= chunk_size; in pvscsi_convert_sglist()
704 pci_dma_sglist_init(&r->sgl, d, 1); in pvscsi_build_sglist()
705 if (r->req.flags & PVSCSI_FLAG_CMD_WITH_SG_LIST) { in pvscsi_build_sglist()
708 qemu_sglist_add(&r->sgl, r->req.dataAddr, r->req.dataLen); in pvscsi_build_sglist()
720 trace_pvscsi_process_req_descr(descr->cdb[0], descr->context); in pvscsi_process_request_descriptor()
723 r->cmp.hostStatus = BTSTAT_SELTIMEO; in pvscsi_process_request_descriptor()
729 if (descr->flags & PVSCSI_FLAG_CMD_WITH_SG_LIST) { in pvscsi_process_request_descriptor()
730 r->sg.elemAddr = descr->dataAddr; in pvscsi_process_request_descriptor()
733 r->sreq = scsi_req_new(d, descr->context, r->lun, descr->cdb, descr->cdbLen, r); in pvscsi_process_request_descriptor()
734 if (r->sreq->cmd.mode == SCSI_XFER_FROM_DEV && in pvscsi_process_request_descriptor()
735 (descr->flags & PVSCSI_FLAG_CMD_DIR_TODEVICE)) { in pvscsi_process_request_descriptor()
736 r->cmp.hostStatus = BTSTAT_BADMSG; in pvscsi_process_request_descriptor()
738 scsi_req_cancel(r->sreq); in pvscsi_process_request_descriptor()
741 if (r->sreq->cmd.mode == SCSI_XFER_TO_DEV && in pvscsi_process_request_descriptor()
742 (descr->flags & PVSCSI_FLAG_CMD_DIR_TOHOST)) { in pvscsi_process_request_descriptor()
743 r->cmp.hostStatus = BTSTAT_BADMSG; in pvscsi_process_request_descriptor()
745 scsi_req_cancel(r->sreq); in pvscsi_process_request_descriptor()
750 n = scsi_req_enqueue(r->sreq); in pvscsi_process_request_descriptor()
753 scsi_req_continue(r->sreq); in pvscsi_process_request_descriptor()
763 if (!s->rings_info_valid) { in pvscsi_process_io()
767 while ((next_descr_pa = pvscsi_ring_pop_req_descr(&s->rings)) != 0) { in pvscsi_process_io()
777 pvscsi_ring_flush_req(&s->rings); in pvscsi_process_io()
784 trace_pvscsi_tx_rings_ppn("Rings State", rc->ringsStatePPN); in pvscsi_dbg_dump_tx_rings_config()
786 trace_pvscsi_tx_rings_num_pages("Request Ring", rc->reqRingNumPages); in pvscsi_dbg_dump_tx_rings_config()
787 for (i = 0; i < rc->reqRingNumPages; i++) { in pvscsi_dbg_dump_tx_rings_config()
788 trace_pvscsi_tx_rings_ppn("Request Ring", rc->reqRingPPNs[i]); in pvscsi_dbg_dump_tx_rings_config()
791 trace_pvscsi_tx_rings_num_pages("Confirm Ring", rc->cmpRingNumPages); in pvscsi_dbg_dump_tx_rings_config()
792 for (i = 0; i < rc->cmpRingNumPages; i++) { in pvscsi_dbg_dump_tx_rings_config()
793 trace_pvscsi_tx_rings_ppn("Confirm Ring", rc->cmpRingPPNs[i]); in pvscsi_dbg_dump_tx_rings_config()
822 (PVSCSICmdDescSetupRings *) s->curr_cmd_data; in pvscsi_on_cmd_setup_rings()
826 if (!rc->reqRingNumPages in pvscsi_on_cmd_setup_rings()
827 || rc->reqRingNumPages > PVSCSI_SETUP_RINGS_MAX_NUM_PAGES in pvscsi_on_cmd_setup_rings()
828 || !rc->cmpRingNumPages in pvscsi_on_cmd_setup_rings()
829 || rc->cmpRingNumPages > PVSCSI_SETUP_RINGS_MAX_NUM_PAGES) { in pvscsi_on_cmd_setup_rings()
834 pvscsi_ring_init_data(&s->rings, rc); in pvscsi_on_cmd_setup_rings()
836 s->rings_info_valid = TRUE; in pvscsi_on_cmd_setup_rings()
843 PVSCSICmdDescAbortCmd *cmd = (PVSCSICmdDescAbortCmd *) s->curr_cmd_data; in pvscsi_on_cmd_abort()
846 trace_pvscsi_on_cmd_abort(cmd->context, cmd->target); in pvscsi_on_cmd_abort()
848 QTAILQ_FOREACH_SAFE(r, &s->pending_queue, next, next) { in pvscsi_on_cmd_abort()
849 if (r->req.context == cmd->context) { in pvscsi_on_cmd_abort()
854 assert(!r->completed); in pvscsi_on_cmd_abort()
855 r->cmp.hostStatus = BTSTAT_ABORTQUEUE; in pvscsi_on_cmd_abort()
856 scsi_req_cancel(r->sreq); in pvscsi_on_cmd_abort()
865 trace_pvscsi_on_cmd_unknown_data(s->curr_cmd_data[0]); in pvscsi_on_cmd_unknown()
874 (struct PVSCSICmdDescResetDevice *) s->curr_cmd_data; in pvscsi_on_cmd_reset_device()
877 sdev = pvscsi_device_find(s, 0, cmd->target, cmd->lun, &target_lun); in pvscsi_on_cmd_reset_device()
879 trace_pvscsi_on_cmd_reset_dev(cmd->target, (int) target_lun, sdev); in pvscsi_on_cmd_reset_device()
882 s->resetting++; in pvscsi_on_cmd_reset_device()
883 device_cold_reset(&sdev->qdev); in pvscsi_on_cmd_reset_device()
884 s->resetting--; in pvscsi_on_cmd_reset_device()
896 s->resetting++; in pvscsi_on_cmd_reset_bus()
897 bus_cold_reset(BUS(&s->bus)); in pvscsi_on_cmd_reset_bus()
898 s->resetting--; in pvscsi_on_cmd_reset_bus()
906 (PVSCSICmdDescSetupMsgRing *) s->curr_cmd_data; in pvscsi_on_cmd_setup_msg_ring()
910 if (!s->use_msg) { in pvscsi_on_cmd_setup_msg_ring()
914 if (s->rings_info_valid) { in pvscsi_on_cmd_setup_msg_ring()
915 if (pvscsi_ring_init_msg(&s->rings, rc) < 0) { in pvscsi_on_cmd_setup_msg_ring()
918 s->msg_ring_info_valid = TRUE; in pvscsi_on_cmd_setup_msg_ring()
993 size_t bytes_arrived = s->curr_cmd_data_cntr * sizeof(uint32_t); in pvscsi_do_command_processing()
995 assert(s->curr_cmd < PVSCSI_CMD_LAST); in pvscsi_do_command_processing()
996 if (bytes_arrived >= pvscsi_commands[s->curr_cmd].data_size) { in pvscsi_do_command_processing()
997 s->reg_command_status = pvscsi_commands[s->curr_cmd].handler_fn(s); in pvscsi_do_command_processing()
998 s->curr_cmd = PVSCSI_CMD_FIRST; in pvscsi_do_command_processing()
999 s->curr_cmd_data_cntr = 0; in pvscsi_do_command_processing()
1006 size_t bytes_arrived = s->curr_cmd_data_cntr * sizeof(uint32_t); in pvscsi_on_command_data()
1008 assert(bytes_arrived < sizeof(s->curr_cmd_data)); in pvscsi_on_command_data()
1009 s->curr_cmd_data[s->curr_cmd_data_cntr++] = value; in pvscsi_on_command_data()
1018 s->curr_cmd = cmd_id; in pvscsi_on_command()
1020 s->curr_cmd = PVSCSI_CMD_FIRST; in pvscsi_on_command()
1024 s->curr_cmd_data_cntr = 0; in pvscsi_on_command()
1025 s->reg_command_status = PVSCSI_COMMAND_NOT_ENOUGH_DATA; in pvscsi_on_command()
1047 s->reg_interrupt_status &= ~val; in pvscsi_io_write()
1054 s->reg_interrupt_enabled = val; in pvscsi_io_write()
1087 s->reg_interrupt_status); in pvscsi_io_read()
1088 return s->reg_interrupt_status; in pvscsi_io_read()
1092 s->reg_interrupt_status); in pvscsi_io_read()
1093 return s->reg_interrupt_enabled; in pvscsi_io_read()
1097 s->reg_interrupt_status); in pvscsi_io_read()
1098 return s->reg_command_status; in pvscsi_io_read()
1117 s->msi_used = false; in pvscsi_init_msi()
1119 s->msi_used = true; in pvscsi_init_msi()
1162 pci_set_word(pci_dev->config + PCI_SUBSYSTEM_ID, 0x1000); in pvscsi_realizefn()
1164 pci_set_word(pci_dev->config + PCI_SUBSYSTEM_VENDOR_ID, in pvscsi_realizefn()
1166 pci_set_word(pci_dev->config + PCI_SUBSYSTEM_ID, in pvscsi_realizefn()
1168 pci_config_set_revision(pci_dev->config, 0x2); in pvscsi_realizefn()
1172 pci_dev->config[PCI_LATENCY_TIMER] = 0xff; in pvscsi_realizefn()
1175 pci_config_set_interrupt_pin(pci_dev->config, 1); in pvscsi_realizefn()
1177 memory_region_init_io(&s->io_space, OBJECT(s), &pvscsi_ops, s, in pvscsi_realizefn()
1178 "pvscsi-io", PVSCSI_MEM_SPACE_SIZE); in pvscsi_realizefn()
1179 pci_register_bar(pci_dev, 0, PCI_BASE_ADDRESS_SPACE_MEMORY, &s->io_space); in pvscsi_realizefn()
1187 s->completion_worker = qemu_bh_new_guarded(pvscsi_process_completion_queue, s, in pvscsi_realizefn()
1188 &DEVICE(pci_dev)->mem_reentrancy_guard); in pvscsi_realizefn()
1190 scsi_bus_init(&s->bus, sizeof(s->bus), DEVICE(pci_dev), &pvscsi_scsi_info); in pvscsi_realizefn()
1191 /* override default SCSI bus hotplug-handler, with pvscsi's one */ in pvscsi_realizefn()
1192 qbus_set_hotplug_handler(BUS(&s->bus), OBJECT(s)); in pvscsi_realizefn()
1202 qemu_bh_delete(s->completion_worker); in pvscsi_uninit()
1224 assert(QTAILQ_EMPTY(&s->pending_queue)); in pvscsi_pre_save()
1225 assert(QTAILQ_EMPTY(&s->completion_queue)); in pvscsi_pre_save()
1241 return !(s->compat_flags & PVSCSI_COMPAT_DISABLE_PCIE); in pvscsi_vmstate_need_pcie_device()
1276 ARRAY_SIZE(((PVSCSIState *)NULL)->curr_cmd_data)),
1301 DEFINE_PROP_BIT("x-old-pci-configuration", PVSCSIState, compat_flags,
1303 DEFINE_PROP_BIT("x-disable-pcie", PVSCSIState, compat_flags,
1314 if (!(s->compat_flags & PVSCSI_COMPAT_DISABLE_PCIE)) { in pvscsi_realize()
1315 pci_dev->cap_present |= QEMU_PCI_CAP_EXPRESS; in pvscsi_realize()
1318 pvs_c->parent_dc_realize(qdev, errp); in pvscsi_realize()
1328 k->realize = pvscsi_realizefn; in pvscsi_class_init()
1329 k->exit = pvscsi_uninit; in pvscsi_class_init()
1330 k->vendor_id = PCI_VENDOR_ID_VMWARE; in pvscsi_class_init()
1331 k->device_id = PCI_DEVICE_ID_VMWARE_PVSCSI; in pvscsi_class_init()
1332 k->class_id = PCI_CLASS_STORAGE_SCSI; in pvscsi_class_init()
1333 k->subsystem_id = 0x1000; in pvscsi_class_init()
1335 &pvs_k->parent_dc_realize); in pvscsi_class_init()
1337 dc->vmsd = &vmstate_pvscsi; in pvscsi_class_init()
1339 set_bit(DEVICE_CATEGORY_STORAGE, dc->categories); in pvscsi_class_init()
1340 hc->unplug = pvscsi_hot_unplug; in pvscsi_class_init()
1341 hc->plug = pvscsi_hotplug; in pvscsi_class_init()