Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 15 Feb 2013 12:19:04 GMT
From:      "Bjoern A. Zeeb" <bz@FreeBSD.org>
To:        Perforce Change Reviews <perforce@FreeBSD.org>
Subject:   PERFORCE change 222055 for review
Message-ID:  <201302151219.r1FCJ4fI018251@skunkworks.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://p4web.freebsd.org/@@222055?ac=10

Change 222055 by bz@bz_zenith on 2013/02/15 12:18:57

	Try to read the Ethernet config space from cfi as well if isf fails.
	Rename the local varibale and fix a bug releasing on the wrong
	device resource previously.

Affected files ...

.. //depot/projects/ctsrd/beribsd/src/sys/dev/altera/atse/if_atse.c#13 edit

Differences ...

==== //depot/projects/ctsrd/beribsd/src/sys/dev/altera/atse/if_atse.c#13 (text+ko) ====

@@ -630,18 +630,21 @@
 atse_ethernet_option_bits_read_fdt(device_t dev)
 {
 	struct resource *res;
-	device_t isfdev;
+	device_t fdev;
 	int i, rid;
 
 	if (atse_ethernet_option_bits_flag & ATSE_ETHERNET_OPTION_BITS_READ)
 		return (0);
 
-	isfdev = device_find_child(device_get_parent(dev), "isf", 0);
-	if (isfdev == NULL)
-		return (ENOENT);
+	fdev = device_find_child(device_get_parent(dev), "isf", 0);
+	if (fdev == NULL) {
+		fdev = device_find_child(device_get_parent(dev), "cfi", 0);
+		if (fdev == NULL)
+			return (ENOENT);
+	}
 
 	rid = 0;
-	res = bus_alloc_resource_any(isfdev, SYS_RES_MEMORY, &rid,
+	res = bus_alloc_resource_any(fdev, SYS_RES_MEMORY, &rid,
 	    RF_ACTIVE | RF_SHAREABLE);
 	if (res == NULL)
 		return (ENXIO);
@@ -650,7 +653,7 @@
 		atse_ethernet_option_bits[i] = bus_read_1(res,
 		    ALTERA_ETHERNET_OPTION_BITS_OFF + i);
 
-	bus_release_resource(dev, SYS_RES_MEMORY, rid, res);
+	bus_release_resource(fdev, SYS_RES_MEMORY, rid, res);
 	atse_ethernet_option_bits_flag |= ATSE_ETHERNET_OPTION_BITS_READ;
 
 	return (0);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201302151219.r1FCJ4fI018251>