static int
virtio_blk_op(struct disk_op_s *op, int write)
{
- struct virtiodrive_s *vdrive_gf =
+ struct virtiodrive_s *vdrive =
container_of(op->drive_fl, struct virtiodrive_s, drive);
- struct vring_virtqueue *vq = vdrive_gf->vq;
+ struct vring_virtqueue *vq = vdrive->vq;
struct virtio_blk_outhdr hdr = {
.type = write ? VIRTIO_BLK_T_OUT : VIRTIO_BLK_T_IN,
.ioprio = 0,
},
{
.addr = op->buf_fl,
- .length = vdrive_gf->drive.blksize * op->count,
+ .length = vdrive->drive.blksize * op->count,
},
{
.addr = (void*)(&status),
vring_add_buf(vq, sg, 2, 1, 0, 0);
else
vring_add_buf(vq, sg, 1, 2, 0, 0);
- vring_kick(&vdrive_gf->vp, vq, 1);
+ vring_kick(&vdrive->vp, vq, 1);
/* Wait for reply */
while (!vring_more_used(vq))
/* Clear interrupt status register. Avoid leaving interrupts stuck if
* VRING_AVAIL_F_NO_INTERRUPT was ignored and interrupts were raised.
*/
- vp_get_isr(&vdrive_gf->vp);
+ vp_get_isr(&vdrive->vp);
return status == VIRTIO_BLK_S_OK ? DISK_RET_SUCCESS : DISK_RET_EBADTRACK;
}
struct pci_device *pci = data;
u8 status = VIRTIO_CONFIG_S_ACKNOWLEDGE | VIRTIO_CONFIG_S_DRIVER;
dprintf(1, "found virtio-blk at %pP\n", pci);
- struct virtiodrive_s *vdrive = malloc_fseg(sizeof(*vdrive));
+ struct virtiodrive_s *vdrive = malloc_low(sizeof(*vdrive));
if (!vdrive) {
warn_noalloc();
return;
//
// This file may be distributed under the terms of the GNU LGPLv3 license.
-#include "biosvar.h" // GET_GLOBALFLAT
#include "block.h" // struct drive_s
#include "blockcmd.h" // scsi_drive_setup
#include "config.h" // CONFIG_*
{
struct virtio_lun_s *tmpl_vlun =
container_of(tmpl_drv, struct virtio_lun_s, drive);
- struct virtio_lun_s *vlun = malloc_fseg(sizeof(*vlun));
+ struct virtio_lun_s *vlun = malloc_low(sizeof(*vlun));
if (!vlun) {
warn_noalloc();
return -1;