Patrick Georgi (patrick@georgi-clan.de) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/1063
-gerrit
commit e2652253daf6c7858626274b5a7fb42e1b56139f Author: Patrick Georgi patrick@georgi-clan.de Date: Wed May 30 00:26:57 2012 +0200
Create single function for QEmu I/O access
Provide the same single function interface to QEmu I/O ports as for SerialICE I/O access.
Change-Id: I068d3aaf0bd602bb7eaf13d014074d74d6523b97 Signed-off-by: Kyösti Mälkki kyosti.malkki@gmail.com [pg: Reorganized Kyösti's patch set] Signed-off-by: Patrick Georgi patrick@georgi-clan.de --- qemu-0.15.x/ioport.c | 33 +++++++++++++++++++++++++++++++++ qemu-0.15.x/ioport.h | 3 +++ 2 files changed, 36 insertions(+), 0 deletions(-)
diff --git a/qemu-0.15.x/ioport.c b/qemu-0.15.x/ioport.c index 0d2611d..aca38f2 100644 --- a/qemu-0.15.x/ioport.c +++ b/qemu-0.15.x/ioport.c @@ -313,3 +313,36 @@ uint32_t cpu_inl(pio_addr_t addr) LOG_IOPORT("inl : %04"FMT_pioaddr" %08"PRIx32"\n", addr, val); return val; } + +uint32_t cpu_io_read_wrapper(uint16_t port, unsigned int size) +{ + switch (size) { + case 1: + return cpu_inb(port); + case 2: + return cpu_inw(port); + case 4: + return cpu_inl(port); + default: + break; + } + return -1; +} + +void cpu_io_write_wrapper(uint16_t port, unsigned int size, uint32_t data) +{ + switch (size) { + case 1: + cpu_outb(port, (uint8_t) data); + return; + case 2: + cpu_outw(port, (uint16_t) data); + return; + case 4: + cpu_outl(port, (uint32_t) data); + return; + default: + break; + } + return; +} diff --git a/qemu-0.15.x/ioport.h b/qemu-0.15.x/ioport.h index 82ffd9d..18a1658 100644 --- a/qemu-0.15.x/ioport.h +++ b/qemu-0.15.x/ioport.h @@ -48,8 +48,11 @@ bool isa_is_ioport_assigned(pio_addr_t start); void cpu_outb(pio_addr_t addr, uint8_t val); void cpu_outw(pio_addr_t addr, uint16_t val); void cpu_outl(pio_addr_t addr, uint32_t val); +void cpu_io_write_wrapper(uint16_t port, unsigned int size, uint32_t data); + uint8_t cpu_inb(pio_addr_t addr); uint16_t cpu_inw(pio_addr_t addr); uint32_t cpu_inl(pio_addr_t addr); +uint32_t cpu_io_read_wrapper(uint16_t port, unsigned int size);
#endif /* IOPORT_H */