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 */
35struct 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;
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 */
47 uint8_t _pad1: 1;
48 uint8_t type; /* I/O type */
49};
50typedef struct ioreq ioreq_t;
51
53 struct ioreq vcpu_ioreq[1];
54};
56
57struct buf_ioreq {
58 uint8_t type; /* I/O type */
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};
65typedef struct buf_ioreq buf_ioreq_t;
66
67#define IOREQ_BUFFER_SLOT_NUM 511 /* 8 bytes each, plus 2 4-byte indexes */
69#ifdef __XEN__
70 union bufioreq_pointers {
71 struct {
72#endif
75#ifdef __XEN__
76 };
77 uint64_t full;
78 } ptrs;
79#endif
81}; /* NB. Size of this structure must be no greater than one page. */
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 */
struct buf_ioreq buf_ioreq_t
Definition ioreq.h:65
struct ioreq ioreq_t
Definition ioreq.h:50
struct buffered_iopage buffered_iopage_t
Definition ioreq.h:82
#define IOREQ_BUFFER_SLOT_NUM
Definition ioreq.h:67
struct shared_iopage shared_iopage_t
Definition ioreq.h:55
__UINT32_TYPE__ uint32_t
Definition stdint.h:90
__UINT64_TYPE__ uint64_t
Definition stdint.h:91
__UINT8_TYPE__ uint8_t
Definition stdint.h:88
__UINT16_TYPE__ uint16_t
Definition stdint.h:89
Definition ioreq.h:57
uint8_t size
Definition ioreq.h:61
uint32_t addr
Definition ioreq.h:62
uint8_t pad
Definition ioreq.h:59
uint8_t dir
Definition ioreq.h:60
uint8_t type
Definition ioreq.h:58
uint32_t data
Definition ioreq.h:63
Definition ioreq.h:68
uint32_t read_pointer
Definition ioreq.h:73
buf_ioreq_t buf_ioreq[511]
Definition ioreq.h:80
uint32_t write_pointer
Definition ioreq.h:74
Definition ioreq.h:35
uint8_t df
Definition ioreq.h:46
uint8_t type
Definition ioreq.h:48
uint32_t count
Definition ioreq.h:38
uint32_t vp_eport
Definition ioreq.h:40
uint32_t size
Definition ioreq.h:39
uint64_t addr
Definition ioreq.h:36
uint8_t dir
Definition ioreq.h:45
uint8_t state
Definition ioreq.h:42
uint64_t data
Definition ioreq.h:37
uint8_t data_is_ptr
Definition ioreq.h:43
Definition ioreq.h:52
struct ioreq vcpu_ioreq[1]
Definition ioreq.h:53