Changeset View
Changeset View
Standalone View
Standalone View
usr.sbin/bhyve/pci_virtio_block.c
Show First 20 Lines • Show All 527 Lines • ▼ Show 20 Lines | pci_vtblk_init(struct vmctx *ctx, struct pci_devinst *pi, char *opts) | ||||
/* | /* | ||||
* Should we move some of this into virtio.c? Could | * Should we move some of this into virtio.c? Could | ||||
* have the device, class, and subdev_0 as fields in | * have the device, class, and subdev_0 as fields in | ||||
* the virtio constants structure. | * the virtio constants structure. | ||||
*/ | */ | ||||
pci_set_cfgdata16(pi, PCIR_DEVICE, VIRTIO_DEV_BLOCK); | pci_set_cfgdata16(pi, PCIR_DEVICE, VIRTIO_DEV_BLOCK); | ||||
pci_set_cfgdata16(pi, PCIR_VENDOR, VIRTIO_VENDOR); | pci_set_cfgdata16(pi, PCIR_VENDOR, VIRTIO_VENDOR); | ||||
pci_set_cfgdata8(pi, PCIR_CLASS, PCIC_STORAGE); | pci_set_cfgdata8(pi, PCIR_CLASS, PCIC_STORAGE); | ||||
pci_set_cfgdata16(pi, PCIR_SUBDEV_0, VIRTIO_TYPE_BLOCK); | pci_set_cfgdata16(pi, PCIR_SUBDEV_0, VIRTIO_ID_BLOCK); | ||||
pci_set_cfgdata16(pi, PCIR_SUBVEND_0, VIRTIO_VENDOR); | pci_set_cfgdata16(pi, PCIR_SUBVEND_0, VIRTIO_VENDOR); | ||||
if (vi_intr_init(&sc->vbsc_vs, 1, fbsdrun_virtio_msix())) { | if (vi_intr_init(&sc->vbsc_vs, 1, fbsdrun_virtio_msix())) { | ||||
blockif_close(sc->bc); | blockif_close(sc->bc); | ||||
free(sc); | free(sc); | ||||
return (1); | return (1); | ||||
} | } | ||||
vi_set_io_bar(&sc->vbsc_vs, 0); | vi_set_io_bar(&sc->vbsc_vs, 0); | ||||
Show All 33 Lines |