PERFORCE change 101522 for review

Warner Losh imp at FreeBSD.org
Fri Jul 14 05:43:43 UTC 2006


http://perforce.freebsd.org/chv.cgi?CH=101522

Change 101522 by imp at imp_lighthouse on 2006/07/14 05:43:35

	Newer machines don't assign PCI bus numbers to the cardbus
	bridges.  Cope better with this.
	
	# waiting to hear back folks with this problem to see if it solves it.

Affected files ...

.. //depot/projects/arm/src/sys/dev/pccbb/pccbb_pci.c#7 edit

Differences ...

==== //depot/projects/arm/src/sys/dev/pccbb/pccbb_pci.c#7 (text+ko) ====

@@ -302,10 +302,11 @@
 {
 	static int curr_bus_number = 2; /* XXX EVILE BAD (see below) */
 	struct cbb_softc *sc = (struct cbb_softc *)device_get_softc(brdev);
+	struct sysctl_ctx_list *sctx;
+	struct sysctl_oid *soid;
 	int rid;
 	device_t parent;
-	struct sysctl_ctx_list *sctx;
-	struct sysctl_oid *soid;
+	uint32_t pribus;
 
 	parent = device_get_parent(brdev);
 	mtx_init(&sc->mtx, device_get_nameunit(brdev), "cbb", MTX_DEF);
@@ -317,7 +318,7 @@
 	sc->exca[0].pccarddev = NULL;
 	sc->secbus = pci_read_config(brdev, PCIR_SECBUS_2, 1);
 	sc->subbus = pci_read_config(brdev, PCIR_SUBBUS_2, 1);
-	sc->pribus = pci_read_config(brdev, PCIR_PRIBUS_2, 1);
+	sc->pribus = pcib_get_bus(parent);
 	SLIST_INIT(&sc->rl);
 	cbb_powerstate_d0(brdev);
 
@@ -359,10 +360,11 @@
 	 * are in an appropriate range.
 	 */
 	DEVPRINTF((brdev, "Secondary bus is %d\n", sc->secbus));
-	if (sc->secbus == 0) {
+	pribus = pci_read_config(brdev, PCIR_PRIBUS_2, 1);
+	if (sc->secbus == 0 || sc->pribus != pribus) {
 		if (curr_bus_number <= sc->pribus)
 			curr_bus_number = sc->pribus + 1;
-		if (pci_read_config(brdev, PCIR_PRIBUS_2, 1) != sc->pribus) {
+		if (pribus != sc->pribus) {
 			DEVPRINTF((brdev, "Setting primary bus to %d\n",
 			    sc->pribus));
 			pci_write_config(brdev, PCIR_PRIBUS_2, sc->pribus, 1);


More information about the p4-projects mailing list