Revision e1c6bbab hw/grackle_pci.c
b/hw/grackle_pci.c | ||
---|---|---|
119 | 119 |
return 0; |
120 | 120 |
} |
121 | 121 |
|
122 |
static int pci_dec_21154_init_device(SysBusDevice *dev) |
|
123 |
{ |
|
124 |
GrackleState *s; |
|
125 |
int pci_mem_config, pci_mem_data; |
|
126 |
|
|
127 |
s = FROM_SYSBUS(GrackleState, dev); |
|
128 |
|
|
129 |
pci_mem_config = pci_host_conf_register_mmio(&s->host_state); |
|
130 |
pci_mem_data = pci_host_data_register_mmio(&s->host_state); |
|
131 |
sysbus_init_mmio(dev, 0x1000, pci_mem_config); |
|
132 |
sysbus_init_mmio(dev, 0x1000, pci_mem_data); |
|
133 |
return 0; |
|
134 |
} |
|
135 |
|
|
136 | 122 |
static int grackle_pci_host_init(PCIDevice *d) |
137 | 123 |
{ |
138 | 124 |
pci_config_set_vendor_id(d->config, PCI_VENDOR_ID_MOTOROLA); |
... | ... | |
144 | 130 |
return 0; |
145 | 131 |
} |
146 | 132 |
|
147 |
static int dec_21154_pci_host_init(PCIDevice *d) |
|
148 |
{ |
|
149 |
/* PCI2PCI bridge same values as PearPC - check this */ |
|
150 |
pci_config_set_vendor_id(d->config, PCI_VENDOR_ID_DEC); |
|
151 |
pci_config_set_device_id(d->config, PCI_DEVICE_ID_DEC_21154); |
|
152 |
d->config[0x08] = 0x02; // revision |
|
153 |
pci_config_set_class(d->config, PCI_CLASS_BRIDGE_PCI); |
|
154 |
d->config[PCI_HEADER_TYPE] = PCI_HEADER_TYPE_BRIDGE; // header_type |
|
155 |
|
|
156 |
d->config[0x18] = 0x0; // primary_bus |
|
157 |
d->config[0x19] = 0x1; // secondary_bus |
|
158 |
d->config[0x1a] = 0x1; // subordinate_bus |
|
159 |
d->config[0x1c] = 0x10; // io_base |
|
160 |
d->config[0x1d] = 0x20; // io_limit |
|
161 |
|
|
162 |
d->config[0x20] = 0x80; // memory_base |
|
163 |
d->config[0x21] = 0x80; |
|
164 |
d->config[0x22] = 0x90; // memory_limit |
|
165 |
d->config[0x23] = 0x80; |
|
166 |
|
|
167 |
d->config[0x24] = 0x00; // prefetchable_memory_base |
|
168 |
d->config[0x25] = 0x84; |
|
169 |
d->config[0x26] = 0x00; // prefetchable_memory_limit |
|
170 |
d->config[0x27] = 0x85; |
|
171 |
return 0; |
|
172 |
} |
|
173 |
|
|
174 | 133 |
static PCIDeviceInfo grackle_pci_host_info = { |
175 | 134 |
.qdev.name = "grackle", |
176 | 135 |
.qdev.size = sizeof(PCIDevice), |
177 | 136 |
.init = grackle_pci_host_init, |
178 | 137 |
}; |
179 | 138 |
|
180 |
static PCIDeviceInfo dec_21154_pci_host_info = { |
|
181 |
.qdev.name = "dec-21154", |
|
182 |
.qdev.size = sizeof(PCIDevice), |
|
183 |
.init = dec_21154_pci_host_init, |
|
184 |
.header_type = PCI_HEADER_TYPE_BRIDGE, |
|
185 |
}; |
|
186 |
|
|
187 | 139 |
static void grackle_register_devices(void) |
188 | 140 |
{ |
189 | 141 |
sysbus_register_dev("grackle", sizeof(GrackleState), |
190 | 142 |
pci_grackle_init_device); |
191 | 143 |
pci_qdev_register(&grackle_pci_host_info); |
192 |
sysbus_register_dev("dec-21154", sizeof(GrackleState), |
|
193 |
pci_dec_21154_init_device); |
|
194 |
pci_qdev_register(&dec_21154_pci_host_info); |
|
195 | 144 |
} |
196 | 145 |
|
197 | 146 |
device_init(grackle_register_devices) |
Also available in: Unified diff