Revision a455783b hw/apb_pci.c

b/hw/apb_pci.c
54 54
    PCIHostState host_state;
55 55
} APBState;
56 56

  
57
static void pci_apb_config_writel (void *opaque, target_phys_addr_t addr,
58
                                         uint32_t val)
59
{
60
    APBState *s = opaque;
61

  
62
#ifdef TARGET_WORDS_BIGENDIAN
63
    val = bswap32(val);
64
#endif
65
    APB_DPRINTF("config_writel addr " TARGET_FMT_plx " val %x\n", addr,
66
                val);
67
    s->host_state.config_reg = val;
68
}
69

  
70
static uint32_t pci_apb_config_readl (void *opaque,
71
                                            target_phys_addr_t addr)
72
{
73
    APBState *s = opaque;
74
    uint32_t val;
75

  
76
    val = s->host_state.config_reg;
77
#ifdef TARGET_WORDS_BIGENDIAN
78
    val = bswap32(val);
79
#endif
80
    APB_DPRINTF("config_readl addr " TARGET_FMT_plx " val %x\n", addr,
81
                val);
82
    return val;
83
}
84

  
85
static CPUWriteMemoryFunc * const pci_apb_config_write[] = {
86
    &pci_apb_config_writel,
87
    &pci_apb_config_writel,
88
    &pci_apb_config_writel,
89
};
90

  
91
static CPUReadMemoryFunc * const pci_apb_config_read[] = {
92
    &pci_apb_config_readl,
93
    &pci_apb_config_readl,
94
    &pci_apb_config_readl,
95
};
96

  
97 57
static void apb_config_writel (void *opaque, target_phys_addr_t addr,
98 58
                               uint32_t val)
99 59
{
......
275 235
                                          pci_apb_iowrite, s);
276 236
    sysbus_init_mmio(dev, 0x10000ULL, pci_ioport);
277 237
    /* mem_config  */
278
    pci_mem_config = cpu_register_io_memory(pci_apb_config_read,
279
                                            pci_apb_config_write, s);
238
    pci_mem_config = pci_host_config_register_io_memory(&s->host_state);
280 239
    sysbus_init_mmio(dev, 0x10ULL, pci_mem_config);
281 240
    /* mem_data */
282 241
    pci_mem_data = pci_host_data_register_io_memory(&s->host_state);

Also available in: Unified diff