aboutsummaryrefslogtreecommitdiffstats
path: root/xenolinux-2.4.21-pre4-sparse/include/asm-xeno/hypervisor-ifs/block.h
blob: 627055bf0bf1e0359fa086be1a64474f9698a67c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
/******************************************************************************
 * block.h
 *
 * Block IO communication rings.
 *
 * These are the ring data structures for buffering messages between 
 * the hypervisor and guestos's.  
 *
 */

#ifndef __BLOCK_H__
#define __BLOCK_H__

#include <linux/kdev_t.h>

/* the first four definitions match fs.h */
#define XEN_BLOCK_READ  0
#define XEN_BLOCK_WRITE 1
#define XEN_BLOCK_READA 2                                /* currently unused */
#define XEN_BLOCK_SPECIAL 4                              /* currently unused */
#define XEN_BLOCK_PROBE 8      /* determine io configuration from hypervisor */
#define XEN_BLOCK_DEBUG 16                                          /* debug */

#define BLK_RING_SIZE        128
#define BLK_RING_MAX_ENTRIES (BLK_RING_SIZE - 2)
#define BLK_RING_INC(_i)     (((_i)+1) & (BLK_RING_SIZE-1))
#define BLK_RING_ADD(_i,_j)  (((_i)+(_j)) & (BLK_RING_SIZE-1))

typedef struct blk_ring_req_entry 
{
    void *          id;                /* for guest os use */
    int             operation;         /* XEN_BLOCK_READ or XEN_BLOCK_WRITE */
    char *          buffer;
    unsigned long   block_number;      /* block number */
    unsigned short  block_size;        /* block size */
    kdev_t          device;
    unsigned long   sector_number;     /* real buffer location on disk */
} blk_ring_req_entry_t;

typedef struct blk_ring_resp_entry
{
    void *id;
    unsigned long status;
} blk_ring_resp_entry_t;

typedef struct blk_ring_st 
{
    unsigned int req_prod;  /* Request producer. Updated by guest OS. */
    unsigned int resp_prod; /* Response producer. Updated by Xen.     */
    union {
        blk_ring_req_entry_t  req;
        blk_ring_resp_entry_t resp;
    } ring[BLK_RING_SIZE];
} blk_ring_t;

#define MAX_XEN_DISK_COUNT 100

#define XEN_DISK_IDE  1
#define XEN_DISK_SCSI 2

typedef struct xen_disk                                     /* physical disk */
{
  int           type;                                           /* disk type */
  unsigned long capacity;
  unsigned char heads;                               /* hdreg.h::hd_geometry */
  unsigned char sectors;                             /* hdreg.h::hd_geometry */
  unsigned int  cylinders;                       /* hdreg.h::hd_big_geometry */
  unsigned long start;                               /* hdreg.h::hd_geometry */
  void *        gendisk;                               /* struct gendisk ptr */
} xen_disk_t;

typedef struct xen_disk_info
{
  int         count; /* number of subsequent xen_disk_t structures to follow */
  xen_disk_t  disks[100];
} xen_disk_info_t;

#endif