Changeset View
Changeset View
Standalone View
Standalone View
head/usr.sbin/bhyve/pci_virtio_block.c
Show First 20 Lines • Show All 517 Lines • ▼ Show 20 Lines | sc->vbsc_cfg.vbc_topology.physical_block_exp = | ||||
(sts > sectsz) ? (ffsll(sts / sectsz) - 1) : 0; | (sts > sectsz) ? (ffsll(sts / sectsz) - 1) : 0; | ||||
sc->vbsc_cfg.vbc_topology.alignment_offset = | sc->vbsc_cfg.vbc_topology.alignment_offset = | ||||
(sto != 0) ? ((sts - sto) / sectsz) : 0; | (sto != 0) ? ((sts - sto) / sectsz) : 0; | ||||
sc->vbsc_cfg.vbc_topology.min_io_size = 0; | sc->vbsc_cfg.vbc_topology.min_io_size = 0; | ||||
sc->vbsc_cfg.vbc_topology.opt_io_size = 0; | sc->vbsc_cfg.vbc_topology.opt_io_size = 0; | ||||
sc->vbsc_cfg.vbc_writeback = 0; | sc->vbsc_cfg.vbc_writeback = 0; | ||||
sc->vbsc_cfg.max_discard_sectors = VTBLK_MAX_DISCARD_SECT; | sc->vbsc_cfg.max_discard_sectors = VTBLK_MAX_DISCARD_SECT; | ||||
sc->vbsc_cfg.max_discard_seg = VTBLK_MAX_DISCARD_SEG; | sc->vbsc_cfg.max_discard_seg = VTBLK_MAX_DISCARD_SEG; | ||||
sc->vbsc_cfg.discard_sector_alignment = sectsz / VTBLK_BSIZE; | sc->vbsc_cfg.discard_sector_alignment = MAX(sectsz, sts) / VTBLK_BSIZE; | ||||
/* | /* | ||||
* 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); | ||||
▲ Show 20 Lines • Show All 43 Lines • Show Last 20 Lines |