Sync usage with man page.
[netbsd-mini2440.git] / sys / arch / xen / include / xen3-public / hvm / ioreq.h
blobbccb0c563c1b2287e2c854e103514abcc0805780
1 /* $NetBSD: ioreq.h,v 1.3 2008/05/04 19:56:29 cegger Exp $ */
2 /*
3 * ioreq.h: I/O request definitions for device models
4 * Copyright (c) 2004, Intel Corporation.
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to
8 * deal in the Software without restriction, including without limitation the
9 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
10 * sell copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 * DEALINGS IN THE SOFTWARE.
25 #ifndef _IOREQ_H_
26 #define _IOREQ_H_
28 #define IOREQ_READ 1
29 #define IOREQ_WRITE 0
31 #define STATE_IOREQ_NONE 0
32 #define STATE_IOREQ_READY 1
33 #define STATE_IOREQ_INPROCESS 2
34 #define STATE_IORESP_READY 3
36 #define IOREQ_TYPE_PIO 0 /* pio */
37 #define IOREQ_TYPE_COPY 1 /* mmio ops */
38 #define IOREQ_TYPE_TIMEOFFSET 7
39 #define IOREQ_TYPE_INVALIDATE 8 /* mapcache */
42 * VMExit dispatcher should cooperate with instruction decoder to
43 * prepare this structure and notify service OS and DM by sending
44 * virq
46 struct ioreq {
47 uint64_t addr; /* physical address */
48 uint64_t size; /* size in bytes */
49 uint64_t count; /* for rep prefixes */
50 uint64_t data; /* data (or paddr of data) */
51 uint8_t state:4;
52 uint8_t data_is_ptr:1; /* if 1, data above is the guest paddr
53 * of the real data to use. */
54 uint8_t dir:1; /* 1=read, 0=write */
55 uint8_t df:1;
56 uint8_t pad:1;
57 uint8_t type; /* I/O type */
58 uint8_t _pad0[6];
59 uint64_t io_count; /* How many IO done on a vcpu */
61 typedef struct ioreq ioreq_t;
63 struct vcpu_iodata {
64 struct ioreq vp_ioreq;
65 /* Event channel port, used for notifications to/from the device model. */
66 uint32_t vp_eport;
67 uint32_t _pad0;
69 typedef struct vcpu_iodata vcpu_iodata_t;
71 struct shared_iopage {
72 struct vcpu_iodata vcpu_iodata[1];
74 typedef struct shared_iopage shared_iopage_t;
76 struct buf_ioreq {
77 uint8_t type; /* I/O type */
78 uint8_t pad:1;
79 uint8_t dir:1; /* 1=read, 0=write */
80 uint8_t size:2; /* 0=>1, 1=>2, 2=>4, 3=>8. If 8, use two buf_ioreqs */
81 uint32_t addr:20;/* physical address */
82 uint32_t data; /* data */
84 typedef struct buf_ioreq buf_ioreq_t;
86 #define IOREQ_BUFFER_SLOT_NUM 511 /* 8 bytes each, plus 2 4-byte indexes */
87 struct buffered_iopage {
88 unsigned int read_pointer;
89 unsigned int write_pointer;
90 buf_ioreq_t buf_ioreq[IOREQ_BUFFER_SLOT_NUM];
91 }; /* NB. Size of this structure must be no greater than one page. */
92 typedef struct buffered_iopage buffered_iopage_t;
94 #if defined(__ia64__)
95 struct pio_buffer {
96 uint32_t page_offset;
97 uint32_t pointer;
98 uint32_t data_end;
99 uint32_t buf_size;
100 void *opaque;
103 #define PIO_BUFFER_IDE_PRIMARY 0 /* I/O port = 0x1F0 */
104 #define PIO_BUFFER_IDE_SECONDARY 1 /* I/O port = 0x170 */
105 #define PIO_BUFFER_ENTRY_NUM 2
106 struct buffered_piopage {
107 struct pio_buffer pio[PIO_BUFFER_ENTRY_NUM];
108 uint8_t buffer[1];
110 #endif /* defined(__ia64__) */
112 #define ACPI_PM1A_EVT_BLK_ADDRESS 0x0000000000001f40
113 #define ACPI_PM1A_CNT_BLK_ADDRESS (ACPI_PM1A_EVT_BLK_ADDRESS + 0x04)
114 #define ACPI_PM_TMR_BLK_ADDRESS (ACPI_PM1A_EVT_BLK_ADDRESS + 0x08)
115 #define ACPI_GPE0_BLK_ADDRESS (ACPI_PM_TMR_BLK_ADDRESS + 0x20)
116 #define ACPI_GPE0_BLK_LEN 0x08
118 #endif /* _IOREQ_H_ */
121 * Local variables:
122 * mode: C
123 * c-set-style: "BSD"
124 * c-basic-offset: 4
125 * tab-width: 4
126 * indent-tabs-mode: nil
127 * End: