From 5a4eb24b7c9ca10dc7f698433549456565f2c889 Mon Sep 17 00:00:00 2001 From: kiyohara Date: Sun, 29 Nov 2009 10:06:19 +0000 Subject: [PATCH] Change print messages. 1. Use aprint instead of DPRINTF in swap mode. 2. Locates and vendor/LSI names 1-line print. 3. Also print (and maybe support) LAN92xx. --- sys/dev/ic/lan9118.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/sys/dev/ic/lan9118.c b/sys/dev/ic/lan9118.c index 077c14915462..deecc8d1c65d 100644 --- a/sys/dev/ic/lan9118.c +++ b/sys/dev/ic/lan9118.c @@ -1,4 +1,4 @@ -/* $NetBSD: lan9118.c,v 1.7 2009/11/29 09:34:20 kiyohara Exp $ */ +/* $NetBSD: lan9118.c,v 1.8 2009/11/29 10:06:19 kiyohara Exp $ */ /* * Copyright (c) 2008 KIYOHARA Takashi * All rights reserved. @@ -25,7 +25,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -__KERNEL_RCSID(0, "$NetBSD: lan9118.c,v 1.7 2009/11/29 09:34:20 kiyohara Exp $"); +__KERNEL_RCSID(0, "$NetBSD: lan9118.c,v 1.8 2009/11/29 10:06:19 kiyohara Exp $"); /* * The LAN9118 Family @@ -164,15 +164,13 @@ lan9118_attach(struct lan9118_softc *sc) uint32_t val; int timo, i; - if (sc->sc_flags & LAN9118_FLAGS_SWAP) { - /* need byte swap */ - DPRINTFN(1, ("%s: need byte swap\n", __func__)); + if (sc->sc_flags & LAN9118_FLAGS_SWAP) + /* byte swap mode */ bus_space_write_4(sc->sc_iot, sc->sc_ioh, LAN9118_WORD_SWAP, 0xffffffff); - } val = bus_space_read_4(sc->sc_iot, sc->sc_ioh, LAN9118_BYTE_TEST); if (val != LAN9118_BYTE_TEST_VALUE) { - aprint_error_dev(sc->sc_dev, "failed to detect chip\n"); + aprint_error(": failed to detect chip\n"); return EINVAL; } @@ -180,8 +178,14 @@ lan9118_attach(struct lan9118_softc *sc) sc->sc_id = LAN9118_ID_REV_ID(val); sc->sc_rev = LAN9118_ID_REV_REV(val); - aprint_normal_dev(sc->sc_dev, "SMSC LAN9%03x Rev %d\n", - sc->sc_id, sc->sc_rev); +#define LAN9xxx_ID(id) ((id) >= 0x9000 ? (id) & 0xfff : \ + ((id) >= 0x1000 ? ((id) >> 4) | 0x100 : (id))) + + aprint_normal(": SMSC LAN9%03x Rev %d\n", + LAN9xxx_ID(sc->sc_id), sc->sc_rev); + + if (sc->sc_flags & LAN9118_FLAGS_SWAP) + aprint_normal_dev(sc->sc_dev, "byte swap mode\n"); timo = 3 * 1000 * 1000; /* XXXX 3sec */ do {