aboutsummaryrefslogtreecommitdiffstats
path: root/xen/include/public/io/ioreq.h
blob: c06718b010547724e564e4e800f344e21c170efa (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
/*
 * ioreq.h: I/O request definitions for device models
 * Copyright (c) 2004, Intel Corporation.
 *
 * This program is free software; you can redistribute it and/or modify it
 * under the terms and conditions of the GNU General Public License,
 * version 2, as published by the Free Software Foundation.
 *
 * This program is distributed in the hope it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
 * more details.
 *
 * You should have received a copy of the GNU General Public License along with
 * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
 * Place - Suite 330, Boston, MA 02111-1307 USA.
 *
 */

#ifndef _IOREQ_H_
#define _IOREQ_H_

#define IOREQ_READ      1
#define IOREQ_WRITE     0

#define STATE_INVALID           0
#define STATE_IOREQ_READY       1
#define STATE_IOREQ_INPROCESS   2
#define STATE_IORESP_READY      3
#define STATE_IORESP_HOOK       4

/* VMExit dispatcher should cooperate with instruction decoder to
   prepare this structure and notify service OS and DM by sending
   virq */
typedef struct {
    u64     addr;               /*  physical address            */
    u64     size;               /*  size in bytes               */
    u64     count;		/*  for rep prefixes            */
    union {
        u64     data;           /*  data                        */
        void    *pdata;         /*  pointer to data             */
    } u;
    u8      state:4;
    u8      pdata_valid:1;	/* if 1, use pdata above        */
    u8      dir:1;		/*  1=read, 0=write             */
    u8      port_mm:1;		/*  0=portio, 1=mmio            */
    u8      df:1;
} ioreq_t;

#define MAX_VECTOR    256
#define BITS_PER_BYTE   8
#define INTR_LEN        (MAX_VECTOR/(BITS_PER_BYTE * sizeof(u64)))

typedef struct {
    u64   pic_intr[INTR_LEN];
    u64   pic_mask[INTR_LEN];
    int     eport; /* Event channel port */
} global_iodata_t;

typedef struct {
    ioreq_t         vp_ioreq;
    unsigned long   vp_intr[INTR_LEN];
} vcpu_iodata_t;

typedef struct {
    global_iodata_t     sp_global;
    vcpu_iodata_t       vcpu_iodata[1];
} shared_iopage_t;

#endif /* _IOREQ_H_ */