mirror of
https://github.com/xemu-project/xemu.git
synced 2024-11-24 03:59:52 +00:00
9b32d5a5f7
Use the defines added by the previous patch in the virtio drivers. Also remove the pointless vendor and device args from the virtio_blk_init() function. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5987 c046a42c-6fe2-441c-8c8c-71466251a162
76 lines
1.7 KiB
C
76 lines
1.7 KiB
C
/*
|
|
* Virtio Block Device
|
|
*
|
|
* Copyright IBM, Corp. 2007
|
|
*
|
|
* Authors:
|
|
* Anthony Liguori <aliguori@us.ibm.com>
|
|
*
|
|
* This work is licensed under the terms of the GNU GPL, version 2. See
|
|
* the COPYING file in the top-level directory.
|
|
*
|
|
*/
|
|
|
|
#ifndef _QEMU_VIRTIO_BLK_H
|
|
#define _QEMU_VIRTIO_BLK_H
|
|
|
|
#include "virtio.h"
|
|
#include "block.h"
|
|
#include "pci.h"
|
|
|
|
/* from Linux's linux/virtio_blk.h */
|
|
|
|
/* The ID for virtio_block */
|
|
#define VIRTIO_ID_BLOCK 2
|
|
|
|
/* Feature bits */
|
|
#define VIRTIO_BLK_F_BARRIER 0 /* Does host support barriers? */
|
|
#define VIRTIO_BLK_F_SIZE_MAX 1 /* Indicates maximum segment size */
|
|
#define VIRTIO_BLK_F_SEG_MAX 2 /* Indicates maximum # of segments */
|
|
#define VIRTIO_BLK_F_GEOMETRY 4 /* Indicates support of legacy geometry */
|
|
|
|
struct virtio_blk_config
|
|
{
|
|
uint64_t capacity;
|
|
uint32_t size_max;
|
|
uint32_t seg_max;
|
|
uint16_t cylinders;
|
|
uint8_t heads;
|
|
uint8_t sectors;
|
|
} __attribute__((packed));
|
|
|
|
/* These two define direction. */
|
|
#define VIRTIO_BLK_T_IN 0
|
|
#define VIRTIO_BLK_T_OUT 1
|
|
|
|
/* This bit says it's a scsi command, not an actual read or write. */
|
|
#define VIRTIO_BLK_T_SCSI_CMD 2
|
|
|
|
/* Barrier before this op. */
|
|
#define VIRTIO_BLK_T_BARRIER 0x80000000
|
|
|
|
/* This is the first element of the read scatter-gather list. */
|
|
struct virtio_blk_outhdr
|
|
{
|
|
/* VIRTIO_BLK_T* */
|
|
uint32_t type;
|
|
/* io priority. */
|
|
uint32_t ioprio;
|
|
/* Sector (ie. 512 byte offset) */
|
|
uint64_t sector;
|
|
};
|
|
|
|
#define VIRTIO_BLK_S_OK 0
|
|
#define VIRTIO_BLK_S_IOERR 1
|
|
#define VIRTIO_BLK_S_UNSUPP 2
|
|
|
|
/* This is the first element of the write scatter-gather list */
|
|
struct virtio_blk_inhdr
|
|
{
|
|
unsigned char status;
|
|
};
|
|
|
|
void *virtio_blk_init(PCIBus *bus, BlockDriverState *bs);
|
|
|
|
#endif
|