Revision a455783b hw/grackle_pci.c
b/hw/grackle_pci.c | ||
---|---|---|
43 | 43 |
PCIHostState host_state; |
44 | 44 |
} GrackleState; |
45 | 45 |
|
46 |
static void pci_grackle_config_writel (void *opaque, target_phys_addr_t addr, |
|
47 |
uint32_t val) |
|
48 |
{ |
|
49 |
GrackleState *s = opaque; |
|
50 |
|
|
51 |
GRACKLE_DPRINTF("config_writel addr " TARGET_FMT_plx " val %x\n", addr, |
|
52 |
val); |
|
53 |
#ifdef TARGET_WORDS_BIGENDIAN |
|
54 |
val = bswap32(val); |
|
55 |
#endif |
|
56 |
s->host_state.config_reg = val; |
|
57 |
} |
|
58 |
|
|
59 |
static uint32_t pci_grackle_config_readl (void *opaque, target_phys_addr_t addr) |
|
60 |
{ |
|
61 |
GrackleState *s = opaque; |
|
62 |
uint32_t val; |
|
63 |
|
|
64 |
val = s->host_state.config_reg; |
|
65 |
#ifdef TARGET_WORDS_BIGENDIAN |
|
66 |
val = bswap32(val); |
|
67 |
#endif |
|
68 |
GRACKLE_DPRINTF("config_readl addr " TARGET_FMT_plx " val %x\n", addr, |
|
69 |
val); |
|
70 |
return val; |
|
71 |
} |
|
72 |
|
|
73 |
static CPUWriteMemoryFunc * const pci_grackle_config_write[] = { |
|
74 |
&pci_grackle_config_writel, |
|
75 |
&pci_grackle_config_writel, |
|
76 |
&pci_grackle_config_writel, |
|
77 |
}; |
|
78 |
|
|
79 |
static CPUReadMemoryFunc * const pci_grackle_config_read[] = { |
|
80 |
&pci_grackle_config_readl, |
|
81 |
&pci_grackle_config_readl, |
|
82 |
&pci_grackle_config_readl, |
|
83 |
}; |
|
84 |
|
|
85 | 46 |
/* Don't know if this matches real hardware, but it agrees with OHW. */ |
86 | 47 |
static int pci_grackle_map_irq(PCIDevice *pci_dev, int irq_num) |
87 | 48 |
{ |
... | ... | |
147 | 108 |
|
148 | 109 |
s = FROM_SYSBUS(GrackleState, dev); |
149 | 110 |
|
150 |
pci_mem_config = cpu_register_io_memory(pci_grackle_config_read, |
|
151 |
pci_grackle_config_write, s); |
|
111 |
pci_mem_config = pci_host_config_register_io_memory(&s->host_state); |
|
152 | 112 |
pci_mem_data = pci_host_data_register_io_memory(&s->host_state); |
153 | 113 |
sysbus_init_mmio(dev, 0x1000, pci_mem_config); |
154 | 114 |
sysbus_init_mmio(dev, 0x1000, pci_mem_data); |
... | ... | |
166 | 126 |
|
167 | 127 |
s = FROM_SYSBUS(GrackleState, dev); |
168 | 128 |
|
169 |
pci_mem_config = cpu_register_io_memory(pci_grackle_config_read, |
|
170 |
pci_grackle_config_write, s); |
|
129 |
pci_mem_config = pci_host_config_register_io_memory(&s->host_state); |
|
171 | 130 |
pci_mem_data = pci_host_data_register_io_memory(&s->host_state); |
172 | 131 |
sysbus_init_mmio(dev, 0x1000, pci_mem_config); |
173 | 132 |
sysbus_init_mmio(dev, 0x1000, pci_mem_data); |
Also available in: Unified diff