PERFORCE change 227822 for review

Brooks Davis brooks at FreeBSD.org
Wed Apr 17 22:22:37 UTC 2013


http://p4web.freebsd.org/@@227822?ac=10

Change 227822 by brooks at brooks_zenith on 2013/04/17 22:22:04

	When we find configured interupt sources during attach, clear
	the config.  It will be reestablished later if a driver is
	configured.

Affected files ...

.. //depot/projects/ctsrd/beribsd/src/sys/mips/beri/beri_pic.c#4 edit

Differences ...

==== //depot/projects/ctsrd/beribsd/src/sys/mips/beri/beri_pic.c#4 (text+ko) ====

@@ -56,7 +56,6 @@
 static void	bp_write_cfg(struct beripic_softc *, int, uint64_t);
 static void	bp_detach_resources(device_t);
 static char	*bp_strconfig(uint64_t, char *, size_t);
-static void	bp_print_config(device_t);
 static void	bp_config_source(device_t, int, int, u_long, u_long);
 #ifdef __mips__
 static void	bp_set_counter_name(device_t, device_t, int);
@@ -217,29 +216,6 @@
 }
 
 static void
-bp_print_config(device_t dev)
-{
-	char configstr[64];
-	struct beripic_softc *sc;
-	int src;
-	uint64_t config;
-
-	sc = device_get_softc(dev);
-	
-	for (src = 0; src < sc->bp_nsrcs; src++) {
-		config = bp_read_cfg(sc, src);
-		if (config == 0)
-			continue;
-
-		device_printf(dev, "src %d: %s\n", src,
-		    bp_strconfig(config, configstr, sizeof(configstr)));
-		if (config & BP_CFG_RESERVED)
-			device_printf(dev, "reserved bits not 0: 0x%016jx\n",
-			    (uintmax_t) config);
-	}
-}
-
-static void
 bp_config_source(device_t ic, int src, int enable, u_long tid, u_long irq)
 {
 	char configstr[64];
@@ -292,11 +268,13 @@
 static int
 beripic_fdt_attach(device_t dev)
 {
+	char configstr[64];
 	struct beripic_softc *sc;
 	struct fdt_ic *fic;
 	pcell_t nhard, nsoft;
 	phandle_t ph;
-	int error, i;
+	int error, i, src;
+	uint64_t config;
 
 	sc = device_get_softc(dev);
 	sc->bp_dev = dev;
@@ -442,10 +420,22 @@
 	sc->bp_clear_bst = rman_get_bustag(sc->bp_clear_res);
 	sc->bp_clear_bsh = rman_get_bushandle(sc->bp_clear_res);
 
-	if (bootverbose)
-		bp_print_config(dev);
+	for (src = 0; src < sc->bp_nsrcs; src++) {
+		config = bp_read_cfg(sc, src);
+		if (config == 0)
+			continue;
+
+		if (bootverbose) {
+			device_printf(dev, "initial config: src %d: %s\n", src,
+			    bp_strconfig(config, configstr, sizeof(configstr)));
+			if (config & BP_CFG_RESERVED)
+				device_printf(dev,
+				    "reserved bits not 0: 0x%016jx\n",
+				    (uintmax_t) config);
+		}
 
-	/* XXX: ensure values match reset config */
+		bp_config_source(dev, src, 0, 0, 0);
+	}
 
 	fic = malloc(sizeof(*fic), M_BERIPIC, M_WAITOK|M_ZERO);
 	fic->iph = ph;


More information about the p4-projects mailing list