2 * ioreq.h: I/O request definitions for device models
3 * Copyright (c) 2004, Intel Corporation.
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:
12 * The above copyright notice and this permission notice shall be included in
13 * all copies or substantial portions of the Software.
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.
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_TIMEOFFSET 7
38 #define IOREQ_TYPE_INVALIDATE 8 /* mapcache */
41 * VMExit dispatcher should cooperate with instruction decoder to
42 * prepare this structure and notify service OS and DM by sending
46 uint64_t addr; /* physical address */
47 uint64_t size; /* size in bytes */
48 uint64_t count; /* for rep prefixes */
49 uint64_t data; /* data (or paddr of data) */
51 uint8_t data_is_ptr:1; /* if 1, data above is the guest paddr
52 * of the real data to use. */
53 uint8_t dir:1; /* 1=read, 0=write */
56 uint8_t type; /* I/O type */
58 uint64_t io_count; /* How many IO done on a vcpu */
60 typedef struct ioreq ioreq_t;
63 struct ioreq vp_ioreq;
64 /* Event channel port, used for notifications to/from the device model. */
68 typedef struct vcpu_iodata vcpu_iodata_t;
70 struct shared_iopage {
71 struct vcpu_iodata vcpu_iodata[1];
73 typedef struct shared_iopage shared_iopage_t;
76 uint8_t type; /* I/O type */
78 uint8_t dir:1; /* 1=read, 0=write */
79 uint8_t size:2; /* 0=>1, 1=>2, 2=>4, 3=>8. If 8, use two buf_ioreqs */
80 uint32_t addr:20;/* physical address */
81 uint32_t data; /* data */
83 typedef struct buf_ioreq buf_ioreq_t;
85 #define IOREQ_BUFFER_SLOT_NUM 511 /* 8 bytes each, plus 2 4-byte indexes */
86 struct buffered_iopage {
87 unsigned int read_pointer;
88 unsigned int write_pointer;
89 buf_ioreq_t buf_ioreq[IOREQ_BUFFER_SLOT_NUM];
90 }; /* NB. Size of this structure must be no greater than one page. */
91 typedef struct buffered_iopage buffered_iopage_t;
102 #define PIO_BUFFER_IDE_PRIMARY 0 /* I/O port = 0x1F0 */
103 #define PIO_BUFFER_IDE_SECONDARY 1 /* I/O port = 0x170 */
104 #define PIO_BUFFER_ENTRY_NUM 2
105 struct buffered_piopage {
106 struct pio_buffer pio[PIO_BUFFER_ENTRY_NUM];
109 #endif /* defined(__ia64__) */
111 #define ACPI_PM1A_EVT_BLK_ADDRESS 0x0000000000001f40
112 #define ACPI_PM1A_CNT_BLK_ADDRESS (ACPI_PM1A_EVT_BLK_ADDRESS + 0x04)
113 #define ACPI_PM_TMR_BLK_ADDRESS (ACPI_PM1A_EVT_BLK_ADDRESS + 0x08)
114 #define ACPI_GPE0_BLK_ADDRESS (ACPI_PM_TMR_BLK_ADDRESS + 0x20)
115 #define ACPI_GPE0_BLK_LEN 0x08
117 #endif /* _IOREQ_H_ */
125 * indent-tabs-mode: nil