View | Details | Raw Unified | Return to bug 146438
Collapse All | Expand All

(-) (-1 / +74 lines)
Line  Link Here
 (AMD64-based Laptops), also Compaq R4000 series
 (AMD64-based Laptops), also Compaq R4000 series
1
 gives the correspondig message which detects the problem.
1
 gives the correspondig message which detects the problem.
2
-- linux-2.6.16/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
/**
1001
 * yenta_fixup_parent_subordinate - Fix subordinate bus# of the parent bridge
1002
 * @cardbus_bridge: The PCI bus which the CardBus bridge bridges to
1003
 *
1004
 * Checks if devices on the bus which the CardBus bridge bridges to would be
1005
 * invisible during PCI scans because of a misconfigured subordinate number
1006
 * of the parent brige - some BIOSes seem to be too lazy to set it right.
1007
 * Does the fixup carefully by checking how far it can go without conflicts.
1008
 * See http://bugzilla.kernel.org/show_bug.cgi?id=2944 for more information.
1009
 */
1010
static void yenta_fixup_parent_bridge(struct pci_bus *cardbus_bridge)
1011
{
1012
	struct list_head *tmp;
1013
	/* Our starting point is the max PCI bus number */
1014
	unsigned char upper_limit = 0xff;
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
1000
/*
1072
/*
1001
 * Initialize a cardbus controller. Make sure we have a usable
1073
 * Initialize a cardbus controller. Make sure we have a usable
1002
 * 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 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));
1186
	yenta_fixup_parent_bridge(dev->subordinate);
1187
1115
	/* Register it with the pcmcia layer.. */
1188
	/* Register it with the pcmcia layer.. */
1116
	ret = pcmcia_register_socket(&socket->socket);
1189
	ret = pcmcia_register_socket(&socket->socket);
1117
	if (ret == 0) {
1190
	if (ret == 0) {

Return to bug 146438