ia64/xen-unstable

view xen/include/hypervisor-ifs/block.h @ 926:0a901de56d7c

bitkeeper revision 1.588 (3fafd2ccYgSbWe9z2kLiH-DeviUaIA)

Merge labyrinth.cl.cam.ac.uk:/auto/groups/xeno/BK/xeno.bk
into labyrinth.cl.cam.ac.uk:/local/scratch/smh22/xeno.bk
author smh22@labyrinth.cl.cam.ac.uk
date Mon Nov 10 18:02:52 2003 +0000 (2003-11-10)
parents 352a82eb57ad 4aba3a48d64f
children 83b414c7559c
line source
1 /******************************************************************************
2 * block.h
3 *
4 * shared structures for block IO.
5 *
6 */
8 #ifndef __BLOCK_H__
9 #define __BLOCK_H__
11 /*
12 *
13 * These are the ring data structures for buffering messages between
14 * the hypervisor and guestos's.
15 *
16 */
18 /* the first four definitions match fs.h */
19 #define XEN_BLOCK_READ 0
20 #define XEN_BLOCK_WRITE 1
21 #define XEN_BLOCK_READA 2
22 #define XEN_BLOCK_SPECIAL 4
23 #define XEN_BLOCK_DEBUG 5 /* debug */
25 /* NB. Ring size must be small enough for sizeof(blk_ring_t) <= PAGE_SIZE. */
26 #define BLK_RING_SIZE 64
27 #define BLK_RING_INC(_i) (((_i)+1) & (BLK_RING_SIZE-1))
29 /*
30 * Maximum scatter/gather segments per request.
31 * This is carefully chosen so that sizeof(blk_ring_t) <= PAGE_SIZE.
32 */
33 #define MAX_BLK_SEGS 12
35 typedef struct blk_ring_req_entry
36 {
37 unsigned long id; /* private guest os value */
38 unsigned long sector_number; /* start sector idx on disk */
39 unsigned short device; /* XENDEV_??? + idx */
40 unsigned char operation; /* XEN_BLOCK_??? */
41 unsigned char nr_segments; /* number of segments */
42 /* Least 9 bits is 'nr_sects'. High 23 bits are the address. */
43 unsigned long buffer_and_sects[MAX_BLK_SEGS];
44 } blk_ring_req_entry_t;
46 typedef struct blk_ring_resp_entry
47 {
48 unsigned long id; /* copied from request */
49 unsigned short operation; /* copied from request */
50 unsigned long status; /* cuurently boolean good/bad */
51 } blk_ring_resp_entry_t;
53 typedef struct blk_ring_st
54 {
55 unsigned int req_prod; /* Request producer. Updated by guest OS. */
56 unsigned int resp_prod; /* Response producer. Updated by Xen. */
57 union {
58 blk_ring_req_entry_t req;
59 blk_ring_resp_entry_t resp;
60 } ring[BLK_RING_SIZE];
61 } blk_ring_t;
63 /*
64 * Information about the real and virtual disks we have; used during
65 * guest device probing.
66 */
68 /* XXX SMH: below types chosen to align with ide_xxx types in ide.h */
69 #define XD_TYPE_FLOPPY 0x00
70 #define XD_TYPE_TAPE 0x01
71 #define XD_TYPE_CDROM 0x05
72 #define XD_TYPE_OPTICAL 0x07
73 #define XD_TYPE_DISK 0x20
75 #define XD_TYPE_MASK 0x3F
76 #define XD_TYPE(_x) ((_x) & XD_TYPE_MASK)
78 /* The top two bits of the type field encode various flags */
79 #define XD_FLAG_RO 0x40
80 #define XD_FLAG_VIRT 0x80
81 #define XD_READONLY(_x) ((_x) & XD_FLAG_RO)
82 #define XD_VIRTUAL(_x) ((_x) & XD_FLAG_VIRT)
84 typedef struct xen_disk
85 {
86 unsigned short device; /* device number (opaque 16 bit val) */
87 unsigned short info; /* device type and flags */
88 unsigned long capacity; /* size in terms of #512 byte sectors */
89 unsigned int domain; /* if a VBD, domain this 'belongs to' */
90 } xen_disk_t;
92 typedef struct xen_disk_info
93 {
94 /* IN variables */
95 int max; // maximumum number of disks to report
96 xen_disk_t *disks; // pointer to array of disk info
97 /* OUT variables */
98 int count; // how many disks we have info about
99 } xen_disk_info_t;
101 #endif