25 |
* SUCH DAMAGE. |
* SUCH DAMAGE. |
26 |
* |
* |
27 |
* |
* |
28 |
* $Id: bus_pci.c,v 1.80 2007/02/11 10:03:55 debug Exp $ |
* $Id: bus_pci.c,v 1.82 2007/04/21 02:36:23 debug Exp $ |
29 |
* |
* |
30 |
* Generic PCI bus framework. This is not a normal "device", but is used by |
* Generic PCI bus framework. This is not a normal "device", but is used by |
31 |
* individual PCI controllers and devices. |
* individual PCI controllers and devices. |
381 |
d->isa_portbase = isa_portbase; |
d->isa_portbase = isa_portbase; |
382 |
d->isa_membase = isa_membase; |
d->isa_membase = isa_membase; |
383 |
|
|
384 |
|
d->cur_pci_portbase = d->pci_portbase; |
385 |
|
d->cur_pci_membase = d->pci_membase; |
386 |
|
|
387 |
/* Assume that the first 64KB could be used by legacy ISA devices: */ |
/* Assume that the first 64KB could be used by legacy ISA devices: */ |
388 |
d->cur_pci_portbase = d->pci_portbase + 0x10000; |
if (d->isa_portbase != 0 || d->isa_membase != 0) { |
389 |
d->cur_pci_membase = d->pci_membase + 0x10000; |
d->cur_pci_portbase += 0x10000; |
390 |
|
d->cur_pci_membase += 0x10000; |
391 |
|
} |
392 |
|
|
393 |
return d; |
return d; |
394 |
} |
} |
1142 |
} |
} |
1143 |
|
|
1144 |
|
|
1145 |
|
|
1146 |
|
/* |
1147 |
|
* Realtek 8139C+ PCI ethernet. |
1148 |
|
*/ |
1149 |
|
|
1150 |
|
#define PCI_VENDOR_REALTEK 0x10ec |
1151 |
|
#define PCI_PRODUCT_REALTEK_RT8139 0x8139 |
1152 |
|
|
1153 |
|
PCIINIT(rtl8139c) |
1154 |
|
{ |
1155 |
|
uint64_t port, memaddr; |
1156 |
|
int pci_int_line = 0x101, irq = 0; |
1157 |
|
char irqstr[200]; |
1158 |
|
char tmpstr[200]; |
1159 |
|
|
1160 |
|
PCI_SET_DATA(PCI_ID_REG, PCI_ID_CODE(PCI_VENDOR_REALTEK, |
1161 |
|
PCI_PRODUCT_REALTEK_RT8139)); |
1162 |
|
|
1163 |
|
PCI_SET_DATA(PCI_CLASS_REG, PCI_CLASS_CODE(PCI_CLASS_NETWORK, |
1164 |
|
PCI_SUBCLASS_NETWORK_ETHERNET, 0x00) + 0x20); |
1165 |
|
|
1166 |
|
switch (machine->machine_type) { |
1167 |
|
case MACHINE_LANDISK: |
1168 |
|
irq = 5; |
1169 |
|
pci_int_line = 0x105; |
1170 |
|
break; |
1171 |
|
default:fatal("rtl8139c for this machine has not been " |
1172 |
|
"implemented yet\n"); |
1173 |
|
exit(1); |
1174 |
|
} |
1175 |
|
|
1176 |
|
PCI_SET_DATA(PCI_INTERRUPT_REG, 0x28140000 | pci_int_line); |
1177 |
|
|
1178 |
|
allocate_device_space(pd, 0x100, 0, &port, &memaddr); |
1179 |
|
|
1180 |
|
snprintf(irqstr, sizeof(irqstr), "%s.%i", |
1181 |
|
pd->pcibus->irq_path_pci, irq); |
1182 |
|
|
1183 |
|
snprintf(tmpstr, sizeof(tmpstr), "rtl8139c addr=0x%llx " |
1184 |
|
"irq=%s pci_little_endian=1", (long long)port, irqstr); |
1185 |
|
|
1186 |
|
device_add(machine, tmpstr); |
1187 |
|
} |
1188 |
|
|
1189 |
|
|
1190 |
|
|
1191 |
/* |
/* |
1192 |
* DEC 21143 ("Tulip") PCI ethernet. |
* DEC 21143 ("Tulip") PCI ethernet. |