[SeaBIOS] [PATCH] add write support to virtio-blk
Gleb Natapov
gleb at redhat.com
Wed Aug 18 13:11:51 CEST 2010
Windows XP needs it during installation.
Signed-off-by: Gleb Natapov <gleb at redhat.com>
diff --git a/src/virtio-blk.c b/src/virtio-blk.c
index 74af488..91277f4 100644
--- a/src/virtio-blk.c
+++ b/src/virtio-blk.c
@@ -26,13 +26,13 @@ struct virtiodrive_s {
};
static int
-virtio_blk_read(struct disk_op_s *op)
+virtio_blk_op(struct disk_op_s *op, int write)
{
struct virtiodrive_s *vdrive_g =
container_of(op->drive_g, struct virtiodrive_s, drive);
struct vring_virtqueue *vq = GET_GLOBAL(vdrive_g->vq);
struct virtio_blk_outhdr hdr = {
- .type = VIRTIO_BLK_T_IN,
+ .type = write ? VIRTIO_BLK_T_OUT : VIRTIO_BLK_T_IN,
.ioprio = 0,
.sector = op->lba,
};
@@ -78,9 +78,10 @@ process_virtio_op(struct disk_op_s *op)
return 0;
switch (op->command) {
case CMD_READ:
- return virtio_blk_read(op);
- case CMD_FORMAT:
+ return virtio_blk_op(op, 0);
case CMD_WRITE:
+ return virtio_blk_op(op, 1);
+ case CMD_FORMAT:
return DISK_RET_EWRITEPROTECT;
case CMD_RESET:
case CMD_ISREADY:
--
Gleb.
More information about the SeaBIOS
mailing list