2
2
* QEMU Ultrasparc APB PCI host
4
4
* Copyright (c) 2006 Fabrice Bellard
6
6
* Permission is hereby granted, free of charge, to any person obtaining a copy
7
7
* of this software and associated documentation files (the "Software"), to deal
8
8
* in the Software without restriction, including without limitation the rights
201
200
return bus_offset + irq_num;
204
static void pci_apb_set_irq(qemu_irq *pic, int irq_num, int level)
203
static void pci_apb_set_irq(void *pic, int irq_num, int level)
206
205
/* PCI IRQ map onto the first 32 INO. */
207
qemu_set_irq(pic[irq_num], level);
206
pic_set_irq_new(pic, irq_num, level);
210
PCIBus *pci_apb_init(target_phys_addr_t special_base,
211
target_phys_addr_t mem_base,
209
PCIBus *pci_apb_init(target_ulong special_base, target_ulong mem_base,
216
214
int pci_mem_config, pci_mem_data, apb_config, pci_ioport;
217
216
PCIBus *secondary;
219
218
s = qemu_mallocz(sizeof(APBState));
223
222
pci_mem_config = cpu_register_io_memory(0, pci_apb_config_read,
224
223
pci_apb_config_write, s);
225
224
apb_config = cpu_register_io_memory(0, apb_config_read,
226
apb_config_write, s);
225
apb_config_write, s);
227
226
pci_mem_data = cpu_register_io_memory(0, pci_apb_read,
228
227
pci_apb_write, s);
229
228
pci_ioport = cpu_register_io_memory(0, pci_apb_ioread,
230
229
pci_apb_iowrite, s);
232
231
cpu_register_physical_memory(special_base + 0x2000ULL, 0x40, apb_config);
233
cpu_register_physical_memory(special_base + 0x1000000ULL, 0x10,
235
cpu_register_physical_memory(special_base + 0x2000000ULL, 0x10000,
237
cpu_register_physical_memory(mem_base, 0x10000000,
238
pci_mem_data); // XXX size should be 4G-prom
232
cpu_register_physical_memory(special_base + 0x1000000ULL, 0x10, pci_mem_config);
233
cpu_register_physical_memory(special_base + 0x2000000ULL, 0x10000, pci_ioport);
234
cpu_register_physical_memory(mem_base, 0x10000000, pci_mem_data); // XXX size should be 4G-prom
240
d = pci_register_device(s->bus, "Advanced PCI Bus", sizeof(PCIDevice),
236
d = pci_register_device(s->bus, "Advanced PCI Bus", sizeof(PCIDevice),
242
238
d->config[0x00] = 0x8e; // vendor_id : Sun
243
239
d->config[0x01] = 0x10;
255
251
d->config[0x0E] = 0x00; // header_type
257
253
/* APB secondary busses */
258
secondary = pci_bridge_init(s->bus, 8, 0x108e5000, pci_apb_map_irq,
259
"Advanced PCI Bus secondary bridge 1");
260
pci_bridge_init(s->bus, 9, 0x108e5000, pci_apb_map_irq,
261
"Advanced PCI Bus secondary bridge 2");
254
secondary = pci_bridge_init(s->bus, 8, 0x108e5000, pci_apb_map_irq, "Advanced PCI Bus secondary bridge 1");
255
pci_bridge_init(s->bus, 9, 0x108e5000, pci_apb_map_irq, "Advanced PCI Bus secondary bridge 2");
262
256
return secondary;