debuggers.hg

view xen/include/public/hvm/ioreq.h @ 16381:c0bdfda5183d

hvm: Clean up buf_ioreq handling.
Also, disable stdvga caching on hvm save/restore, as the shadow vga
state is not preserved.
Signed-off-by: Keir Fraser <keir@xensource.com>
author Keir Fraser <keir@xensource.com>
date Thu Nov 08 14:50:01 2007 +0000 (2007-11-08)
parents 2a5461071ca4
children 381781af1d5a
line source
1 /*
2 * ioreq.h: I/O request definitions for device models
3 * Copyright (c) 2004, Intel Corporation.
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining a copy
6 * of this software and associated documentation files (the "Software"), to
7 * deal in the Software without restriction, including without limitation the
8 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
9 * sell copies of the Software, and to permit persons to whom the Software is
10 * furnished to do so, subject to the following conditions:
11 *
12 * The above copyright notice and this permission notice shall be included in
13 * all copies or substantial portions of the Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21 * DEALINGS IN THE SOFTWARE.
22 */
24 #ifndef _IOREQ_H_
25 #define _IOREQ_H_
27 #define IOREQ_READ 1
28 #define IOREQ_WRITE 0
30 #define STATE_IOREQ_NONE 0
31 #define STATE_IOREQ_READY 1
32 #define STATE_IOREQ_INPROCESS 2
33 #define STATE_IORESP_READY 3
35 #define IOREQ_TYPE_PIO 0 /* pio */
36 #define IOREQ_TYPE_COPY 1 /* mmio ops */
37 #define IOREQ_TYPE_AND 2
38 #define IOREQ_TYPE_OR 3
39 #define IOREQ_TYPE_XOR 4
40 #define IOREQ_TYPE_XCHG 5
41 #define IOREQ_TYPE_ADD 6
42 #define IOREQ_TYPE_TIMEOFFSET 7
43 #define IOREQ_TYPE_INVALIDATE 8 /* mapcache */
44 #define IOREQ_TYPE_SUB 9
46 /*
47 * VMExit dispatcher should cooperate with instruction decoder to
48 * prepare this structure and notify service OS and DM by sending
49 * virq
50 */
51 struct ioreq {
52 uint64_t addr; /* physical address */
53 uint64_t size; /* size in bytes */
54 uint64_t count; /* for rep prefixes */
55 uint64_t data; /* data (or paddr of data) */
56 uint8_t state:4;
57 uint8_t data_is_ptr:1; /* if 1, data above is the guest paddr
58 * of the real data to use. */
59 uint8_t dir:1; /* 1=read, 0=write */
60 uint8_t df:1;
61 uint8_t type; /* I/O type */
62 uint8_t _pad0[6];
63 uint64_t io_count; /* How many IO done on a vcpu */
64 };
65 typedef struct ioreq ioreq_t;
67 struct vcpu_iodata {
68 struct ioreq vp_ioreq;
69 /* Event channel port, used for notifications to/from the device model. */
70 uint32_t vp_eport;
71 uint32_t _pad0;
72 };
73 typedef struct vcpu_iodata vcpu_iodata_t;
75 struct shared_iopage {
76 struct vcpu_iodata vcpu_iodata[1];
77 };
78 typedef struct shared_iopage shared_iopage_t;
80 struct buf_ioreq {
81 uint8_t type; /* I/O type */
82 uint8_t df:1; /* EFLAGS.DF */
83 uint8_t dir:1; /* 1=read, 0=write */
84 uint8_t size:2; /* 0=>1, 1=>2, 2=>4, 3=>8. If 8, use two buf_ioreqs */
85 uint32_t addr:20;/* physical address */
86 uint32_t data; /* data */
87 };
88 typedef struct buf_ioreq buf_ioreq_t;
90 #define IOREQ_BUFFER_SLOT_NUM 511 /* 8 bytes each, plus 2 4-byte indexes */
91 struct buffered_iopage {
92 unsigned int read_pointer;
93 unsigned int write_pointer;
94 buf_ioreq_t buf_ioreq[IOREQ_BUFFER_SLOT_NUM];
95 }; /* NB. Size of this structure must be no greater than one page. */
96 typedef struct buffered_iopage buffered_iopage_t;
98 #if defined(__ia64__)
99 struct pio_buffer {
100 uint32_t page_offset;
101 uint32_t pointer;
102 uint32_t data_end;
103 uint32_t buf_size;
104 void *opaque;
105 };
107 #define PIO_BUFFER_IDE_PRIMARY 0 /* I/O port = 0x1F0 */
108 #define PIO_BUFFER_IDE_SECONDARY 1 /* I/O port = 0x170 */
109 #define PIO_BUFFER_ENTRY_NUM 2
110 struct buffered_piopage {
111 struct pio_buffer pio[PIO_BUFFER_ENTRY_NUM];
112 uint8_t buffer[1];
113 };
114 #endif /* defined(__ia64__) */
116 #if defined(__i386__) || defined(__x86_64__)
117 #define ACPI_PM1A_EVT_BLK_ADDRESS 0x0000000000001f40
118 #define ACPI_PM1A_CNT_BLK_ADDRESS (ACPI_PM1A_EVT_BLK_ADDRESS + 0x04)
119 #define ACPI_PM_TMR_BLK_ADDRESS (ACPI_PM1A_EVT_BLK_ADDRESS + 0x08)
120 #endif /* defined(__i386__) || defined(__x86_64__) */
122 #endif /* _IOREQ_H_ */
124 /*
125 * Local variables:
126 * mode: C
127 * c-set-style: "BSD"
128 * c-basic-offset: 4
129 * tab-width: 4
130 * indent-tabs-mode: nil
131 * End:
132 */