2 * defines ioport related functions
4 * Copyright (c) 2003 Fabrice Bellard
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.
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.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
20 /**************************************************************************
27 #define MAX_IOPORTS (64 * 1024)
28 #define IOPORTS_MASK (MAX_IOPORTS - 1)
30 typedef struct MemoryRegionPortio
{
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 */
39 #define PORTIO_END_OF_LIST() { }
41 #ifndef CONFIG_USER_ONLY
42 extern const MemoryRegionOps unassigned_io_ops
;
45 void cpu_outb(uint32_t addr
, uint8_t val
);
46 void cpu_outw(uint32_t addr
, uint16_t val
);
47 void cpu_outl(uint32_t addr
, uint32_t val
);
48 uint8_t cpu_inb(uint32_t addr
);
49 uint16_t cpu_inw(uint32_t addr
);
50 uint32_t cpu_inl(uint32_t addr
);
52 typedef struct PortioList
{
53 const struct MemoryRegionPortio
*ports
;
55 struct MemoryRegion
*address_space
;
57 struct MemoryRegion
**regions
;
60 bool flush_coalesced_mmio
;
63 void portio_list_init(PortioList
*piolist
, Object
*owner
,
64 const struct MemoryRegionPortio
*callbacks
,
65 void *opaque
, const char *name
);
66 void portio_list_set_flush_coalesced(PortioList
*piolist
);
67 void portio_list_destroy(PortioList
*piolist
);
68 void portio_list_add(PortioList
*piolist
,
69 struct MemoryRegion
*address_space
,
71 void portio_list_del(PortioList
*piolist
);