|
Line
Link Here
|
| 0 |
-- linux-2.4.17-rc1/drivers/pcmcia/yenta_socket.c |
0 |
++ linux-2.4.17-rc1/drivers/pcmcia/yenta_socket.c |
|
Lines 998-1003
Link Here
|
| 998 |
config_writew(socket, CB_BRIDGE_CONTROL, bridge); |
998 |
config_writew(socket, CB_BRIDGE_CONTROL, bridge); |
| 999 |
} |
999 |
} |
| 1000 |
|
1000 |
|
|
|
1001 |
/** |
| 1002 |
* yenta_fixup_parent_subordinate - Fix subordinate bus# of the parent bridge |
| 1003 |
* @cardbus_bridge: The PCI bus which the CardBus bridge bridges to |
| 1004 |
* |
| 1005 |
* Checks if devices on the bus which the CardBus bridge bridges to would be |
| 1006 |
* invisible during PCI scans because of a misconfigured subordinate number |
| 1007 |
* of the parent brige - some BIOSes seem to be too lazy to set it right. |
| 1008 |
* Does the fixup carefully by checking how far it can go without conflicts. |
| 1009 |
* See http://bugzilla.kernel.org/show_bug.cgi?id=2944 for more information. |
| 1010 |
*/ |
| 1011 |
static void yenta_fixup_parent_bridge(struct pci_bus *cardbus_bridge) |
| 1012 |
{ |
| 1013 |
struct list_head *tmp; |
| 1014 |
unsigned char upper_limit; |
| 1015 |
/* |
| 1016 |
* We only check and fix the parent bridge: All systems which need |
| 1017 |
* this fixup that have been reviewed are laptops and the only bridge |
| 1018 |
* which needed fixing was the parent bridge of the CardBus bridge: |
| 1019 |
*/ |
| 1020 |
struct pci_bus *bridge_to_fix = cardbus_bridge->parent; |
| 1021 |
|
| 1022 |
/* Check bus numbers are already set up correctly: */ |
| 1023 |
if (bridge_to_fix->subordinate >= cardbus_bridge->subordinate) |
| 1024 |
return; /* The subordinate number is ok, nothing to do */ |
| 1025 |
|
| 1026 |
if (!bridge_to_fix->parent) |
| 1027 |
return; /* Root bridges are ok */ |
| 1028 |
|
| 1029 |
/* stay within the limits of the bus range of the parent: */ |
| 1030 |
upper_limit = bridge_to_fix->parent->subordinate; |
| 1031 |
|
| 1032 |
/* check the bus ranges of all silbling bridges to prevent overlap */ |
| 1033 |
list_for_each(tmp, &bridge_to_fix->parent->children) { |
| 1034 |
struct pci_bus * silbling = pci_bus_b(tmp); |
| 1035 |
/* |
| 1036 |
* If the silbling has a higher secondary bus number |
| 1037 |
* and it's secondary is equal or smaller than our |
| 1038 |
* current upper limit, set the new upper limit to |
| 1039 |
* the bus number below the silbling's range: |
| 1040 |
*/ |
| 1041 |
if (silbling->secondary > bridge_to_fix->subordinate |
| 1042 |
&& silbling->secondary <= upper_limit) |
| 1043 |
upper_limit = silbling->secondary - 1; |
| 1044 |
} |
| 1045 |
|
| 1046 |
/* Show that the wanted subordinate number is not possible: */ |
| 1047 |
if (cardbus_bridge->subordinate > upper_limit) |
| 1048 |
printk(KERN_WARNING "Yenta: Upper limit for fixing this " |
| 1049 |
"bridge's parent bridge: #%02x\n", upper_limit); |
| 1050 |
|
| 1051 |
/* If we have room to increase the bridge's subordinate number, */ |
| 1052 |
if (bridge_to_fix->subordinate < upper_limit) { |
| 1053 |
|
| 1054 |
/* use the highest number of the hidden bus, within limits */ |
| 1055 |
unsigned char subordinate_to_assign = |
| 1056 |
min(cardbus_bridge->subordinate, upper_limit); |
| 1057 |
|
| 1058 |
printk(KERN_INFO "Yenta: Raising subordinate bus# of parent " |
| 1059 |
"bus (#%02x) from #%02x to #%02x\n", |
| 1060 |
bridge_to_fix->number, |
| 1061 |
bridge_to_fix->subordinate, subordinate_to_assign); |
| 1062 |
|
| 1063 |
/* Save the new subordinate in the bus struct of the bridge */ |
| 1064 |
bridge_to_fix->subordinate = subordinate_to_assign; |
| 1065 |
|
| 1066 |
/* and update the PCI config space with the new subordinate */ |
| 1067 |
pci_write_config_byte(bridge_to_fix->self, |
| 1068 |
PCI_SUBORDINATE_BUS, bridge_to_fix->subordinate); |
| 1069 |
} |
| 1070 |
} |
| 1071 |
|
| 1001 |
/* |
1072 |
/* |
| 1002 |
* Initialize a cardbus controller. Make sure we have a usable |
1073 |
* Initialize a cardbus controller. Make sure we have a usable |
| 1003 |
* interrupt, and that we can map the cardbus area. Fill in the |
1074 |
* interrupt, and that we can map the cardbus area. Fill in the |
|
Lines 1113-1118
static int __devinit yenta_probe (struct
Link Here
|
| 1113 |
yenta_get_socket_capabilities(socket, isa_interrupts); |
1184 |
yenta_get_socket_capabilities(socket, isa_interrupts); |
| 1114 |
printk(KERN_INFO "Socket status: %08x\n", cb_readl(socket, CB_SOCKET_STATE)); |
1185 |
printk(KERN_INFO "Socket status: %08x\n", cb_readl(socket, CB_SOCKET_STATE)); |
| 1115 |
|
1186 |
|
|
|
1187 |
yenta_fixup_parent_bridge(dev->subordinate); |
| 1188 |
|
| 1116 |
/* Register it with the pcmcia layer.. */ |
1189 |
/* Register it with the pcmcia layer.. */ |
| 1117 |
ret = pcmcia_register_socket(&socket->socket); |
1190 |
ret = pcmcia_register_socket(&socket->socket); |
| 1118 |
if (ret == 0) { |
1191 |
if (ret == 0) { |