Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 1 Sep 2002 18:04:22 -0700 (PDT)
From:      Jonathan Mini <mini@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 16932 for review
Message-ID:  <200209020104.g8214M8Q079562@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://people.freebsd.org/~peter/p4db/chv.cgi?CH=16932

Change 16932 by mini@freefall on 2002/09/01 18:03:37

	Followup to change 16929 ("IFC @16924"): remove changes that
	should never have crept into this branch.

Affected files ...

.. //depot/projects/kse/lib/libc/alpha/gen/makecontext.c#3 edit
.. //depot/projects/kse/lib/libc/gen/swapcontext.c#5 edit
.. //depot/projects/kse/sys/contrib/dev/acpica/utdebug.c#11 edit
.. //depot/projects/kse/sys/contrib/ipfilter/netinet/fil.c#8 edit
.. //depot/projects/kse/sys/dev/sound/pci/solo.c#5 edit

Differences ...

==== //depot/projects/kse/lib/libc/alpha/gen/makecontext.c#3 (text+ko) ====

@@ -29,11 +29,11 @@
 
 #include <sys/param.h>
 #include <sys/signal.h>
-#include <sys/ucontext.h>
 
 #include <errno.h>
 #include <stdarg.h>
 #include <unistd.h>
+#include <ucontext.h>
 
 
 /* Prototypes */

==== //depot/projects/kse/lib/libc/gen/swapcontext.c#5 (text+ko) ====

@@ -27,11 +27,12 @@
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD: src/lib/libc/gen/swapcontext.c,v 1.2 2002/01/11 19:46:08 deischen Exp $");
 
+#include <sys/param.h>
+#include <sys/signal.h>
+#include <sys/ucontext.h>
 
 #include <errno.h>
-#include <signal.h>
 #include <stddef.h>
-#include <sys/ucontext.h>
 
 __weak_reference(__swapcontext, swapcontext);
 

==== //depot/projects/kse/sys/contrib/dev/acpica/utdebug.c#11 (text+ko) ====

@@ -600,57 +600,115 @@
 
     /* Only dump the buffer if tracing is enabled */
 
-rom or relating to the Covered Code
- * without prior written authorization from Intel.
- *
- * 4. Disclaimer and Export Compliance
- *
- * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
- * HERE.  ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
- * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT,  ASSISTANCE,
- * INSTALLATION, TRAINING OR OTHER SERVICES.  INTEL WILL NOT PROVIDE ANY
- * UPDATES, ENHANCEMENTS OR EXTENSIONS.  INTEL SPECIFICALLY DISCLAIMS ANY
- * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
- * PARTICULAR PURPOSE.
- *
- * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
- * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
- * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
- * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
- * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
- * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.  THESE LIMITATIONS
- * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
- * LIMITED REMEDY.
- *
- * 4.3. Licensee shall not export, either directly or indirectly, any of this
- * software or system incorporating such software without first obtaining any
- * required license or other approval from the U. S. Department of Commerce or
- * any other agency or department of the United States Government.  In the
- * event Licensee exports any such software from the United States or
- * re-exports any such software from a foreign destination, Licensee shall
- * ensure that the distribution and export/re-export of the software is in
- * compliance with all laws, regulations, orders, or other restrictions of the
- * U.S. Export Administration Regulations. Licensee agrees that neither it nor
- * any of its subsidiaries will export/re-export any technical data, process,
- * software, or service, directly or indirectly, to any country for which the
- * United States government or any agency thereof requires an export license,
- * other governmental approval, or letter of assurance, without first obtaining
- * such license, approval or letter.
- *
- *****************************************************************************/
+    if (!((ACPI_LV_TABLES & AcpiDbgLevel) &&
+        (ComponentId & AcpiDbgLayer)))
+    {
+        return;
+    }
+
+    if ((Count < 4) || (Count & 0x01))
+    {
+        Display = DB_BYTE_DISPLAY;
+    }
+
+    AcpiOsPrintf ("\nOffset   Value\n");
+
+    /*
+     * Nasty little dump buffer routine!
+     */
+    while (i < Count)
+    {
+        /* Print current offset */
+
+        AcpiOsPrintf ("%05X    ", i);
+
+        /* Print 16 hex chars */
+
+        for (j = 0; j < 16;)
+        {
+            if (i + j >= Count)
+            {
+                AcpiOsPrintf ("\n");
+                return;
+            }
+
+            /* Make sure that the INT8 doesn't get sign-extended! */
+
+            switch (Display)
+            {
+            /* Default is BYTE display */
+
+            default:
+
+                AcpiOsPrintf ("%02X ",
+                        *((UINT8 *) &Buffer[i + j]));
+                j += 1;
+                break;
+
+
+            case DB_WORD_DISPLAY:
+
+                ACPI_MOVE_UNALIGNED16_TO_32 (&Temp32,
+                                             &Buffer[i + j]);
+                AcpiOsPrintf ("%04X ", Temp32);
+                j += 2;
+                break;
+
+
+            case DB_DWORD_DISPLAY:
+
+                ACPI_MOVE_UNALIGNED32_TO_32 (&Temp32,
+                                             &Buffer[i + j]);
+                AcpiOsPrintf ("%08X ", Temp32);
+                j += 4;
+                break;
+
+
+            case DB_QWORD_DISPLAY:
+
+                ACPI_MOVE_UNALIGNED32_TO_32 (&Temp32,
+                                             &Buffer[i + j]);
+                AcpiOsPrintf ("%08X", Temp32);
+
+                ACPI_MOVE_UNALIGNED32_TO_32 (&Temp32,
+                                             &Buffer[i + j + 4]);
+                AcpiOsPrintf ("%08X ", Temp32);
+                j += 8;
+                break;
+            }
+        }
 
-#define __TBUTILS_C__
+        /*
+         * Print the ASCII equivalent characters
+         * But watch out for the bad unprintable ones...
+         */
+        for (j = 0; j < 16; j++)
+        {
+            if (i + j >= Count)
+            {
+                AcpiOsPrintf ("\n");
+                return;
+            }
 
-#include "acpi.h"
-#include "actables.h"
+            BufChar = Buffer[i + j];
+            if ((BufChar > 0x1F && BufChar < 0x2E) ||
+                (BufChar > 0x2F && BufChar < 0x61) ||
+                (BufChar > 0x60 && BufChar < 0x7F))
+            {
+                AcpiOsPrintf ("%c", BufChar);
+            }
+            else
+            {
+                AcpiOsPrintf (".");
+            }
+        }
 
+        /* Done with that line. */
 
-#define _COMPONENT          ACPI_TABLES
-        ACPI_MODULE_NAME    ("tbutils")
+        AcpiOsPrintf ("\n");
+        i += 16;
+    }
 
+    return;
+}
 
-/*******************************************************************************
- *
- * FUNCTION:    AcpiTbHandleToObject
- *
- * PARAMETERS:  TableId             - Id for whi
==== //depot/projects/kse/sys/contrib/ipfilter/netinet/fil.c#8 (text+ko) ====

@@ -544,218 +544,170 @@
 		if (fin->fin_fl & FI_SHORT)
 			return !(ft->ftu_tcpf | ft->ftu_tcpfm);
 		/*
-		 * Match the flags ?  If not, abort thisle (ACPI_IS_SPACE (*String) || *String == '\t')
-    {
-        ++String;
-    }
-
-    /*
-     * If the input parameter Base is zero, then we need to
-     * determine if it is octal, decimal, or hexadecimal:
-     */
-    if (Base == 0)
-    {
-        if (*String == '0')
-        {
-            if (ACPI_TOLOWER (*(++String)) == 'x')
-            {
-                Base = 16;
-                ++String;
-            }
-            else
-            {
-                Base = 8;
-            }
-        }
-        else
-        {
-            Base = 10;
-        }
-    }
-
-    /*
-     * For octal and hexadecimal bases, skip over the leading
-     * 0 or 0x, if they are present.
-     */
-    if (Base == 8 && *String == '0')
-    {
-        String++;
-    }
-
-    if (Base == 16 &&
-        *String == '0' &&
-        ACPI_TOLOWER (*(++String)) == 'x')
-    {
-        String++;
-    }
-
-    /* Main loop: convert the string to an unsigned long */
-
-    while (*String)
-    {
-        if (ACPI_IS_DIGIT (*String))
-        {
-            Index = ((UINT8) *String) - '0';
-        }
-        else
-        {
-            Index = (UINT8) ACPI_TOUPPER (*String);
-            if (ACPI_IS_UPPER ((char) Index))
-            {
-                Index = Index - 'A' + 10;
-            }
-            else
-            {
-                goto ErrorExit;
-            }
-        }
-
-        if (Index >= Base)
-        {
-            goto ErrorExit;
-        }
-
-        /* Check to see if value is out of range: */
-
-        Dividend = ACPI_INTEGER_MAX - (ACPI_INTEGER) Index;
-        (void) AcpiUtShortDivide (&Dividend, Base, &Quotient, NULL);
-        if (ReturnValue > Quotient)
-        {
-            goto ErrorExit;
-        }
-
-        ReturnValue *= Base;
-        ReturnValue += Index;
-        ++String;
-    }
-
-    *RetInteger = ReturnValue;
-    return (Status);
-
-
-ErrorExit:
-    switch (Base)
-    {
-    case 8:
-        Status = AE_BAD_OCTAL_CONSTANT;
-        break;
-
-    case 10:
-        Status = AE_BAD_DECIMAL_CONSTANT;
-        break;
-
-    case 16:
-        Status = AE_BAD_HEX_CONSTANT;
-        break;
-
-    default:
-        /* Base validated above */
-        break;
-    }
-
-    return (Status);
+		 * Match the flags ?  If not, abort this match.
+		 */
+		if (ft->ftu_tcpfm &&
+		    ft->ftu_tcpf != (fin->fin_tcpf & ft->ftu_tcpfm)) {
+			FR_DEBUG(("f. %#x & %#x != %#x\n", fin->fin_tcpf,
+				 ft->ftu_tcpfm, ft->ftu_tcpf));
+			err = 0;
+		}
+	}
+	return err;
 }
 
-
-/*******************************************************************************
- *
- * FUNCTION:    AcpiUtStrupr
- *
- * PARAMETERS:  SrcString       - The source string to convert to
- *
- * RETURN:      SrcString
- *
- * DESCRIPTION: Convert string to uppercase
- *
- ******************************************************************************/
-
-NATIVE_CHAR *
-AcpiUtStrupr (
-    NATIVE_CHAR             *SrcString)
+/*
+ * Check the input/output list of rules for a match and result.
+ * Could be per interface, but this gets real nasty when you don't have
+ * kernel sauce.
+ */
+int fr_scanlist(passin, ip, fin, m)
+u_32_t passin;
+ip_t *ip;
+register fr_info_t *fin;
+void *m;
 {
-    NATIVE_CHAR             *String;
+	register struct frentry *fr;
+	register fr_ip_t *fi = &fin->fin_fi;
+	int rulen, portcmp = 0, off, skip = 0, logged = 0;
+	u_32_t pass, passt, passl;
+	frentry_t *frl;
 
+	frl = NULL;
+	pass = passin;
+	fr = fin->fin_fr;
+	fin->fin_fr = NULL;
+	off = fin->fin_off;
 
-    ACPI_FUNCTION_ENTRY ();
+	if ((fi->fi_fl & FI_TCPUDP) && (fin->fin_dlen > 3) && !off)
+		portcmp = 1;
 
+	for (rulen = 0; fr; fr = fr->fr_next, rulen++) {
+		if (skip) {
+			FR_VERBOSE(("%d (%#x)\n", skip, fr->fr_flags));
+			skip--;
+			continue;
+		}
+		/*
+		 * In all checks below, a null (zero) value in the
+		 * filter struture is taken to mean a wildcard.
+		 *
+		 * check that we are working for the right interface
+		 */
+#ifdef	_KERNEL
+# if	(BSD >= 199306)
+		if (fin->fin_out != 0) {
+			if ((fr->fr_oifa &&
+			     (fr->fr_oifa != ((mb_t *)m)->m_pkthdr.rcvif)))
+				continue;
+		}
+# endif
+#else
+		if (opts & (OPT_VERBOSE|OPT_DEBUG))
+			printf("\n");
+#endif
 
-    /* Walk entire string, uppercasing the letters */
+		FR_VERBOSE(("%c", fr->fr_skip ? 's' :
+				  (pass & FR_PASS) ? 'p' : 
+				  (pass & FR_AUTH) ? 'a' :
+				  (pass & FR_ACCOUNT) ? 'A' :
+				  (pass & FR_NOMATCH) ? 'n' : 'b'));
 
-    for (String = SrcString; *String; )
-    {
-        *String = (char) ACPI_TOUPPER (*String);
-        String++;
-    }
+		if (fr->fr_ifa && fr->fr_ifa != fin->fin_ifp)
+			continue;
 
+		FR_VERBOSE((":i"));
+		{
+			register u_32_t	*ld, *lm, *lip;
+			register int i;
 
-    return (SrcString);
-}
+			lip = (u_32_t *)fi;
+			lm = (u_32_t *)&fr->fr_mip;
+			ld = (u_32_t *)&fr->fr_ip;
+			i = ((*lip & *lm) != *ld);
+			FR_DEBUG(("0. %#08x & %#08x != %#08x\n",
+				   *lip, *lm, *ld));
+			if (i)
+				continue;
+			/*
+			 * We now know whether the packet version and the
+			 * rule version match, along with protocol, ttl and
+			 * tos.
+			 */
+			lip++, lm++, ld++;
+			/*
+			 * Unrolled loops (4 each, for 32 bits).
+			 */
+			FR_DEBUG(("1a. %#08x & %#08x != %#08x\n",
+				   *lip, *lm, *ld));
+			i |= ((*lip++ & *lm++) != *ld++) << 5;
+			if (fi->fi_v == 6) {
+				FR_DEBUG(("1b. %#08x & %#08x != %#08x\n",
+					   *lip, *lm, *ld));
+				i |= ((*lip++ & *lm++) != *ld++) << 5;
+				FR_DEBUG(("1c. %#08x & %#08x != %#08x\n",
+					   *lip, *lm, *ld));
+				i |= ((*lip++ & *lm++) != *ld++) << 5;
+				FR_DEBUG(("1d. %#08x & %#08x != %#08x\n",
+					   *lip, *lm, *ld));
+				i |= ((*lip++ & *lm++) != *ld++) << 5;
+			} else {
+				lip += 3;
+				lm += 3;
+				ld += 3;
+			}
+			i ^= (fr->fr_flags & FR_NOTSRCIP);
+			if (i)
+				continue;
+			FR_DEBUG(("2a. %#08x & %#08x != %#08x\n",
+				   *lip, *lm, *ld));
+			i |= ((*lip++ & *lm++) != *ld++) << 6;
+			if (fi->fi_v == 6) {
+				FR_DEBUG(("2b. %#08x & %#08x != %#08x\n",
+					   *lip, *lm, *ld));
+				i |= ((*lip++ & *lm++) != *ld++) << 6;
+				FR_DEBUG(("2c. %#08x & %#08x != %#08x\n",
+					   *lip, *lm, *ld));
+				i |= ((*lip++ & *lm++) != *ld++) << 6;
+				FR_DEBUG(("2d. %#08x & %#08x != %#08x\n",
+					   *lip, *lm, *ld));
+				i |= ((*lip++ & *lm++) != *ld++) << 6;
+			} else {
+				lip += 3;
+				lm += 3;
+				ld += 3;
+			}
+			i ^= (fr->fr_flags & FR_NOTDSTIP);
+			if (i)
+				continue;
+			FR_DEBUG(("3. %#08x & %#08x != %#08x\n",
+				   *lip, *lm, *ld));
+			i |= ((*lip++ & *lm++) != *ld++);
+			FR_DEBUG(("4. %#08x & %#08x != %#08x\n",
+				   *lip, *lm, *ld));
+			i |= ((*lip & *lm) != *ld);
+			if (i)
+				continue;
+		}
 
-/*******************************************************************************
- *
- * FUNCTION:    AcpiUtMutexInitialize
- *
- * PARAMETERS:  None.
- *
- * RETURN:      Status
- *
- * DESCRIPTION: Create the system mutex objects.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiUtMutexInitialize (
-    void)
-{
-    UINT32                  i;
-    ACPI_STATUS             Status;
-
-
-    ACPI_FUNCTION_TRACE ("UtMutexInitialize");
-
-
-    /*
-     * Create each of the predefined mutex objects
-     */
-    for (i = 0; i < NUM_MTX; i++)
-    {
-        Status = AcpiUtCreateMutex (i);
-        if (ACPI_FAILURE (Status))
-        {
-            return_ACPI_STATUS (Status);
-        }
-    }
-
-    return_ACPI_STATUS (AE_OK);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION:    AcpiUtMutexTerminate
- *
- * PARAMETERS:  None.
- *
- * RETURN:      None.
- *
- * DESCRIPTION: Delete all of the system mutex objects.
- *
- ******************************************************************************/
-
-void
-AcpiUtMutexTerminate (
-    void)
-{
-    UINT32                  i;
-
-
-    ACPI_FUNCTION_TRACE ("UtMutexTerminate");
-
-
-    /*
-     * Delete each predefined mutex object
-     */
-    for (i = 0
+		/*
+		 * If a fragment, then only the first has what we're looking
+		 * for here...
+		 */
+		if (!portcmp && (fr->fr_dcmp || fr->fr_scmp || fr->fr_tcpf ||
+				 fr->fr_tcpfm))
+			continue;
+		if (fi->fi_fl & FI_TCPUDP) {
+			if (!fr_tcpudpchk(&fr->fr_tuc, fin))
+				continue;
+		} else if (fr->fr_icmpm || fr->fr_icmp) {
+			if ((fi->fi_p != IPPROTO_ICMP) || off ||
+			    (fin->fin_dlen < 2))
+				continue;
+			if ((fin->fin_data[0] & fr->fr_icmpm) != fr->fr_icmp) {
+				FR_DEBUG(("i. %#x & %#x != %#x\n",
+					 fin->fin_data[0], fr->fr_icmpm,
+					 fr->fr_icmp));
 				continue;
 			}
 		}

==== //depot/projects/kse/sys/dev/sound/pci/solo.c#5 (text+ko) ====

@@ -121,172 +121,210 @@
  * Common code for the midi and pcm functions
  *
  * ess_cmd write a single byte to the CMD port.
- * ess_cmd1 write a CMD + 1 b PCMTRIG_STOP);
-		}
-	}
-	DELAY(10 * 1000); /* give things a chance to stop */
+ * ess_cmd1 write a CMD + 1 byte arg
+ * ess_cmd2 write a CMD + 2 byte arg
+ * ess_get_byte returns a single byte from the DSP data port
+ *
+ * ess_write is actually ess_cmd1
+ * ess_read access ext. regs via ess_cmd(0xc0, reg) followed by ess_get_byte
+ */
 
-	/* Disable interrupts */
-	m3_wr_2(sc, HOST_INT_CTRL, 0);
-	m3_wr_1(sc, ASSP_CONTROL_C, 0);
+static int
+port_rd(struct resource *port, int regno, int size)
+{
+	bus_space_tag_t st = rman_get_bustag(port);
+	bus_space_handle_t sh = rman_get_bushandle(port);
 
-	m3_assp_halt(sc);
+	switch (size) {
+	case 1:
+		return bus_space_read_1(st, sh, regno);
+	case 2:
+		return bus_space_read_2(st, sh, regno);
+	case 4:
+		return bus_space_read_4(st, sh, regno);
+	default:
+		return 0xffffffff;
+	}
+}
 
-	/* Save the state of the ASSP */
-	for (i = REV_B_CODE_MEMORY_BEGIN; i <= REV_B_CODE_MEMORY_END; i++)
-		sc->savemem[index++] = m3_rd_assp_code(sc, i);
-	for (i = REV_B_DATA_MEMORY_BEGIN; i <= REV_B_DATA_MEMORY_END; i++)
-		sc->savemem[index++] = m3_rd_assp_data(sc, i);
+static void
+port_wr(struct resource *port, int regno, u_int32_t data, int size)
+{
+	bus_space_tag_t st = rman_get_bustag(port);
+	bus_space_handle_t sh = rman_get_bushandle(port);
 
-	/* Power down the card to D3 state */
-	m3_power(sc, 3);
-
-	return 0;
+	switch (size) {
+	case 1:
+		bus_space_write_1(st, sh, regno, data);
+		break;
+	case 2:
+		bus_space_write_2(st, sh, regno, data);
+		break;
+	case 4:
+		bus_space_write_4(st, sh, regno, data);
+		break;
+	}
 }
 
 static int
-m3_pci_resume(device_t dev)
+ess_rd(struct ess_info *sc, int reg)
 {
-	struct sc_info *sc = pcm_getdevinfo(dev);
-	int i, index = 0;
-	u_int8_t reset_state;
+	return port_rd(sc->sb, reg, 1);
+}
 
-	M3_DEBUG(CHANGE, ("m3_pci_resume\n"));
+static void
+ess_wr(struct ess_info *sc, int reg, u_int8_t val)
+{
+	port_wr(sc->sb, reg, val, 1);
+}
 
-	/* Power the card back to D0 */
-	m3_power(sc, 0);
+static int
+ess_dspready(struct ess_info *sc)
+{
+	return ((ess_rd(sc, SBDSP_STATUS) & 0x80) == 0);
+}
 
-	m3_config(sc);
+static int
+ess_dspwr(struct ess_info *sc, u_char val)
+{
+    	int  i;
 
-	reset_state = m3_assp_halt(sc);
+    	for (i = 0; i < 1000; i++) {
+		if (ess_dspready(sc)) {
+	    		ess_wr(sc, SBDSP_CMD, val);
+	    		return 1;
+		}
+		if (i > 10) DELAY((i > 100)? 1000 : 10);
+    	}
+    	printf("ess_dspwr(0x%02x) timed out.\n", val);
+    	return 0;
+}
 
-	m3_codec_reset(sc);
+static int
+ess_cmd(struct ess_info *sc, u_char val)
+{
+	DEB(printf("ess_cmd: %x\n", val));
+    	return ess_dspwr(sc, val);
+}
 
-	/* Restore the ASSP state */
-	for (i = REV_B_CODE_MEMORY_BEGIN; i <= REV_B_CODE_MEMORY_END; i++)
-		m3_wr_assp_code(sc, i, sc->savemem[++index]);
-	for (i = REV_B_DATA_MEMORY_BEGIN; i <= REV_B_DATA_MEMORY_END; i++)
-		m3_wr_assp_data(sc, i, sc->savemem[++index]);
+static int
+ess_cmd1(struct ess_info *sc, u_char cmd, int val)
+{
+    	DEB(printf("ess_cmd1: %x, %x\n", cmd, val));
+    	if (ess_dspwr(sc, cmd)) {
+		return ess_dspwr(sc, val & 0xff);
+    	} else return 0;
+}
 
-	/* Restart the DMA engine */
-	m3_wr_assp_data(sc, KDATA_DMA_ACTIVE, 0);
+static void
+ess_setmixer(struct ess_info *sc, u_int port, u_int value)
+{
+    	u_long   flags;
 
-	/* [m3_assp_continue] */
-	m3_wr_1(sc, DSP_PORT_CONTROL_REG_B, reset_state | REGB_ENABLE_RESET);
+	DEB(printf("ess_setmixer: reg=%x, val=%x\n", port, value);)
+    	flags = spltty();
+    	ess_wr(sc, SB_MIX_ADDR, (u_char) (port & 0xff)); /* Select register */
+    	DELAY(10);
+    	ess_wr(sc, SB_MIX_DATA, (u_char) (value & 0xff));
+    	DELAY(10);
+    	splx(flags);
+}
 
-	m3_amp_enable(sc);
+static int
+ess_getmixer(struct ess_info *sc, u_int port)
+{
+    	int val;
+    	u_long flags;
 
-	m3_enable_ints(sc);
+    	flags = spltty();
+    	ess_wr(sc, SB_MIX_ADDR, (u_char) (port & 0xff)); /* Select register */
+    	DELAY(10);
+    	val = ess_rd(sc, SB_MIX_DATA);
+    	DELAY(10);
+    	splx(flags);
 
-	if (mixer_reinit(dev) == -1) {
-		device_printf(dev, "unable to reinitialize the mixer\n");
-		return ENXIO;
-	}
+    	return val;
+}
 
-	/* Turn the channels back on */
-	for (i=0 ; i<sc->pch_cnt ; i++) {
-		if (sc->pch[i].active) {
-			m3_pchan_trigger(NULL, &sc->pch[i], PCMTRIG_START);
-		}
-	}
-	for (i=0 ; i<sc->rch_cnt ; i++) {
-		if (sc->rch[i].active) {
-			m3_rchan_trigger(NULL, &sc->rch[i], PCMTRIG_START);
-		}
-	}
+static int
+ess_get_byte(struct ess_info *sc)
+{
+    	int i;
 
-	return 0;
+    	for (i = 1000; i > 0; i--) {
+		if (ess_rd(sc, 0xc) & 0x40)
+			return ess_rd(sc, DSP_READ);
+		else
+			DELAY(20);
+    	}
+    	return -1;
 }
 
 static int
-m3_pci_shutdown(device_t dev)
+ess_write(struct ess_info *sc, u_char reg, int val)
 {
-	struct sc_info *sc = pcm_getdevinfo(dev);
+    	return ess_cmd1(sc, reg, val);
+}
 
-	M3_DEBUG(CALL, ("m3_pci_shutdown\n"));
-
-	m3_power(sc, 3); /* power off */
-	return 0;
+static int
+ess_read(struct ess_info *sc, u_char reg)
+{
+    	return (ess_cmd(sc, 0xc0) && ess_cmd(sc, reg))? ess_get_byte(sc) : -1;
 }
 
-static u_int8_t
-m3_assp_halt(struct sc_info *sc)
+static int
+ess_reset_dsp(struct ess_info *sc)
 {
-	u_int8_t data, reset_state;
-
-	data = m3_rd_1(sc, DSP_PORT_CONTROL_REG_B);
-	reset_state = data & ~REGB_STOP_CLOCK; /* remember for continue */
-        DELAY(10 * 1000);
-	m3_wr_1(sc, DSP_PORT_CONTROL_REG_B, reset_state & ~REGB_ENABLE_RESET);
-        DELAY(10 * 1000); /* necessary? */
-
-	return reset_state;
+	DEB(printf("ess_reset_dsp\n"));
+    	ess_wr(sc, SBDSP_RST, 3);
+    	DELAY(100);
+    	ess_wr(sc, SBDSP_RST, 0);
+    	if (ess_get_byte(sc) != 0xAA) {
+        	DEB(printf("ess_reset_dsp failed\n"));
+/*
+			   rman_get_start(d->io_base)));
+*/
+		return ENXIO;	/* Sorry */
+    	}
+    	ess_cmd(sc, 0xc6);
+    	return 0;
 }
 
 static void
-m3_config(struct sc_info *sc)
+ess_intr(void *arg)
 {
-	u_int32_t data, hv_cfg;
-	int hint;
+    	struct ess_info *sc = (struct ess_info *)arg;
+	int src, pirq = 0, rirq = 0;
 
-	/*
-	 * The volume buttons can be wired up via two different sets of pins.
-	 * This presents a problem since we can't tell which way it's
-	 * configured.  Allow the user to set a hint in order to twiddle
-	 * the proper bits.
-	 */
-	if (resource_int_value(device_get_name(sc->dev),
-	                       device_get_unit(sc->dev),
-			       "hwvol_config", &hint) == 0)
-		hv_cfg = (hint > 0) ? HV_BUTTON_FROM_GD : 0;
-	else
-		hv_cfg = HV_BUTTON_FROM_GD;
+	src = 0;
+	if (ess_getmixer(sc, 0x7a) & 0x80)
+		src |= 2;
+	if (ess_rd(sc, 0x0c) & 0x01)
+		src |= 1;
 
-	data = pci_read_config(sc->dev, PCI_ALLEGRO_CONFIG, 4);
-	data &= ~HV_BUTTON_FROM_GD;
-	data |= REDUCED_DEBOUNCE | HV_CTRL_ENABLE | hv_cfg;
-	data |= PM_CTRL_ENABLE | CLK_DIV_BY_49 | USE_PCI_TIMING;
-	pci_write_config(sc->dev, PCI_ALLEGRO_CONFIG, data, 4);
+	if (src == 0)
+		return;
 
-	m3_wr_1(sc, ASSP_CONTROL_B, RESET_ASSP);
-	data = pci_read_config(sc->dev, PCI_ALLEGRO_CONFIG, 4);
-	data &= ~INT_CLK_SELECT;
-	if (sc->which == ESS_MAESTRO3) {
-		data &= ~INT_CLK_MULT_ENABLE;
-		data |= INT_CLK_SRC_NOT_PCI;
+	if (sc->duplex) {
+		pirq = (src & sc->pch.hwch)? 1 : 0;
+		rirq = (src & sc->rch.hwch)? 1 : 0;
+	} else {
+		if (sc->simplex_dir == PCMDIR_PLAY)
+			pirq = 1;
+		if (sc->simplex_dir == PCMDIR_REC)
+			rirq = 1;
+		if (!pirq && !rirq)
+			printf("solo: IRQ neither playback nor rec!\n");
 	}
-	data &= ~(CLK_MULT_MODE_SELECT | CLK_MULT_MODE_SELECT_2);
-	pci_write_config(sc->dev, PCI_ALLEGRO_CONFIG, data, 4);
 
-	if (sc->which == ESS_ALLEGRO_1) {
-		data = pci_read_config(sc->dev, PCI_USER_CONFIG, 4);
-		data |= IN_CLK_12MHZ_SELECT;
-		pci_write_config(sc->dev, PCI_USER_CONFIG, data, 4);
-	}
+	DEB(printf("ess_intr: pirq:%d rirq:%d\n",pirq,rirq));
 
-	data = m3_rd_1(sc, ASSP_CONTROL_A);
-	data &= ~(DSP_CLK_36MHZ_SELECT | ASSP_CLK_49MHZ_SELECT);
-	data |= ASSP_CLK_49MHZ_SELECT; /*XXX assumes 49MHZ dsp XXX*/
-	data |= ASSP_0_WS_ENABLE;
-	m3_wr_1(sc, ASSP_CONTROL_A, data);
-
-	m3_wr_1(sc, ASSP_CONTROL_B, RUN_ASSP);
-}
-
-static void
-m3_enable_ints(struct sc_info *sc)
-{
-	u_int8_t data;
-
-	m3_wr_2(sc, HOST_INT_CTRL, ASSP_INT_ENABLE | HV_INT_ENABLE);
-	data = m3_rd_1(sc, ASSP_CONTROL_C);
-	m3_wr_1(sc, ASSP_CONTROL_C, data | ASSP_HOST_INT_ENABLE);
-}
-
-static void
-m3_amp_enable(struct sc_info *sc)
-{
-0xb8, ess_read(sc, 0xb8) & ~0x01);
+	if (pirq) {
+		if (sc->pch.stopping) {
+			ess_dmatrigger(sc, sc->pch.hwch, 0);
+			sc->pch.stopping = 0;
+			if (sc->pch.hwch == 1)
+				ess_write(sc, 0xb8, ess_read(sc, 0xb8) & ~0x01);
 			else
 				ess_setmixer(sc, 0x78, ess_getmixer(sc, 0x78) & ~0x03);
 		}

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe p4-projects" in the body of the message




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