Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 17 Mar 2010 20:01:01 +0000 (UTC)
From:      Marius Strobl <marius@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r205254 - head/sys/sparc64/pci
Message-ID:  <201003172001.o2HK11OZ002082@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: marius
Date: Wed Mar 17 20:01:01 2010
New Revision: 205254
URL: http://svn.freebsd.org/changeset/base/205254

Log:
  - Add quirk handling for Sun Fire V1280. The firmware of these machines
    provides no ino-bitmap properties so forge them using the default set
    of controller interrupts and let schizo_setup_intr() take care of the
    children, hoping for non-fancy routing.
  - Add quirk handling for Sun Fire V890. When booting these machines from
    disk a Schizo comes up with PCI error residing which triggers as soon
    as we register schizo_pci_bus() even when clearing it from all involved
    registers (it's no longer indicated once we're in schizo_pci_bus()
    though). Thus make PCI bus errors non-fatal until we actually touch the
    bus. With this change schizo_pci_bus() typically triggers once during
    attach in this case. Obviously this approach isn't exactly race free
    but it's about the best we can do about this problem as we're not
    guaranteed that the interrupt will actually trigger on V890 either, as
    it certainly doesn't when for example netbooting them.

Modified:
  head/sys/sparc64/pci/schizo.c
  head/sys/sparc64/pci/schizovar.h

Modified: head/sys/sparc64/pci/schizo.c
==============================================================================
--- head/sys/sparc64/pci/schizo.c	Wed Mar 17 20:00:22 2010	(r205253)
+++ head/sys/sparc64/pci/schizo.c	Wed Mar 17 20:01:01 2010	(r205254)
@@ -402,9 +402,22 @@ schizo_attach(device_t dev)
 	 */
 	i = OF_getprop(node, "ino-bitmap", (void *)prop_array,
 	    sizeof(prop_array));
-	if (i == -1)
-		panic("%s: could not get ino-bitmap", __func__);
-	ino_bitmap = ((uint64_t)prop_array[1] << 32) | prop_array[0];
+	if (i != -1)
+		ino_bitmap = ((uint64_t)prop_array[1] << 32) | prop_array[0];
+	else {
+		/*
+		 * If the ino-bitmap property is missing, just provide the
+		 * default set of interrupts for this controller and let
+		 * schizo_setup_intr() take care of child interrupts.
+		 */
+		if (sc->sc_half == 0)
+			ino_bitmap = (1ULL << STX_UE_INO) |
+			    (1ULL << STX_CE_INO) |
+			    (1ULL << STX_PCIERR_A_INO) |
+			    (1ULL << STX_BUS_INO);
+		else
+			ino_bitmap = 1ULL << STX_PCIERR_B_INO;
+	}
 	for (i = 0; i <= STX_MAX_INO; i++) {
 		if ((ino_bitmap & (1ULL << i)) == 0)
 			continue;
@@ -684,6 +697,14 @@ schizo_attach(device_t dev)
 
 	ofw_bus_setup_iinfo(node, &sc->sc_pci_iinfo, sizeof(ofw_pci_intr_t));
 
+	/*
+	 * At least when booting Fire V890 from disk a Schizo comes up with
+	 * a PCI bus error residing which triggers as soon as we register
+	 * schizo_pci_bus() even when clearing it from all involved registers
+	 * beforehand (but is quiet once it has fired).  Thus we make PCI bus
+	 * errors non-fatal until we actually touch the bus.
+	 */
+	sc->sc_flags |= SCHIZO_FLAGS_ARMED;
 	device_add_child(dev, "pci", -1);
 	return (bus_generic_attach(dev));
 }
@@ -787,6 +808,8 @@ schizo_pci_bus(void *arg)
 	iommu = SCHIZO_PCI_READ_8(sc, STX_PCI_IOMMU);
 	status = PCIB_READ_CONFIG(sc->sc_dev, sc->sc_pci_secbus,
 	    STX_CS_DEVICE, STX_CS_FUNC, PCIR_STATUS, 2);
+	if ((sc->sc_flags & SCHIZO_FLAGS_ARMED) == 0)
+			goto clear_error;
 	if ((csr & STX_PCI_CTRL_MMU_ERR) != 0) {
 		if ((iommu & TOM_PCI_IOMMU_ERR) == 0)
 			goto clear_error;

Modified: head/sys/sparc64/pci/schizovar.h
==============================================================================
--- head/sys/sparc64/pci/schizovar.h	Wed Mar 17 20:00:22 2010	(r205253)
+++ head/sys/sparc64/pci/schizovar.h	Wed Mar 17 20:01:01 2010	(r205254)
@@ -44,8 +44,9 @@ struct schizo_softc {
 #define	SCHIZO_MODE_XMS			2
 
 	u_int				sc_flags;
-#define	SCHIZO_FLAGS_BSWAR		(1 << 0)
-#define	SCHIZO_FLAGS_CDMA		(1 << 1)
+#define	SCHIZO_FLAGS_ARMED		(1 << 0)
+#define	SCHIZO_FLAGS_BSWAR		(1 << 1)
+#define	SCHIZO_FLAGS_CDMA		(1 << 2)
 
 	bus_addr_t			sc_cdma_clr;
 	uint32_t			sc_cdma_state;



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