1 /* $NetBSD: ioreq.h,v 1.3 2008/05/04 19:56:29 cegger Exp $ */
3 * ioreq.h: I/O request definitions for device models
4 * Copyright (c) 2004, Intel Corporation.
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.
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
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) */
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 */
57 uint8_t type
; /* I/O type */
59 uint64_t io_count
; /* How many IO done on a vcpu */
61 typedef struct ioreq ioreq_t
;
64 struct ioreq vp_ioreq
;
65 /* Event channel port, used for notifications to/from the device model. */
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
;
77 uint8_t type
; /* I/O type */
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
;
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
];
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_ */
126 * indent-tabs-mode: nil