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
|
---|
17 | * License along with this library; if not, see <http://www.gnu.org/licenses/>.
|
---|
18 | */
|
---|
19 |
|
---|
20 | /*
|
---|
21 | * Oracle LGPL Disclaimer: For the avoidance of doubt, except that if any license choice
|
---|
22 | * other than GPL or LGPL is available it will apply instead, Oracle elects to use only
|
---|
23 | * the Lesser General Public License version 2.1 (LGPLv2) at this time for any software where
|
---|
24 | * a choice of LGPL license versions is made available with the language indicating
|
---|
25 | * that LGPLv2 or any later version may be used, or where a choice of which version
|
---|
26 | * of the LGPL is applied is otherwise unspecified.
|
---|
27 | */
|
---|
28 |
|
---|
29 | /**************************************************************************
|
---|
30 | * IO ports API
|
---|
31 | */
|
---|
32 |
|
---|
33 | #ifndef IOPORT_H
|
---|
34 | #define IOPORT_H
|
---|
35 |
|
---|
36 | #include "qemu-common.h"
|
---|
37 |
|
---|
38 | typedef uint32_t pio_addr_t;
|
---|
39 | #define FMT_pioaddr PRIx32
|
---|
40 |
|
---|
41 | #define MAX_IOPORTS (64 * 1024)
|
---|
42 | #define IOPORTS_MASK (MAX_IOPORTS - 1)
|
---|
43 |
|
---|
44 | /* These should really be in isa.h, but are here to make pc.h happy. */
|
---|
45 | typedef void (IOPortWriteFunc)(void *opaque, uint32_t address, uint32_t data);
|
---|
46 | typedef uint32_t (IOPortReadFunc)(void *opaque, uint32_t address);
|
---|
47 |
|
---|
48 | int register_ioport_read(pio_addr_t start, int length, int size,
|
---|
49 | IOPortReadFunc *func, void *opaque);
|
---|
50 | int register_ioport_write(pio_addr_t start, int length, int size,
|
---|
51 | IOPortWriteFunc *func, void *opaque);
|
---|
52 | void isa_unassign_ioport(pio_addr_t start, int length);
|
---|
53 |
|
---|
54 |
|
---|
55 | #ifndef VBOX
|
---|
56 | void cpu_outb(pio_addr_t addr, uint8_t val);
|
---|
57 | void cpu_outw(pio_addr_t addr, uint16_t val);
|
---|
58 | void cpu_outl(pio_addr_t addr, uint32_t val);
|
---|
59 | uint8_t cpu_inb(pio_addr_t addr);
|
---|
60 | uint16_t cpu_inw(pio_addr_t addr);
|
---|
61 | uint32_t cpu_inl(pio_addr_t addr);
|
---|
62 | #else
|
---|
63 | void cpu_outb(CPUX86State *env, pio_addr_t addr, uint8_t val);
|
---|
64 | void cpu_outw(CPUX86State *env, pio_addr_t addr, uint16_t val);
|
---|
65 | void cpu_outl(CPUX86State *env, pio_addr_t addr, uint32_t val);
|
---|
66 | uint8_t cpu_inb(CPUX86State *env, pio_addr_t addr);
|
---|
67 | uint16_t cpu_inw(CPUX86State *env, pio_addr_t addr);
|
---|
68 | uint32_t cpu_inl(CPUX86State *env, pio_addr_t addr);
|
---|
69 | #endif
|
---|
70 |
|
---|
71 | #endif /* IOPORT_H */
|
---|