25 |
* SUCH DAMAGE. |
* SUCH DAMAGE. |
26 |
* |
* |
27 |
* |
* |
28 |
* $Id: bus_pci.c,v 1.82 2007/04/21 02:36:23 debug Exp $ |
* $Id: bus_pci.c,v 1.84 2007/06/15 18:13:04 debug Exp $ |
29 |
* |
* |
30 |
* Generic PCI bus framework. This is not a normal "device", but is used by |
* COMMENT: Generic PCI bus framework |
31 |
* individual PCI controllers and devices. |
* |
32 |
|
* This is not a normal "device", but is used by individual PCI controllers |
33 |
|
* and devices. |
34 |
* |
* |
35 |
* See NetBSD's pcidevs.h for more PCI vendor and device identifiers. |
* See NetBSD's pcidevs.h for more PCI vendor and device identifiers. |
36 |
* |
* |
60 |
#include "memory.h" |
#include "memory.h" |
61 |
#include "misc.h" |
#include "misc.h" |
62 |
|
|
63 |
|
#include "cpc700reg.h" |
64 |
#include "wdc.h" |
#include "wdc.h" |
65 |
|
|
66 |
extern int verbose; |
extern int verbose; |
243 |
pd = pd->next; |
pd = pd->next; |
244 |
} |
} |
245 |
|
|
246 |
pd = malloc(sizeof(struct pci_device)); |
CHECK_ALLOCATION(pd = malloc(sizeof(struct pci_device))); |
|
if (pd == NULL) { |
|
|
fprintf(stderr, "out of memory\n"); |
|
|
exit(1); |
|
|
} |
|
|
|
|
247 |
memset(pd, 0, sizeof(struct pci_device)); |
memset(pd, 0, sizeof(struct pci_device)); |
248 |
|
|
249 |
/* Add the new device first in the PCI bus' chain: */ |
/* Add the new device first in the PCI bus' chain: */ |
250 |
pd->next = pci_data->first_device; |
pd->next = pci_data->first_device; |
251 |
pci_data->first_device = pd; |
pci_data->first_device = pd; |
252 |
|
|
253 |
|
CHECK_ALLOCATION(pd->name = strdup(name)); |
254 |
pd->pcibus = pci_data; |
pd->pcibus = pci_data; |
|
pd->name = strdup(name); |
|
255 |
pd->bus = bus; |
pd->bus = bus; |
256 |
pd->device = device; |
pd->device = device; |
257 |
pd->function = function; |
pd->function = function; |
361 |
{ |
{ |
362 |
struct pci_data *d; |
struct pci_data *d; |
363 |
|
|
364 |
d = malloc(sizeof(struct pci_data)); |
CHECK_ALLOCATION(d = malloc(sizeof(struct pci_data))); |
|
if (d == NULL) { |
|
|
fprintf(stderr, "out of memory\n"); |
|
|
exit(1); |
|
|
} |
|
365 |
memset(d, 0, sizeof(struct pci_data)); |
memset(d, 0, sizeof(struct pci_data)); |
366 |
|
|
367 |
d->irq_path = strdup(irq_path); |
CHECK_ALLOCATION(d->irq_path = strdup(irq_path)); |
368 |
d->irq_path_isa = strdup(isa_irqbase); |
CHECK_ALLOCATION(d->irq_path_isa = strdup(isa_irqbase)); |
369 |
d->irq_path_pci = strdup(pci_irqbase); |
CHECK_ALLOCATION(d->irq_path_pci = strdup(pci_irqbase)); |
370 |
|
|
371 |
d->pci_actual_io_offset = pci_actual_io_offset; |
d->pci_actual_io_offset = pci_actual_io_offset; |
372 |
d->pci_actual_mem_offset = pci_actual_mem_offset; |
d->pci_actual_mem_offset = pci_actual_mem_offset; |
805 |
/* channel 0 and 1 enabled as IDE */ |
/* channel 0 and 1 enabled as IDE */ |
806 |
PCI_SET_DATA(0x40, 0x80008000); |
PCI_SET_DATA(0x40, 0x80008000); |
807 |
|
|
808 |
pd->extra = malloc(sizeof(struct piix_ide_extra)); |
CHECK_ALLOCATION(pd->extra = malloc(sizeof(struct piix_ide_extra))); |
|
if (pd->extra == NULL) { |
|
|
fatal("Out of memory.\n"); |
|
|
exit(1); |
|
|
} |
|
809 |
((struct piix_ide_extra *)pd->extra)->wdc0 = NULL; |
((struct piix_ide_extra *)pd->extra)->wdc0 = NULL; |
810 |
((struct piix_ide_extra *)pd->extra)->wdc1 = NULL; |
((struct piix_ide_extra *)pd->extra)->wdc1 = NULL; |
811 |
|
|
845 |
/* channel 0 and 1 enabled as IDE */ |
/* channel 0 and 1 enabled as IDE */ |
846 |
PCI_SET_DATA(0x40, 0x80008000); |
PCI_SET_DATA(0x40, 0x80008000); |
847 |
|
|
848 |
pd->extra = malloc(sizeof(struct piix_ide_extra)); |
CHECK_ALLOCATION(pd->extra = malloc(sizeof(struct piix_ide_extra))); |
|
if (pd->extra == NULL) { |
|
|
fatal("Out of memory.\n"); |
|
|
exit(1); |
|
|
} |
|
849 |
((struct piix_ide_extra *)pd->extra)->wdc0 = NULL; |
((struct piix_ide_extra *)pd->extra)->wdc0 = NULL; |
850 |
((struct piix_ide_extra *)pd->extra)->wdc1 = NULL; |
((struct piix_ide_extra *)pd->extra)->wdc1 = NULL; |
851 |
|
|
981 |
/* channel 0 and 1 enabled */ |
/* channel 0 and 1 enabled */ |
982 |
PCI_SET_DATA(0x40, 0x00000003); |
PCI_SET_DATA(0x40, 0x00000003); |
983 |
|
|
984 |
pd->extra = malloc(sizeof(struct vt82c586_ide_extra)); |
CHECK_ALLOCATION(pd->extra = malloc(sizeof(struct vt82c586_ide_extra))); |
|
if (pd->extra == NULL) { |
|
|
fatal("Out of memory.\n"); |
|
|
exit(1); |
|
|
} |
|
985 |
((struct vt82c586_ide_extra *)pd->extra)->wdc0 = NULL; |
((struct vt82c586_ide_extra *)pd->extra)->wdc0 = NULL; |
986 |
((struct vt82c586_ide_extra *)pd->extra)->wdc1 = NULL; |
((struct vt82c586_ide_extra *)pd->extra)->wdc1 = NULL; |
987 |
|
|
1094 |
/* channel 0 and 1 enabled */ |
/* channel 0 and 1 enabled */ |
1095 |
PCI_SET_DATA(0x40, 0x00000003); |
PCI_SET_DATA(0x40, 0x00000003); |
1096 |
|
|
1097 |
pd->extra = malloc(sizeof(struct symphony_82c105_extra)); |
CHECK_ALLOCATION(pd->extra = malloc(sizeof(struct symphony_82c105_extra))); |
|
if (pd->extra == NULL) { |
|
|
fatal("Out of memory.\n"); |
|
|
exit(1); |
|
|
} |
|
1098 |
((struct symphony_82c105_extra *)pd->extra)->wdc0 = NULL; |
((struct symphony_82c105_extra *)pd->extra)->wdc0 = NULL; |
1099 |
((struct symphony_82c105_extra *)pd->extra)->wdc1 = NULL; |
((struct symphony_82c105_extra *)pd->extra)->wdc1 = NULL; |
1100 |
|
|
1213 |
break; |
break; |
1214 |
case MACHINE_PMPPC: |
case MACHINE_PMPPC: |
1215 |
/* TODO, not working yet */ |
/* TODO, not working yet */ |
1216 |
irq = 31 - 21; |
irq = 31 - CPC_IB_EXT1; |
1217 |
pci_int_line = 0x201; |
pci_int_line = 0x101; |
1218 |
break; |
break; |
1219 |
case MACHINE_MACPPC: |
case MACHINE_MACPPC: |
1220 |
/* TODO, not working yet */ |
/* TODO, not working yet */ |