fedora core 2.6.9-1.11-FC2
[linux-2.6.git] / include / asm-xen / xen-public / io / ioreq.h
1 /*
2  * ioreq.h: I/O request definitions for device models
3  * Copyright (c) 2004, Intel Corporation.
4  *
5  * This program is free software; you can redistribute it and/or modify it
6  * under the terms and conditions of the GNU General Public License,
7  * version 2, as published by the Free Software Foundation.
8  *
9  * This program is distributed in the hope it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
12  * more details.
13  *
14  * You should have received a copy of the GNU General Public License along with
15  * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
16  * Place - Suite 330, Boston, MA 02111-1307 USA.
17  *
18  */
19
20 #ifndef _IOREQ_H_
21 #define _IOREQ_H_
22
23 #define IOREQ_READ      1
24 #define IOREQ_WRITE     0
25
26 #define STATE_INVALID           0
27 #define STATE_IOREQ_READY       1
28 #define STATE_IOREQ_INPROCESS   2
29 #define STATE_IORESP_READY      3
30 #define STATE_IORESP_HOOK       4
31
32 #define IOPACKET_PORT   2
33
34 /* VMExit dispatcher should cooperate with instruction decoder to
35    prepare this structure and notify service OS and DM by sending
36    virq */
37 typedef struct {
38     u64     addr;               /*  physical address            */
39     u64     size;               /*  size in bytes               */
40     u64     count;              /*  for rep prefixes            */
41     union {
42         u64     data;           /*  data                        */
43         void    *pdata;         /*  pointer to data             */
44     } u;
45     u8      state:4;
46     u8      pdata_valid:1;      /* if 1, use pdata above        */
47     u8      dir:1;              /*  1=read, 0=write             */
48     u8      port_mm:1;          /*  0=portio, 1=mmio            */
49     u8      df:1;
50 } ioreq_t;
51
52 #define MAX_VECTOR    256
53 #define BITS_PER_BYTE   8
54 #define INTR_LEN        (MAX_VECTOR/(BITS_PER_BYTE * sizeof(unsigned long)))
55
56 typedef struct {
57     ioreq_t         vp_ioreq;
58     unsigned long   vp_intr[INTR_LEN];
59 } vcpu_iodata_t;
60
61 #endif /* _IOREQ_H_ */