Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 30 Apr 2010 13:43:20 +0000 (UTC)
From:      Nathan Whitehorn <nwhitehorn@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-projects@freebsd.org
Subject:   svn commit: r207434 - projects/ppc64/sys/powerpc/powermac
Message-ID:  <201004301343.o3UDhKFT081897@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: nwhitehorn
Date: Fri Apr 30 13:43:20 2010
New Revision: 207434
URL: http://svn.freebsd.org/changeset/base/207434

Log:
  Fix SATA on PowerMac 11,2 by disabling interrupt configuration in the
  remote IO-APIC so it does get set to edge triggered, which was a hack
  to deal with the (similar) way the K2 OpenPIC was connected to HT
  interrupts in earlier pure HT1000 systems. USB is still borked.

Modified:
  projects/ppc64/sys/powerpc/powermac/cpcht.c

Modified: projects/ppc64/sys/powerpc/powermac/cpcht.c
==============================================================================
--- projects/ppc64/sys/powerpc/powermac/cpcht.c	Fri Apr 30 08:57:03 2010	(r207433)
+++ projects/ppc64/sys/powerpc/powermac/cpcht.c	Fri Apr 30 13:43:20 2010	(r207434)
@@ -131,6 +131,7 @@ struct cpcht_irq {
 	vm_offset_t	ht_base;
 	vm_offset_t	apple_eoi;
 	uint32_t	eoi_data;
+	int		edge;
 };
 
 static struct cpcht_irq *cpcht_irqmap = NULL;
@@ -437,6 +438,10 @@ cpcht_alloc_resource(device_t bus, devic
 	err = 0;
 
 	switch (type) {
+	case SYS_RES_IOPORT:
+		end = min(end, start + count);
+
+		/* FALLTHROUGH */
 	case SYS_RES_MEMORY:
 		rm = &sc->sc_mem_rman;
 		err = rman_manage_region(&sc->sc_mem_rman, start, end);
@@ -620,6 +625,7 @@ static void
 openpic_cpcht_config(device_t dev, u_int irq, enum intr_trigger trig,
     enum intr_polarity pol)
 {
+#ifdef NOTYET
 	uint32_t ht_irq;
 
 	/*
@@ -629,7 +635,8 @@ openpic_cpcht_config(device_t dev, u_int
 	 * link.
 	 */
 
-	if (cpcht_irqmap != NULL && irq < 128 && cpcht_irqmap[irq].ht_base > 0) {
+	if (cpcht_irqmap != NULL && irq < 128 &&
+	    cpcht_irqmap[irq].ht_base > 0) {
 		/* Program the data port */
 		out8rb(cpcht_irqmap[irq].ht_base + PCIR_HT_COMMAND,
 		    0x10 + (cpcht_irqmap[irq].ht_source << 1));
@@ -637,11 +644,14 @@ openpic_cpcht_config(device_t dev, u_int
 		/* Grab the IRQ config register */
 		ht_irq = in32rb(cpcht_irqmap[irq].ht_base + 4) & ~23;
 		
-		if (trig != INTR_TRIGGER_EDGE)
-			ht_irq |= 0x02;
+		if (trig == INTR_TRIGGER_EDGE)
+			cpcht_irqmap[irq].edge = 1;
+		else
+			ht_irq |= 0x22;
 
 		out32rb(cpcht_irqmap[irq].ht_base + 4, ht_irq);
 	}
+#endif
 		
 }
 
@@ -667,7 +677,8 @@ openpic_cpcht_eoi(device_t dev, u_int ir
 	if (irq == 255)
 		return;
 
-	if (cpcht_irqmap != NULL && irq < 128 && cpcht_irqmap[irq].ht_base > 0) {
+	if (cpcht_irqmap != NULL && irq < 128 &&
+	    cpcht_irqmap[irq].ht_base > 0 && !cpcht_irqmap[irq].edge) {
 		/* If this is an HT IRQ, acknowledge it at the remote APIC */
 
 		if (cpcht_irqmap[irq].apple_eoi) {



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