static void pci_apb_iowriteb (void *opaque, target_phys_addr_t addr,
uint32_t val)
{
- cpu_outb(NULL, addr & 0xffff, val);
+ cpu_outb(NULL, addr & IOPORTS_MASK, val);
}
static void pci_apb_iowritew (void *opaque, target_phys_addr_t addr,
uint32_t val)
{
- cpu_outw(NULL, addr & 0xffff, val);
+ cpu_outw(NULL, addr & IOPORTS_MASK, val);
}
static void pci_apb_iowritel (void *opaque, target_phys_addr_t addr,
uint32_t val)
{
- cpu_outl(NULL, addr & 0xffff, val);
+ cpu_outl(NULL, addr & IOPORTS_MASK, val);
}
static uint32_t pci_apb_ioreadb (void *opaque, target_phys_addr_t addr)
{
uint32_t val;
- val = cpu_inb(NULL, addr & 0xffff);
+ val = cpu_inb(NULL, addr & IOPORTS_MASK);
return val;
}
{
uint32_t val;
- val = cpu_inw(NULL, addr & 0xffff);
+ val = cpu_inw(NULL, addr & IOPORTS_MASK);
return val;
}
{
uint32_t val;
- val = cpu_inl(NULL, addr & 0xffff);
+ val = cpu_inl(NULL, addr & IOPORTS_MASK);
return val;
}
static void isa_mmio_writeb (void *opaque, target_phys_addr_t addr,
uint32_t val)
{
- cpu_outb(NULL, addr & 0xffff, val);
+ cpu_outb(NULL, addr & IOPORTS_MASK, val);
}
static void isa_mmio_writew (void *opaque, target_phys_addr_t addr,
#ifdef TARGET_WORDS_BIGENDIAN
val = bswap16(val);
#endif
- cpu_outw(NULL, addr & 0xffff, val);
+ cpu_outw(NULL, addr & IOPORTS_MASK, val);
}
static void isa_mmio_writel (void *opaque, target_phys_addr_t addr,
#ifdef TARGET_WORDS_BIGENDIAN
val = bswap32(val);
#endif
- cpu_outl(NULL, addr & 0xffff, val);
+ cpu_outl(NULL, addr & IOPORTS_MASK, val);
}
static uint32_t isa_mmio_readb (void *opaque, target_phys_addr_t addr)
{
uint32_t val;
- val = cpu_inb(NULL, addr & 0xffff);
+ val = cpu_inb(NULL, addr & IOPORTS_MASK);
return val;
}
{
uint32_t val;
- val = cpu_inw(NULL, addr & 0xffff);
+ val = cpu_inw(NULL, addr & IOPORTS_MASK);
#ifdef TARGET_WORDS_BIGENDIAN
val = bswap16(val);
#endif
{
uint32_t val;
- val = cpu_inl(NULL, addr & 0xffff);
+ val = cpu_inl(NULL, addr & IOPORTS_MASK);
#ifdef TARGET_WORDS_BIGENDIAN
val = bswap32(val);
#endif
{
uint32_t data;
data = ioport_read(0, address);
- address = (address + 1) & (MAX_IOPORTS - 1);
+ address = (address + 1) & IOPORTS_MASK;
data |= ioport_read(0, address) << 8;
return data;
}
static void default_ioport_writew(void *opaque, uint32_t address, uint32_t data)
{
ioport_write(0, address, data & 0xff);
- address = (address + 1) & (MAX_IOPORTS - 1);
+ address = (address + 1) & IOPORTS_MASK;
ioport_write(0, address, (data >> 8) & 0xff);
}
#include "qemu-common.h"
#define MAX_IOPORTS (64 * 1024)
+#define IOPORTS_MASK (MAX_IOPORTS - 1)
/* These should really be in isa.h, but are here to make pc.h happy. */
typedef void (IOPortWriteFunc)(void *opaque, uint32_t address, uint32_t data);
int suffix;
if (has_index) {
- cpu_outb(NULL, addr & 0xffff, index & 0xff);
+ cpu_outb(NULL, addr & IOPORTS_MASK, index & 0xff);
addr++;
}
addr &= 0xffff;