Zephyr API Documentation
4.3.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
ioreq.h
Go to the documentation of this file.
1
/* SPDX-License-Identifier: MIT */
2
/*
3
* ioreq.h: I/O request definitions for device models
4
* Copyright (c) 2004, Intel Corporation.
5
*/
6
7
#ifndef _IOREQ_H_
8
#define _IOREQ_H_
9
10
#define IOREQ_READ 1
11
#define IOREQ_WRITE 0
12
13
#define STATE_IOREQ_NONE 0
14
#define STATE_IOREQ_READY 1
15
#define STATE_IOREQ_INPROCESS 2
16
#define STATE_IORESP_READY 3
17
18
#define IOREQ_TYPE_PIO 0
/* pio */
19
#define IOREQ_TYPE_COPY 1
/* mmio ops */
20
#define IOREQ_TYPE_PCI_CONFIG 2
21
#define IOREQ_TYPE_TIMEOFFSET 7
22
#define IOREQ_TYPE_INVALIDATE 8
/* mapcache */
23
24
/*
25
* VMExit dispatcher should cooperate with instruction decoder to
26
* prepare this structure and notify service OS and DM by sending
27
* virq.
28
*
29
* For I/O type IOREQ_TYPE_PCI_CONFIG, the physical address is formatted
30
* as follows:
31
*
32
* 63....48|47..40|39..35|34..32|31........0
33
* SEGMENT |BUS |DEV |FN |OFFSET
34
*/
35
struct
ioreq
{
36
uint64_t
addr
;
/* physical address */
37
uint64_t
data
;
/* data (or paddr of data) */
38
uint32_t
count
;
/* for rep prefixes */
39
uint32_t
size
;
/* size in bytes */
40
uint32_t
vp_eport
;
/* evtchn for notifications to/from device model */
41
uint16_t
_pad0;
42
uint8_t
state
: 4;
43
uint8_t
data_is_ptr
: 1;
/* if 1, data above is the guest paddr */
44
/* of the real data to use. */
45
uint8_t
dir
: 1;
/* 1=read, 0=write */
46
uint8_t
df
: 1;
47
uint8_t
_pad1: 1;
48
uint8_t
type
;
/* I/O type */
49
};
50
typedef
struct
ioreq
ioreq_t
;
51
52
struct
shared_iopage
{
53
struct
ioreq
vcpu_ioreq
[1];
54
};
55
typedef
struct
shared_iopage
shared_iopage_t
;
56
57
struct
buf_ioreq
{
58
uint8_t
type
;
/* I/O type */
59
uint8_t
pad
: 1;
60
uint8_t
dir
: 1;
/* 1=read, 0=write */
61
uint8_t
size
: 2;
/* 0=>1, 1=>2, 2=>4, 3=>8. If 8, use two buf_ioreqs */
62
uint32_t
addr
: 20;
/* physical address */
63
uint32_t
data
;
/* data */
64
};
65
typedef
struct
buf_ioreq
buf_ioreq_t
;
66
67
#define IOREQ_BUFFER_SLOT_NUM 511
/* 8 bytes each, plus 2 4-byte indexes */
68
struct
buffered_iopage
{
69
#ifdef __XEN__
70
union
bufioreq_pointers {
71
struct
{
72
#endif
73
uint32_t
read_pointer
;
74
uint32_t
write_pointer
;
75
#ifdef __XEN__
76
};
77
uint64_t
full;
78
} ptrs;
79
#endif
80
buf_ioreq_t
buf_ioreq
[
IOREQ_BUFFER_SLOT_NUM
];
81
};
/* NB. Size of this structure must be no greater than one page. */
82
typedef
struct
buffered_iopage
buffered_iopage_t
;
83
84
/*
85
* ACPI Control/Event register locations. Location is controlled by a
86
* version number in HVM_PARAM_ACPI_IOPORTS_LOCATION.
87
*/
88
89
/*
90
* Version 0 (default): Traditional (obsolete) Xen locations.
91
*
92
* These are now only used for compatibility with VMs migrated
93
* from older Xen versions.
94
*/
95
#define ACPI_PM1A_EVT_BLK_ADDRESS_V0 0x1f40
96
#define ACPI_PM1A_CNT_BLK_ADDRESS_V0 (ACPI_PM1A_EVT_BLK_ADDRESS_V0 + 0x04)
97
#define ACPI_PM_TMR_BLK_ADDRESS_V0 (ACPI_PM1A_EVT_BLK_ADDRESS_V0 + 0x08)
98
#define ACPI_GPE0_BLK_ADDRESS_V0 (ACPI_PM_TMR_BLK_ADDRESS_V0 + 0x20)
99
#define ACPI_GPE0_BLK_LEN_V0 0x08
100
101
/* Version 1: Locations preferred by modern Qemu (including Qemu-trad). */
102
#define ACPI_PM1A_EVT_BLK_ADDRESS_V1 0xb000
103
#define ACPI_PM1A_CNT_BLK_ADDRESS_V1 (ACPI_PM1A_EVT_BLK_ADDRESS_V1 + 0x04)
104
#define ACPI_PM_TMR_BLK_ADDRESS_V1 (ACPI_PM1A_EVT_BLK_ADDRESS_V1 + 0x08)
105
#define ACPI_GPE0_BLK_ADDRESS_V1 0xafe0
106
#define ACPI_GPE0_BLK_LEN_V1 0x04
107
108
/* Compatibility definitions for the default location (version 0). */
109
#define ACPI_PM1A_EVT_BLK_ADDRESS ACPI_PM1A_EVT_BLK_ADDRESS_V0
110
#define ACPI_PM1A_CNT_BLK_ADDRESS ACPI_PM1A_CNT_BLK_ADDRESS_V0
111
#define ACPI_PM_TMR_BLK_ADDRESS ACPI_PM_TMR_BLK_ADDRESS_V0
112
#define ACPI_GPE0_BLK_ADDRESS ACPI_GPE0_BLK_ADDRESS_V0
113
#define ACPI_GPE0_BLK_LEN ACPI_GPE0_BLK_LEN_V0
114
115
#endif
/* _IOREQ_H_ */
116
117
/*
118
* Local variables:
119
* mode: C
120
* c-file-style: "BSD"
121
* c-basic-offset: 4
122
* tab-width: 4
123
* indent-tabs-mode: nil
124
* End:
125
*/
buf_ioreq_t
struct buf_ioreq buf_ioreq_t
Definition
ioreq.h:65
ioreq_t
struct ioreq ioreq_t
Definition
ioreq.h:50
buffered_iopage_t
struct buffered_iopage buffered_iopage_t
Definition
ioreq.h:82
IOREQ_BUFFER_SLOT_NUM
#define IOREQ_BUFFER_SLOT_NUM
Definition
ioreq.h:67
shared_iopage_t
struct shared_iopage shared_iopage_t
Definition
ioreq.h:55
uint32_t
__UINT32_TYPE__ uint32_t
Definition
stdint.h:90
uint64_t
__UINT64_TYPE__ uint64_t
Definition
stdint.h:91
uint8_t
__UINT8_TYPE__ uint8_t
Definition
stdint.h:88
uint16_t
__UINT16_TYPE__ uint16_t
Definition
stdint.h:89
buf_ioreq
Definition
ioreq.h:57
buf_ioreq::size
uint8_t size
Definition
ioreq.h:61
buf_ioreq::addr
uint32_t addr
Definition
ioreq.h:62
buf_ioreq::pad
uint8_t pad
Definition
ioreq.h:59
buf_ioreq::dir
uint8_t dir
Definition
ioreq.h:60
buf_ioreq::type
uint8_t type
Definition
ioreq.h:58
buf_ioreq::data
uint32_t data
Definition
ioreq.h:63
buffered_iopage
Definition
ioreq.h:68
buffered_iopage::read_pointer
uint32_t read_pointer
Definition
ioreq.h:73
buffered_iopage::buf_ioreq
buf_ioreq_t buf_ioreq[511]
Definition
ioreq.h:80
buffered_iopage::write_pointer
uint32_t write_pointer
Definition
ioreq.h:74
ioreq
Definition
ioreq.h:35
ioreq::df
uint8_t df
Definition
ioreq.h:46
ioreq::type
uint8_t type
Definition
ioreq.h:48
ioreq::count
uint32_t count
Definition
ioreq.h:38
ioreq::vp_eport
uint32_t vp_eport
Definition
ioreq.h:40
ioreq::size
uint32_t size
Definition
ioreq.h:39
ioreq::addr
uint64_t addr
Definition
ioreq.h:36
ioreq::dir
uint8_t dir
Definition
ioreq.h:45
ioreq::state
uint8_t state
Definition
ioreq.h:42
ioreq::data
uint64_t data
Definition
ioreq.h:37
ioreq::data_is_ptr
uint8_t data_is_ptr
Definition
ioreq.h:43
shared_iopage
Definition
ioreq.h:52
shared_iopage::vcpu_ioreq
struct ioreq vcpu_ioreq[1]
Definition
ioreq.h:53
zephyr
xen
public
hvm
ioreq.h
Generated on
for Zephyr API Documentation by
1.15.0