]> git.proxmox.com Git - mirror_qemu.git/blame - include/exec/ioport.h
migration: use migration_in_postcopy() to check POSTCOPY_ACTIVE
[mirror_qemu.git] / include / exec / ioport.h
CommitLineData
32993977
IY
1/*
2 * defines ioport related functions
3 *
4 * Copyright (c) 2003 Fabrice Bellard
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
8167ee88 17 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
32993977
IY
18 */
19
20/**************************************************************************
21 * IO ports API
22 */
23
24#ifndef IOPORT_H
25#define IOPORT_H
26
32993977 27#define MAX_IOPORTS (64 * 1024)
d56dd6cf 28#define IOPORTS_MASK (MAX_IOPORTS - 1)
32993977 29
5767e4e1
JK
30typedef struct MemoryRegionPortio {
31 uint32_t offset;
32 uint32_t len;
33 unsigned size;
34 uint32_t (*read)(void *opaque, uint32_t address);
35 void (*write)(void *opaque, uint32_t address, uint32_t data);
36 uint32_t base; /* private field */
37} MemoryRegionPortio;
38
39#define PORTIO_END_OF_LIST() { }
32993977 40
3bb28b72
JK
41#ifndef CONFIG_USER_ONLY
42extern const MemoryRegionOps unassigned_io_ops;
43#endif
44
89a80e74
PB
45void cpu_outb(uint32_t addr, uint8_t val);
46void cpu_outw(uint32_t addr, uint16_t val);
47void cpu_outl(uint32_t addr, uint32_t val);
48uint8_t cpu_inb(uint32_t addr);
49uint16_t cpu_inw(uint32_t addr);
50uint32_t cpu_inl(uint32_t addr);
32993977 51
6bf9fd43
AK
52typedef struct PortioList {
53 const struct MemoryRegionPortio *ports;
db10ca90 54 Object *owner;
6bf9fd43
AK
55 struct MemoryRegion *address_space;
56 unsigned nr;
57 struct MemoryRegion **regions;
58 void *opaque;
59 const char *name;
c76bc480 60 bool flush_coalesced_mmio;
6bf9fd43
AK
61} PortioList;
62
db10ca90 63void portio_list_init(PortioList *piolist, Object *owner,
6bf9fd43
AK
64 const struct MemoryRegionPortio *callbacks,
65 void *opaque, const char *name);
c76bc480 66void portio_list_set_flush_coalesced(PortioList *piolist);
6bf9fd43
AK
67void portio_list_destroy(PortioList *piolist);
68void portio_list_add(PortioList *piolist,
69 struct MemoryRegion *address_space,
70 uint32_t addr);
71void portio_list_del(PortioList *piolist);
72
32993977 73#endif /* IOPORT_H */