CVS commit: src/sys/arch/sgimips/mace

2018-03-23 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Fri Mar 23 09:43:33 UTC 2018

Modified Files:
src/sys/arch/sgimips/mace: if_mec.c

Log Message:
No need to print interrupt status for RX underflow as this status bit is 
handled already


To generate a diff of this commit:
cvs rdiff -u -r1.55 -r1.56 src/sys/arch/sgimips/mace/if_mec.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/sgimips/mace/if_mec.c
diff -u src/sys/arch/sgimips/mace/if_mec.c:1.55 src/sys/arch/sgimips/mace/if_mec.c:1.56
--- src/sys/arch/sgimips/mace/if_mec.c:1.55	Thu Dec 15 09:28:04 2016
+++ src/sys/arch/sgimips/mace/if_mec.c	Fri Mar 23 09:43:33 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: if_mec.c,v 1.55 2016/12/15 09:28:04 ozaki-r Exp $ */
+/* $NetBSD: if_mec.c,v 1.56 2018/03/23 09:43:33 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2004, 2008 Izumi Tsutsui.  All rights reserved.
@@ -61,7 +61,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_mec.c,v 1.55 2016/12/15 09:28:04 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_mec.c,v 1.56 2018/03/23 09:43:33 jmcneill Exp $");
 
 #include "opt_ddb.h"
 
@@ -1599,7 +1599,6 @@ mec_intr(void *arg)
 		(MEC_INT_TX_LINK_FAIL |
 		 MEC_INT_TX_MEM_ERROR |
 		 MEC_INT_TX_ABORT |
-		 MEC_INT_RX_FIFO_UNDERFLOW |
 		 MEC_INT_RX_DMA_UNDERFLOW)) {
 			printf("%s: %s: interrupt status = 0x%08x\n",
 			device_xname(sc->sc_dev), __func__, statreg);



CVS commit: src/sys/arch/sgimips/mace

2016-08-05 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Aug  5 20:21:58 UTC 2016

Modified Files:
src/sys/arch/sgimips/mace: pci_mace.c

Log Message:
simplify macepci_intr():
- use uint32_t
- always clear all error bits
- avoid a compiler bug(?) which caused the test for MACE_PERR_MASTER_ABORT
  to fail on n32
now my O2 no longer hangs when leaving cold


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/sgimips/mace/pci_mace.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/sgimips/mace/pci_mace.c
diff -u src/sys/arch/sgimips/mace/pci_mace.c:1.20 src/sys/arch/sgimips/mace/pci_mace.c:1.21
--- src/sys/arch/sgimips/mace/pci_mace.c:1.20	Fri Oct  2 05:22:52 2015
+++ src/sys/arch/sgimips/mace/pci_mace.c	Fri Aug  5 20:21:58 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: pci_mace.c,v 1.20 2015/10/02 05:22:52 msaitoh Exp $	*/
+/*	$NetBSD: pci_mace.c,v 1.21 2016/08/05 20:21:58 macallan Exp $	*/
 
 /*
  * Copyright (c) 2001,2003 Christopher Sekiya
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pci_mace.c,v 1.20 2015/10/02 05:22:52 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_mace.c,v 1.21 2016/08/05 20:21:58 macallan Exp $");
 
 #include "opt_pci.h"
 #include "pci.h"
@@ -293,11 +293,11 @@ macepci_intr(void *arg)
 {
 	struct macepci_softc *sc = (struct macepci_softc *)arg;
 	pci_chipset_tag_t pc = >sc_pc;
-	u_int32_t error, address;
+	uint32_t error, address;
 
 	error = bus_space_read_4(pc->iot, pc->ioh, MACE_PCI_ERROR_FLAGS);
 	address = bus_space_read_4(pc->iot, pc->ioh, MACE_PCI_ERROR_ADDR);
-	while (error & 0xffc0) {
+	if (error & 0xffc0) {
 		if (error & MACE_PERR_MASTER_ABORT) {
 			/*
 			 * this seems to be a more-or-less normal error
@@ -305,73 +305,47 @@ macepci_intr(void *arg)
 			 * a _lot_ of these errors, so no message for now
 			 * while I figure out if I missed a trick somewhere.
 			 */
-			error &= ~MACE_PERR_MASTER_ABORT;
-			bus_space_write_4(pc->iot, pc->ioh,
-			MACE_PCI_ERROR_FLAGS, error);
 		}
 
 		if (error & MACE_PERR_TARGET_ABORT) {
 			printf("mace: target abort at %x\n", address);
-			error &= ~MACE_PERR_TARGET_ABORT;
-			bus_space_write_4(pc->iot, pc->ioh,
-			MACE_PCI_ERROR_FLAGS, error);
 		}
 
 		if (error & MACE_PERR_DATA_PARITY_ERR) {
 			printf("mace: parity error at %x\n", address);
-			error &= ~MACE_PERR_DATA_PARITY_ERR;
-			bus_space_write_4(pc->iot, pc->ioh,
-			MACE_PCI_ERROR_FLAGS, error);
 		}
 
 		if (error & MACE_PERR_RETRY_ERR) {
 			printf("mace: retry error at %x\n", address);
-			error &= ~MACE_PERR_RETRY_ERR;
-			bus_space_write_4(pc->iot, pc->ioh,
-			MACE_PCI_ERROR_FLAGS, error);
 		}
 
 		if (error & MACE_PERR_ILLEGAL_CMD) {
 			printf("mace: illegal command at %x\n", address);
-			error &= ~MACE_PERR_ILLEGAL_CMD;
-			bus_space_write_4(pc->iot, pc->ioh,
-			MACE_PCI_ERROR_FLAGS, error);
 		}
 
 		if (error & MACE_PERR_SYSTEM_ERR) {
 			printf("mace: system error at %x\n", address);
-			error &= ~MACE_PERR_SYSTEM_ERR;
-			bus_space_write_4(pc->iot, pc->ioh,
-			MACE_PCI_ERROR_FLAGS, error);
 		}
 
 		if (error & MACE_PERR_INTERRUPT_TEST) {
 			printf("mace: interrupt test at %x\n", address);
-			error &= ~MACE_PERR_INTERRUPT_TEST;
-			bus_space_write_4(pc->iot, pc->ioh,
-			MACE_PCI_ERROR_FLAGS, error);
 		}
 
 		if (error & MACE_PERR_PARITY_ERR) {
 			printf("mace: parity error at %x\n", address);
-			error &= ~MACE_PERR_PARITY_ERR;
-			bus_space_write_4(pc->iot, pc->ioh,
-			MACE_PCI_ERROR_FLAGS, error);
 		}
 
 		if (error & MACE_PERR_RSVD) {
 			printf("mace: reserved condition at %x\n", address);
-			error &= ~MACE_PERR_RSVD;
-			bus_space_write_4(pc->iot, pc->ioh,
-			MACE_PCI_ERROR_FLAGS, error);
 		}
 
 		if (error & MACE_PERR_OVERRUN) {
 			printf("mace: overrun at %x\n", address);
-			error &= ~MACE_PERR_OVERRUN;
-			bus_space_write_4(pc->iot, pc->ioh,
-			MACE_PCI_ERROR_FLAGS, error);
 		}
+
+		/* clear all */
+		bus_space_write_4(pc->iot, pc->ioh,
+			MACE_PCI_ERROR_FLAGS, error & ~0xffc0);
 	}
 	return 0;
 }



CVS commit: src/sys/arch/sgimips/mace

2016-07-13 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Jul 13 21:33:28 UTC 2016

Modified Files:
src/sys/arch/sgimips/mace: mace.c

Log Message:
appease gcc by removing now unnecessary cast


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/sgimips/mace/mace.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/sgimips/mace/mace.c
diff -u src/sys/arch/sgimips/mace/mace.c:1.22 src/sys/arch/sgimips/mace/mace.c:1.23
--- src/sys/arch/sgimips/mace/mace.c:1.22	Tue Jun 30 03:55:23 2015
+++ src/sys/arch/sgimips/mace/mace.c	Wed Jul 13 21:33:28 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: mace.c,v 1.22 2015/06/30 03:55:23 macallan Exp $	*/
+/*	$NetBSD: mace.c,v 1.23 2016/07/13 21:33:28 macallan Exp $	*/
 
 /*
  * Copyright (c) 2003 Christopher Sekiya
@@ -45,7 +45,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mace.c,v 1.22 2015/06/30 03:55:23 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mace.c,v 1.23 2016/07/13 21:33:28 macallan Exp $");
 
 #include 
 #include 
@@ -317,7 +317,7 @@ mace_intr(int irqs)
 
 	/* irq 4 is the ISA cascade interrupt.  Must handle with care. */
 	if (irqs & (1 << 4)) {
-		isa_irq = mips3_ld((volatile uint64_t *)MIPS_PHYS_TO_KSEG1(MACE_BASE
+		isa_irq = mips3_ld(MIPS_PHYS_TO_KSEG1(MACE_BASE
 		+ MACE_ISA_INT_STATUS));
 		for (i = 0; i < MACE_NINTR; i++) {
 			if ((maceintrtab[i].irq == (1 << 4)) &&



CVS commit: src/sys/arch/sgimips/mace

2015-09-30 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Sep 30 19:44:58 UTC 2015

Modified Files:
src/sys/arch/sgimips/mace: com_mace.c

Log Message:
pass the port's hardware address in COM_INIT_REGS() so the com driver can
figure out wether this is the console or not


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/sgimips/mace/com_mace.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/sgimips/mace/com_mace.c
diff -u src/sys/arch/sgimips/mace/com_mace.c:1.10 src/sys/arch/sgimips/mace/com_mace.c:1.11
--- src/sys/arch/sgimips/mace/com_mace.c:1.10	Wed Feb 18 16:47:59 2015
+++ src/sys/arch/sgimips/mace/com_mace.c	Wed Sep 30 19:44:58 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: com_mace.c,v 1.10 2015/02/18 16:47:59 macallan Exp $	*/
+/*	$NetBSD: com_mace.c,v 1.11 2015/09/30 19:44:58 macallan Exp $	*/
 
 /*
  * Copyright (c) 2000 Soren S. Jorvang
@@ -33,7 +33,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: com_mace.c,v 1.10 2015/02/18 16:47:59 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: com_mace.c,v 1.11 2015/09/30 19:44:58 macallan Exp $");
 
 #include 
 #include 
@@ -55,6 +55,7 @@ __KERNEL_RCSID(0, "$NetBSD: com_mace.c,v
 #include 
 
 #include 
+#include 
 
 #include 
 #include 
@@ -96,7 +97,8 @@ com_mace_attach(device_t parent, device_
 	 */
 	ioh = maa->maa_sh + maa->maa_offset;
 	/* note that ioh on mac is *also* the iobase address */
-	COM_INIT_REGS(sc->sc_regs, mace_isa_memt, ioh, 0);
+	COM_INIT_REGS(sc->sc_regs, mace_isa_memt, ioh,
+	MACE_BASE + maa->maa_offset);
 
 	sc->sc_frequency = COM_FREQ;
 



CVS commit: src/sys/arch/sgimips/mace

2015-09-24 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Thu Sep 24 17:56:59 UTC 2015

Modified Files:
src/sys/arch/sgimips/mace: pci_mace.c

Log Message:
on mips64 we can use the whole PCI space, not just the two 32MB windows
accessible via KSEG*


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/sgimips/mace/pci_mace.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/sgimips/mace/pci_mace.c
diff -u src/sys/arch/sgimips/mace/pci_mace.c:1.18 src/sys/arch/sgimips/mace/pci_mace.c:1.19
--- src/sys/arch/sgimips/mace/pci_mace.c:1.18	Wed Feb 18 16:47:59 2015
+++ src/sys/arch/sgimips/mace/pci_mace.c	Thu Sep 24 17:56:59 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: pci_mace.c,v 1.18 2015/02/18 16:47:59 macallan Exp $	*/
+/*	$NetBSD: pci_mace.c,v 1.19 2015/09/24 17:56:59 macallan Exp $	*/
 
 /*
  * Copyright (c) 2001,2003 Christopher Sekiya
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pci_mace.c,v 1.18 2015/02/18 16:47:59 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_mace.c,v 1.19 2015/09/24 17:56:59 macallan Exp $");
 
 #include "opt_pci.h"
 #include "pci.h"
@@ -65,6 +65,11 @@ __KERNEL_RCSID(0, "$NetBSD: pci_mace.c,v
 
 #include 
 
+#ifndef __mips_o32
+#define USE_HIGH_PCI
+#endif
+
+
 struct macepci_softc {
 	struct sgimips_pci_chipset sc_pc;
 };
@@ -156,15 +161,23 @@ macepci_attach(device_t parent, device_t
 	bus_space_write_4(pc->iot, pc->ioh, MACEPCI_CONTROL, control);
 
 #if NPCI > 0
+#ifdef USE_HIGH_PCI
+	pc->pc_ioext = extent_create("macepciio", 0x1000, 0x01ff,
+	NULL, 0, EX_NOWAIT);
+	pc->pc_memext = extent_create("macepcimem", 0x8000, 0x,
+	NULL, 0, EX_NOWAIT);
+#else
 	pc->pc_ioext = extent_create("macepciio", 0x1000, 0x01ff,
 	NULL, 0, EX_NOWAIT);
+	/* XXX no idea why we limit ourselves to only half of the 32MB window */
 	pc->pc_memext = extent_create("macepcimem", 0x8010, 0x81ff,
 	NULL, 0, EX_NOWAIT);
+#endif /* USE_HIGH_PCI */
 	pci_configure_bus(pc, pc->pc_ioext, pc->pc_memext, NULL, 0,
 	mips_cache_info.mci_dcache_align);
 	memset(, 0, sizeof pba);
-/*XXX*/	pba.pba_iot = mace_pci_iot;
-/*XXX*/	pba.pba_memt = mace_pci_memt;
+	pba.pba_iot = mace_pci_iot;
+	pba.pba_memt = mace_pci_memt;
 	pba.pba_dmat = _bus_dma_tag;
 	pba.pba_dmat64 = NULL;
 	pba.pba_bus = 0;
@@ -209,9 +222,6 @@ macepci_conf_read(pci_chipset_tag_t pc, 
 void
 macepci_conf_write(pci_chipset_tag_t pc, pcitag_t tag, int reg, pcireg_t data)
 {
-	/* XXX O2 soren */
-	if (tag == 0)
-		return;
 
 	bus_space_write_4(pc->iot, pc->ioh, MACE_PCI_CONFIG_ADDR, (tag | reg));
 	bus_space_write_4(pc->iot, pc->ioh, MACE_PCI_CONFIG_DATA, data);
@@ -377,7 +387,7 @@ macepci_intr(void *arg)
  */
 #define	CHIP_W1_BUS_START(v)	0x8000UL
 #define CHIP_W1_BUS_END(v)	0xUL
-#ifdef _LP64
+#ifdef USE_HIGH_PCI
 #define	CHIP_W1_SYS_START(v)	MACE_PCI_HI_MEMORY
 #define	CHIP_W1_SYS_END(v)	MACE_PCI_HI_MEMORY + 0x7fffUL
 #else
@@ -402,7 +412,7 @@ macepci_intr(void *arg)
 #define	CHIP_MEM		/* defined */
 #define	CHIP_W1_BUS_START(v)	0xUL
 #define CHIP_W1_BUS_END(v)	0xUL
-#ifdef _LP64
+#ifdef USE_HIGH_PCI
 #define	CHIP_W1_SYS_START(v)	MACE_PCI_HI_IO
 #define	CHIP_W1_SYS_END(v)	MACE_PCI_HI_IO + 0xUL
 #else



CVS commit: src/sys/arch/sgimips/mace

2015-06-29 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Tue Jun 30 03:55:23 UTC 2015

Modified Files:
src/sys/arch/sgimips/mace: mace.c

Log Message:
shorten the interrupt name so the level field is actually readable in systat


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/sgimips/mace/mace.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/sgimips/mace/mace.c
diff -u src/sys/arch/sgimips/mace/mace.c:1.21 src/sys/arch/sgimips/mace/mace.c:1.22
--- src/sys/arch/sgimips/mace/mace.c:1.21	Wed Feb 18 16:47:59 2015
+++ src/sys/arch/sgimips/mace/mace.c	Tue Jun 30 03:55:23 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: mace.c,v 1.21 2015/02/18 16:47:59 macallan Exp $	*/
+/*	$NetBSD: mace.c,v 1.22 2015/06/30 03:55:23 macallan Exp $	*/
 
 /*
  * Copyright (c) 2003 Christopher Sekiya
@@ -45,7 +45,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: mace.c,v 1.21 2015/02/18 16:47:59 macallan Exp $);
+__KERNEL_RCSID(0, $NetBSD: mace.c,v 1.22 2015/06/30 03:55:23 macallan Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -261,7 +261,7 @@ mace_intr_establish(int intr, int level,
 			maceintrtab[i].intrmask = level;
 			snprintf(maceintrtab[i].evname,
 			sizeof(maceintrtab[i].evname),
-			intr %d level 0x%x, intr, level);
+			intr %d lv 0x%x, intr, level);
 			evcnt_attach_dynamic(maceintrtab[i].evcnt,
 			EVCNT_TYPE_INTR, NULL,
 			mace, maceintrtab[i].evname);



CVS commit: src/sys/arch/sgimips/mace

2015-04-13 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Apr 13 21:22:34 UTC 2015

Modified Files:
src/sys/arch/sgimips/mace: if_mec.c

Log Message:
Missed a spot: rnd.h - rndsource.h.


To generate a diff of this commit:
cvs rdiff -u -r1.50 -r1.51 src/sys/arch/sgimips/mace/if_mec.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/sgimips/mace/if_mec.c
diff -u src/sys/arch/sgimips/mace/if_mec.c:1.50 src/sys/arch/sgimips/mace/if_mec.c:1.51
--- src/sys/arch/sgimips/mace/if_mec.c:1.50	Sun Aug 10 16:44:34 2014
+++ src/sys/arch/sgimips/mace/if_mec.c	Mon Apr 13 21:22:34 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: if_mec.c,v 1.50 2014/08/10 16:44:34 tls Exp $ */
+/* $NetBSD: if_mec.c,v 1.51 2015/04/13 21:22:34 riastradh Exp $ */
 
 /*-
  * Copyright (c) 2004, 2008 Izumi Tsutsui.  All rights reserved.
@@ -61,7 +61,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_mec.c,v 1.50 2014/08/10 16:44:34 tls Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_mec.c,v 1.51 2015/04/13 21:22:34 riastradh Exp $);
 
 #include opt_ddb.h
 
@@ -76,7 +76,7 @@ __KERNEL_RCSID(0, $NetBSD: if_mec.c,v 1
 #include sys/ioctl.h
 #include sys/errno.h
 
-#include sys/rnd.h
+#include sys/rndsource.h
 
 #include net/if.h
 #include net/if_dl.h



CVS commit: src/sys/arch/sgimips/mace

2015-04-04 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Sat Apr  4 14:19:00 UTC 2015

Modified Files:
src/sys/arch/sgimips/mace: macekbc.c

Log Message:
malloc() - kmem_alloc() for private data, also kmem_free() them if we
don't finish attaching for whatever reason

found by Brainy


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/sgimips/mace/macekbc.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/sgimips/mace/macekbc.c
diff -u src/sys/arch/sgimips/mace/macekbc.c:1.7 src/sys/arch/sgimips/mace/macekbc.c:1.8
--- src/sys/arch/sgimips/mace/macekbc.c:1.7	Sat Oct 27 17:18:10 2012
+++ src/sys/arch/sgimips/mace/macekbc.c	Sat Apr  4 14:19:00 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: macekbc.c,v 1.7 2012/10/27 17:18:10 chs Exp $ */
+/* $NetBSD: macekbc.c,v 1.8 2015/04/04 14:19:00 macallan Exp $ */
 
 /*-
  * Copyright (c) 2007 Jared D. McNeill jmcne...@invisible.ca
@@ -31,12 +31,12 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: macekbc.c,v 1.7 2012/10/27 17:18:10 chs Exp $);
+__KERNEL_RCSID(0, $NetBSD: macekbc.c,v 1.8 2015/04/04 14:19:00 macallan Exp $);
 
 #include sys/param.h
 #include sys/device.h
 #include sys/syslog.h
-#include sys/malloc.h
+#include sys/kmem.h
 
 #include sys/bus.h
 #include machine/intr.h
@@ -125,7 +125,7 @@ macekbc_attach(device_t parent, device_t
 	aprint_normal(: PS2 controller\n);
 	aprint_naive(\n);
 
-	t = malloc(sizeof(struct macekbc_internal), M_DEVBUF, M_NOWAIT|M_ZERO);
+	t = kmem_alloc(sizeof(struct macekbc_internal), KM_NOSLEEP);
 	if (t == NULL) {
 		aprint_error(%s: not enough memory\n, device_xname(self));
 		return;
@@ -137,20 +137,20 @@ macekbc_attach(device_t parent, device_t
 	0, t-t_ioh[PCKBPORT_KBD_SLOT]) != 0) {
 		aprint_error(%s: couldn't map kbd registers\n,
 		device_xname(self));
-		return;
+		goto bork;
 	}
 	if (bus_space_subregion(t-t_iot, maa-maa_sh, maa-maa_offset + 32,
 	0, t-t_ioh[PCKBPORT_AUX_SLOT]) != 0) {
 		aprint_error(%s: couldn't map aux registers\n,
 		device_xname(self));
-		return;
+		goto bork;
 	}
 
 	if ((t-t_rxih = cpu_intr_establish(maa-maa_intr, maa-maa_intrmask,
 	macekbc_intr, t)) == NULL) {
 		printf(%s: couldn't establish interrupt\n,
 		device_xname(self));
-		return;
+		goto bork;
 	}
 	sc-sc_id = t;
 	t-t_sc = sc;
@@ -169,6 +169,9 @@ macekbc_attach(device_t parent, device_t
 		t-t_present[PCKBPORT_AUX_SLOT] = 1;
 
 	return;
+bork:
+	kmem_free(t, sizeof(struct macekbc_internal));
+	return;
 }
 
 static int



CVS commit: src/sys/arch/sgimips/mace

2015-02-17 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Tue Feb 17 11:25:43 UTC 2015

Modified Files:
src/sys/arch/sgimips/mace: mavb.c

Log Message:
move DAC1 output channel to master so things like OSS and kmix work
as expected


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/sgimips/mace/mavb.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/sgimips/mace/mavb.c
diff -u src/sys/arch/sgimips/mace/mavb.c:1.9 src/sys/arch/sgimips/mace/mavb.c:1.10
--- src/sys/arch/sgimips/mace/mavb.c:1.9	Sat Oct 27 17:18:10 2012
+++ src/sys/arch/sgimips/mace/mavb.c	Tue Feb 17 11:25:43 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: mavb.c,v 1.9 2012/10/27 17:18:10 chs Exp $ */
+/* $NetBSD: mavb.c,v 1.10 2015/02/17 11:25:43 macallan Exp $ */
 /* $OpenBSD: mavb.c,v 1.6 2005/04/15 13:05:14 mickey Exp $ */
 
 /*
@@ -723,16 +723,16 @@ mavb_query_devinfo(void *hdl, struct mix
 
 	case AD1843_DAC1_GAIN:
 		di-type = AUDIO_MIXER_VALUE;
-		di-mixer_class = AD1843_INPUT_CLASS;
+		di-mixer_class = AD1843_OUTPUT_CLASS;
 		di-next = AD1843_DAC1_MUTE;
-		strlcpy(di-label.name, AudioNdac 1, sizeof di-label.name);
+		strlcpy(di-label.name, AudioNmaster, sizeof di-label.name);
 		di-un.v.num_channels = 2;
 		strlcpy(di-un.v.units.name, AudioNvolume,
 		sizeof di-un.v.units.name);
 		break;
 	case AD1843_DAC1_MUTE:
 		di-type = AUDIO_MIXER_ENUM;
-		di-mixer_class = AD1843_INPUT_CLASS;
+		di-mixer_class = AD1843_OUTPUT_CLASS;
 		di-prev = AD1843_DAC1_GAIN;
 		strlcpy(di-label.name, AudioNmute, sizeof di-label.name);
 		di-un.e.num_mem = 2;



CVS commit: src/sys/arch/sgimips/mace

2011-08-17 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Thu Aug 18 03:25:34 UTC 2011

Modified Files:
src/sys/arch/sgimips/mace: mace.c

Log Message:
device_t-ify


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/sgimips/mace/mace.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/sgimips/mace/mace.c
diff -u src/sys/arch/sgimips/mace/mace.c:1.17 src/sys/arch/sgimips/mace/mace.c:1.18
--- src/sys/arch/sgimips/mace/mace.c:1.17	Fri Jul  1 18:53:47 2011
+++ src/sys/arch/sgimips/mace/mace.c	Thu Aug 18 03:25:34 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: mace.c,v 1.17 2011/07/01 18:53:47 dyoung Exp $	*/
+/*	$NetBSD: mace.c,v 1.18 2011/08/18 03:25:34 macallan Exp $	*/
 
 /*
  * Copyright (c) 2003 Christopher Sekiya
@@ -45,7 +45,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: mace.c,v 1.17 2011/07/01 18:53:47 dyoung Exp $);
+__KERNEL_RCSID(0, $NetBSD: mace.c,v 1.18 2011/08/18 03:25:34 macallan Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -87,7 +87,7 @@
 } maceintrtab[MACE_NINTR];
 
 struct mace_softc {
-	struct device sc_dev;
+	device_t sc_dev;
 
 	bus_space_tag_t iot;
 	bus_space_handle_t ioh;
@@ -105,7 +105,7 @@
 static int	mace_search(struct device *, struct cfdata *,
 			const int *, void *);
 
-CFATTACH_DECL(mace, sizeof(struct mace_softc),
+CFATTACH_DECL_NEW(mace, sizeof(struct mace_softc),
 mace_match, mace_attach, NULL, NULL);
 
 #if defined(BLINK)
@@ -114,7 +114,7 @@
 #endif
 
 static int
-mace_match(struct device *parent, struct cfdata *match, void *aux)
+mace_match(device_t parent, struct cfdata *match, void *aux)
 {
 
 	/*
@@ -127,12 +127,13 @@
 }
 
 static void
-mace_attach(struct device *parent, struct device *self, void *aux)
+mace_attach(device_t parent, device_t self, void *aux)
 {
-	struct mace_softc *sc = (struct mace_softc *)self;
+	struct mace_softc *sc = device_private(self);
 	struct mainbus_attach_args *ma = aux;
 	uint32_t scratch;
 
+	sc-sc_dev = self;
 #ifdef BLINK
 	callout_init(mace_blink_ch, 0);
 #endif
@@ -202,10 +203,10 @@
 }
 
 static int
-mace_search(struct device *parent, struct cfdata *cf,
+mace_search(device_t parent, struct cfdata *cf,
 	const int *ldesc, void *aux)
 {
-	struct mace_softc *sc = (struct mace_softc *)parent;
+	struct mace_softc *sc = device_private(parent);
 	struct mace_attach_args maa;
 	int tryagain;
 



CVS commit: src/sys/arch/sgimips/mace

2009-12-13 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sun Dec 13 11:10:50 UTC 2009

Modified Files:
src/sys/arch/sgimips/mace: mcclock_mace.c

Log Message:
Split device_t/softc, some KNF.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/sgimips/mace/mcclock_mace.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/sgimips/mace/mcclock_mace.c
diff -u src/sys/arch/sgimips/mace/mcclock_mace.c:1.12 src/sys/arch/sgimips/mace/mcclock_mace.c:1.13
--- src/sys/arch/sgimips/mace/mcclock_mace.c:1.12	Sun Dec 13 11:03:33 2009
+++ src/sys/arch/sgimips/mace/mcclock_mace.c	Sun Dec 13 11:10:50 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: mcclock_mace.c,v 1.12 2009/12/13 11:03:33 tsutsui Exp $	*/
+/*	$NetBSD: mcclock_mace.c,v 1.13 2009/12/13 11:10:50 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 2001 Antti Kantee.  All Rights Reserved.
@@ -65,7 +65,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: mcclock_mace.c,v 1.12 2009/12/13 11:03:33 tsutsui Exp $);
+__KERNEL_RCSID(0, $NetBSD: mcclock_mace.c,v 1.13 2009/12/13 11:10:50 tsutsui Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -84,7 +84,7 @@
 #include sgimips/sgimips/clockvar.h
 
 struct mcclock_mace_softc {
-	struct device		sc_dev;
+	device_t		sc_dev;
 
 	struct todr_chip_handle sc_todrch;
 
@@ -94,12 +94,12 @@
 
 static struct mcclock_mace_softc *mace0 = NULL;
 
-static int	mcclock_mace_match(struct device *, struct cfdata *, void *);
-static void	mcclock_mace_attach(struct device*, struct device *, void *);
+static int	mcclock_mace_match(device_t, cfdata_t, void *);
+static void	mcclock_mace_attach(device_t, device_t, void *);
 
-static int	mcclock_mace_gettime_ymdhms(struct todr_chip_handle *,
+static int	mcclock_mace_gettime_ymdhms(todr_chip_handle_t,
 struct clock_ymdhms *);
-static int	mcclock_mace_settime_ymdhms(struct todr_chip_handle *,
+static int	mcclock_mace_settime_ymdhms(todr_chip_handle_t,
 struct clock_ymdhms *);
 
 unsigned int	ds1687_read(void *arg, unsigned int addr);
@@ -108,21 +108,23 @@
 void		mcclock_poweroff(void);
 
 
-CFATTACH_DECL(mcclock_mace, sizeof(struct mcclock_mace_softc),
+CFATTACH_DECL_NEW(mcclock_mace, sizeof(struct mcclock_mace_softc),
 mcclock_mace_match, mcclock_mace_attach, NULL, NULL);
 
 static int
-mcclock_mace_match(struct device *parent, struct cfdata *match, void *aux)
+mcclock_mace_match(device_t parent, cfdata_t cf, void *aux)
 {
+
 	return 1;
 }
 
 void
-mcclock_mace_attach(struct device *parent, struct device *self, void *aux)
+mcclock_mace_attach(device_t parent, device_t self, void *aux)
 {
-	struct mcclock_mace_softc *sc = (void *)self;
+	struct mcclock_mace_softc *sc = device_private(self);
 	struct mace_attach_args *maa = aux;
 
+	sc-sc_dev = self;
 	sc-sc_st = maa-maa_st;
 	/* XXX should be bus_space_map() */
 	if (bus_space_subregion(maa-maa_st, maa-maa_sh,
@@ -161,25 +163,23 @@
 unsigned int
 ds1687_read(void *arg, unsigned int addr)
 {
-	struct mcclock_mace_softc *sc = (struct mcclock_mace_softc *)arg;
+	struct mcclock_mace_softc *sc = arg;
 
-	return (bus_space_read_1(sc-sc_st, sc-sc_sh, addr));
+	return bus_space_read_1(sc-sc_st, sc-sc_sh, addr);
 }
 
 void
 ds1687_write(void *arg, unsigned int addr, unsigned int data)
 {
-	struct mcclock_mace_softc *sc = (struct mcclock_mace_softc *)arg;
+	struct mcclock_mace_softc *sc = arg;
 
 	bus_space_write_1(sc-sc_st, sc-sc_sh, addr, data);
 }
 
 static int
-mcclock_mace_gettime_ymdhms(struct todr_chip_handle *todrch,
-struct clock_ymdhms *dt)
+mcclock_mace_gettime_ymdhms(todr_chip_handle_t todrch, struct clock_ymdhms *dt)
 {
-	struct mcclock_mace_softc *sc =
-	(struct mcclock_mace_softc *)todrch-cookie;
+	struct mcclock_mace_softc *sc = todrch-cookie;
 	ds1687_todregs regs;
 	int s;
 
@@ -196,15 +196,13 @@
 	dt-dt_year = FROMBCD(regs[DS1687_SOFT_YEAR]) +
 	(100 * FROMBCD(regs[DS1687_SOFT_CENTURY]));
 
-	return (0);
+	return 0;
 }
 
 static int
-mcclock_mace_settime_ymdhms(struct todr_chip_handle *todrch,
-struct clock_ymdhms *dt)
+mcclock_mace_settime_ymdhms(todr_chip_handle_t todrch, struct clock_ymdhms *dt)
 {
-	struct mcclock_mace_softc *sc =
-	(struct mcclock_mace_softc *)todrch-cookie;
+	struct mcclock_mace_softc *sc = todrch-cookie;
 	ds1687_todregs regs;
 	int s;
 
@@ -222,7 +220,7 @@
 	DS1687_PUTTOD(sc, regs);
 	splx(s);
 
-	return (0);
+	return 0;
 }
 
 void
@@ -254,5 +252,6 @@
 	ds1687_write(mace0, DS1687_BANK1_XCTRL4A, xctl_a | DS1687_X4A_PAB);
 	ds1687_write(mace0, DS1687_CONTROLA, a);
 	wbflush();
-	while(1);
+	for (;;)
+		;
 }



CVS commit: src/sys/arch/sgimips/mace

2009-11-27 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Fri Nov 27 11:04:18 UTC 2009

Modified Files:
src/sys/arch/sgimips/mace: if_mec.c

Log Message:
Fix typo in comment.


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/sys/arch/sgimips/mace/if_mec.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/sgimips/mace/if_mec.c
diff -u src/sys/arch/sgimips/mace/if_mec.c:1.39 src/sys/arch/sgimips/mace/if_mec.c:1.40
--- src/sys/arch/sgimips/mace/if_mec.c:1.39	Wed Sep  2 17:22:53 2009
+++ src/sys/arch/sgimips/mace/if_mec.c	Fri Nov 27 11:04:18 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: if_mec.c,v 1.39 2009/09/02 17:22:53 tsutsui Exp $ */
+/* $NetBSD: if_mec.c,v 1.40 2009/11/27 11:04:18 tsutsui Exp $ */
 
 /*-
  * Copyright (c) 2004, 2008 Izumi Tsutsui.  All rights reserved.
@@ -61,7 +61,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_mec.c,v 1.39 2009/09/02 17:22:53 tsutsui Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_mec.c,v 1.40 2009/11/27 11:04:18 tsutsui Exp $);
 
 #include opt_ddb.h
 #include bpfilter.h
@@ -1714,7 +1714,7 @@
 		}
 
 		/*
-		 * If 802.1Q VLAN MTU is enabled, ignore the bad packet errror.
+		 * If 802.1Q VLAN MTU is enabled, ignore the bad packet error.
 		 */
 		if ((sc-sc_ethercom.ec_capenable  ETHERCAP_VLAN_MTU) != 0)
 			rxstat = ~MEC_RXSTAT_BADPACKET;



CVS commit: src/sys/arch/sgimips/mace

2009-09-01 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Tue Sep  1 15:19:20 UTC 2009

Modified Files:
src/sys/arch/sgimips/mace: if_mec.c

Log Message:
Replace shutdownhook_establish(9) with pmf_device_register1(9).


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/sys/arch/sgimips/mace/if_mec.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/sgimips/mace/if_mec.c
diff -u src/sys/arch/sgimips/mace/if_mec.c:1.35 src/sys/arch/sgimips/mace/if_mec.c:1.36
--- src/sys/arch/sgimips/mace/if_mec.c:1.35	Sat May  9 18:31:46 2009
+++ src/sys/arch/sgimips/mace/if_mec.c	Tue Sep  1 15:19:20 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: if_mec.c,v 1.35 2009/05/09 18:31:46 tsutsui Exp $ */
+/* $NetBSD: if_mec.c,v 1.36 2009/09/01 15:19:20 tsutsui Exp $ */
 
 /*-
  * Copyright (c) 2004, 2008 Izumi Tsutsui.  All rights reserved.
@@ -61,7 +61,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_mec.c,v 1.35 2009/05/09 18:31:46 tsutsui Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_mec.c,v 1.36 2009/09/01 15:19:20 tsutsui Exp $);
 
 #include opt_ddb.h
 #include bpfilter.h
@@ -293,7 +293,6 @@
 	bus_space_tag_t sc_st;		/* bus_space tag */
 	bus_space_handle_t sc_sh;	/* bus_space handle */
 	bus_dma_tag_t sc_dmat;		/* bus_dma tag */
-	void *sc_sdhook;		/* shutdown hook */
 
 	struct ethercom sc_ethercom;	/* Ethernet common part */
 
@@ -416,7 +415,7 @@
 static void	mec_rxcsum(struct mec_softc *, struct mbuf *, uint16_t,
 		uint32_t);
 static void	mec_txintr(struct mec_softc *, uint32_t);
-static void	mec_shutdown(void *);
+static bool	mec_shutdown(device_t, int);
 
 CFATTACH_DECL_NEW(mec, sizeof(struct mec_softc),
 mec_match, mec_attach, NULL, NULL);
@@ -727,7 +726,7 @@
 #endif
 
 	/* set shutdown hook to reset interface on powerdown */
-	sc-sc_sdhook = shutdownhook_establish(mec_shutdown, sc);
+	pmf_device_register1(self, NULL, NULL, mec_shutdown);
 
 	return;
 
@@ -1952,12 +1951,14 @@
 		ifp-if_flags = ~IFF_OACTIVE;
 }
 
-static void
-mec_shutdown(void *arg)
+static bool
+mec_shutdown(device_t self, int howto)
 {
-	struct mec_softc *sc = arg;
+	struct mec_softc *sc = device_private(self);
 
 	mec_stop(sc-sc_ethercom.ec_if, 1);
 	/* make sure to stop DMA etc. */
 	mec_reset(sc);
+
+	return true;
 }



CVS commit: src/sys/arch/sgimips/mace

2009-09-01 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Tue Sep  1 17:10:42 UTC 2009

Modified Files:
src/sys/arch/sgimips/mace: if_mec.c

Log Message:
Check a return value of pmf_device_register1(9) and also call
pmf_class_network_register(9).


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/sys/arch/sgimips/mace/if_mec.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/sgimips/mace/if_mec.c
diff -u src/sys/arch/sgimips/mace/if_mec.c:1.36 src/sys/arch/sgimips/mace/if_mec.c:1.37
--- src/sys/arch/sgimips/mace/if_mec.c:1.36	Tue Sep  1 15:19:20 2009
+++ src/sys/arch/sgimips/mace/if_mec.c	Tue Sep  1 17:10:42 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: if_mec.c,v 1.36 2009/09/01 15:19:20 tsutsui Exp $ */
+/* $NetBSD: if_mec.c,v 1.37 2009/09/01 17:10:42 tsutsui Exp $ */
 
 /*-
  * Copyright (c) 2004, 2008 Izumi Tsutsui.  All rights reserved.
@@ -61,7 +61,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_mec.c,v 1.36 2009/09/01 15:19:20 tsutsui Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_mec.c,v 1.37 2009/09/01 17:10:42 tsutsui Exp $);
 
 #include opt_ddb.h
 #include bpfilter.h
@@ -726,7 +726,10 @@
 #endif
 
 	/* set shutdown hook to reset interface on powerdown */
-	pmf_device_register1(self, NULL, NULL, mec_shutdown);
+	if (!pmf_device_register1(self, NULL, NULL, mec_shutdown))
+		aprint_error_dev(self, couldn't establish power handler\n);
+	else
+		pmf_class_network_register(self, sc-sc_ethercom.ec_if);
 
 	return;
 



CVS commit: src/sys/arch/sgimips/mace

2009-05-09 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat May  9 18:31:46 UTC 2009

Modified Files:
src/sys/arch/sgimips/mace: if_mec.c

Log Message:
Use __func__ to print function names.


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/arch/sgimips/mace/if_mec.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/sgimips/mace/if_mec.c
diff -u src/sys/arch/sgimips/mace/if_mec.c:1.34 src/sys/arch/sgimips/mace/if_mec.c:1.35
--- src/sys/arch/sgimips/mace/if_mec.c:1.34	Mon Mar 16 09:58:51 2009
+++ src/sys/arch/sgimips/mace/if_mec.c	Sat May  9 18:31:46 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: if_mec.c,v 1.34 2009/03/16 09:58:51 tsutsui Exp $ */
+/* $NetBSD: if_mec.c,v 1.35 2009/05/09 18:31:46 tsutsui Exp $ */
 
 /*-
  * Copyright (c) 2004, 2008 Izumi Tsutsui.  All rights reserved.
@@ -61,7 +61,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_mec.c,v 1.34 2009/03/16 09:58:51 tsutsui Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_mec.c,v 1.35 2009/05/09 18:31:46 tsutsui Exp $);
 
 #include opt_ddb.h
 #include bpfilter.h
@@ -998,7 +998,7 @@
 	firsttx = MEC_NEXTTX(sc-sc_txlast);
 
 	DPRINTF(MEC_DEBUG_START,
-	(mec_start: opending = %d, firsttx = %d\n, opending, firsttx));
+	(%s: opending = %d, firsttx = %d\n, __func__, opending, firsttx));
 
 	while (sc-sc_txpending  MEC_NTXDESC - 1) {
 		/* Grab a packet off the queue. */
@@ -1025,8 +1025,8 @@
 		len = m0-m_pkthdr.len;
 
 		DPRINTF(MEC_DEBUG_START,
-		(mec_start: len = %d, nexttx = %d, txpending = %d\n,
-		len, nexttx, sc-sc_txpending));
+		(%s: len = %d, nexttx = %d, txpending = %d\n,
+		__func__, len, nexttx, sc-sc_txpending));
 
 		if (len = MEC_TXD_BUFSIZE) {
 			/*
@@ -1034,7 +1034,8 @@
 			 * just copy it into there. Maybe it's faster than
 			 * checking alignment and calling bus_dma(9) etc.
 			 */
-			DPRINTF(MEC_DEBUG_START, (mec_start: short packet\n));
+			DPRINTF(MEC_DEBUG_START, (%s: short packet\n,
+			__func__));
 			IFQ_DEQUEUE(ifp-if_snd, m0);
 
 			/*
@@ -1059,7 +1060,8 @@
 			 * If the packet won't fit the static buffer in txdesc,
 			 * we have to use the concatenate pointers to handle it.
 			 */
-			DPRINTF(MEC_DEBUG_START, (mec_start: long packet\n));
+			DPRINTF(MEC_DEBUG_START, (%s: long packet\n,
+			__func__));
 			txs-txs_flags = MEC_TXS_TXDPTR;
 
 			/*
@@ -1158,7 +1160,7 @@
  * is uint64_t aligned.
  */ 
 DPRINTF(MEC_DEBUG_START|MEC_DEBUG_TXSEGS,
-(mec_start: re-allocating mbuf\n));
+(%s: re-allocating mbuf\n, __func__));
 
 MGETHDR(m, M_DONTWAIT, MT_DATA);
 if (m == NULL) {
@@ -1353,8 +1355,8 @@
 			bus_dma_segment_t *segs = dmamap-dm_segs;
 
 			DPRINTF(MEC_DEBUG_TXSEGS,
-			(mec_start: nsegs = %d, pseg = %d, nptr = %d\n,
-			dmamap-dm_nsegs, pseg, nptr));
+			(%s: nsegs = %d, pseg = %d, nptr = %d\n,
+			__func__, dmamap-dm_nsegs, pseg, nptr));
 
 			switch (nptr) {
 			case 3:
@@ -1399,16 +1401,20 @@
 		txd-txd_cmd = txdcmd;
 
 		DPRINTF(MEC_DEBUG_START,
-		(mec_start: txd_cmd= 0x%016llx\n, txd-txd_cmd));
+		(%s: txd_cmd= 0x%016llx\n,
+		__func__, txd-txd_cmd));
 		DPRINTF(MEC_DEBUG_START,
-		(mec_start: txd_ptr[0] = 0x%016llx\n, txd-txd_ptr[0]));
+		(%s: txd_ptr[0] = 0x%016llx\n,
+		__func__, txd-txd_ptr[0]));
 		DPRINTF(MEC_DEBUG_START,
-		(mec_start: txd_ptr[1] = 0x%016llx\n, txd-txd_ptr[1]));
+		(%s: txd_ptr[1] = 0x%016llx\n,
+		__func__, txd-txd_ptr[1]));
 		DPRINTF(MEC_DEBUG_START,
-		(mec_start: txd_ptr[2] = 0x%016llx\n, txd-txd_ptr[2]));
+		(%s: txd_ptr[2] = 0x%016llx\n,
+		__func__, txd-txd_ptr[2]));
 		DPRINTF(MEC_DEBUG_START,
-		(mec_start: len = %d (0x%04x), buflen = %d (0x%02x)\n,
-		len, len, buflen, buflen));
+		(%s: len = %d (0x%04x), buflen = %d (0x%02x)\n,
+		__func__, len, len, buflen, buflen));
 
 		/* sync TX descriptor */
 		MEC_TXDESCSYNC(sc, nexttx,
@@ -1451,7 +1457,7 @@
 	struct mec_txsoft *txs;
 	int i;
 
-	DPRINTF(MEC_DEBUG_STOP, (mec_stop\n));
+	DPRINTF(MEC_DEBUG_STOP, (%s\n, __func__));
 
 	ifp-if_timer = 0;
 	ifp-if_flags = ~(IFF_RUNNING | IFF_OACTIVE);
@@ -1583,7 +1589,7 @@
 	uint32_t statreg, statack, txptr;
 	int handled, sent;
 
-	DPRINTF(MEC_DEBUG_INTR, (mec_intr: called\n));
+	DPRINTF(MEC_DEBUG_INTR, (%s: called\n, __func__));
 
 	handled = sent = 0;
 
@@ -1591,7 +1597,7 @@
 		statreg = bus_space_read_8(st, sh, MEC_INT_STATUS);
 
 		DPRINTF(MEC_DEBUG_INTR,
-		(mec_intr: INT_STAT = 0x%08x\n, statreg));
+		(%s: INT_STAT = 0x%08x\n, __func__, statreg));
 
 		statack = statreg  MEC_INT_STATUS_MASK;
 		if (statack == 0)
@@ -1621,7 +1627,7 @@
  */
 bus_space_write_8(st, sh, MEC_TX_ALIAS, 0);
 DPRINTF(MEC_DEBUG_INTR,
-(mec_intr: disable TX_INT\n));
+(%s: disable TX_INT\n, __func__));
 			}
 #ifdef MEC_EVENT_COUNTERS
 			if ((statack  MEC_INT_TX_EMPTY) != 0)
@@ -1637,8 +1643,8 @@