Remove ancient DDB-dependent `hide/integrate'.

Simplify lewrcsr/lerdcsr; read-back after write doesn't hurt on sun4 so
skip the cpu type test in generic kernels.
This commit is contained in:
pk 2003-11-11 15:01:05 +00:00
parent 6961fe8c08
commit bb69a241e8
4 changed files with 49 additions and 77 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_le_obio.c,v 1.19 2003/07/15 00:04:55 lukem Exp $ */ /* $NetBSD: if_le_obio.c,v 1.20 2003/11/11 15:01:05 pk Exp $ */
/*- /*-
* Copyright (c) 1997, 1998 The NetBSD Foundation, Inc. * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@ -38,7 +38,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: if_le_obio.c,v 1.19 2003/07/15 00:04:55 lukem Exp $"); __KERNEL_RCSID(0, "$NetBSD: if_le_obio.c,v 1.20 2003/11/11 15:01:05 pk Exp $");
#include "opt_inet.h" #include "opt_inet.h"
#include "bpfilter.h" #include "bpfilter.h"
@ -100,14 +100,6 @@ extern struct cfdriver le_cd;
#include "opt_ddb.h" #include "opt_ddb.h"
#endif #endif
#ifdef DDB
#define integrate
#define hide
#else
#define integrate static __inline
#define hide static
#endif
static void lewrcsr __P((struct lance_softc *, u_int16_t, u_int16_t)); static void lewrcsr __P((struct lance_softc *, u_int16_t, u_int16_t));
static u_int16_t lerdcsr __P((struct lance_softc *, u_int16_t)); static u_int16_t lerdcsr __P((struct lance_softc *, u_int16_t));
@ -117,9 +109,11 @@ lewrcsr(sc, port, val)
u_int16_t port, val; u_int16_t port, val;
{ {
struct le_softc *lesc = (struct le_softc *)sc; struct le_softc *lesc = (struct le_softc *)sc;
bus_space_tag_t t = lesc->sc_bustag;
bus_space_handle_t h = lesc->sc_reg;
bus_space_write_2(lesc->sc_bustag, lesc->sc_reg, LEREG1_RAP, port); bus_space_write_2(t, h, LEREG1_RAP, port);
bus_space_write_2(lesc->sc_bustag, lesc->sc_reg, LEREG1_RDP, val); bus_space_write_2(t, h, LEREG1_RDP, val);
} }
static u_int16_t static u_int16_t
@ -128,9 +122,11 @@ lerdcsr(sc, port)
u_int16_t port; u_int16_t port;
{ {
struct le_softc *lesc = (struct le_softc *)sc; struct le_softc *lesc = (struct le_softc *)sc;
bus_space_tag_t t = lesc->sc_bustag;
bus_space_handle_t h = lesc->sc_reg;
bus_space_write_2(lesc->sc_bustag, lesc->sc_reg, LEREG1_RAP, port); bus_space_write_2(t, h, LEREG1_RAP, port);
return (bus_space_read_2(lesc->sc_bustag, lesc->sc_reg, LEREG1_RDP)); return (bus_space_read_2(t, h, LEREG1_RDP));
} }
int int

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_le.c,v 1.27 2002/12/10 13:44:48 pk Exp $ */ /* $NetBSD: if_le.c,v 1.28 2003/11/11 15:01:05 pk Exp $ */
/*- /*-
* Copyright (c) 1997, 1998 The NetBSD Foundation, Inc. * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@ -38,7 +38,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: if_le.c,v 1.27 2002/12/10 13:44:48 pk Exp $"); __KERNEL_RCSID(0, "$NetBSD: if_le.c,v 1.28 2003/11/11 15:01:05 pk Exp $");
#include "opt_inet.h" #include "opt_inet.h"
#include "bpfilter.h" #include "bpfilter.h"
@ -104,14 +104,6 @@ extern struct cfdriver le_cd;
#include "opt_ddb.h" #include "opt_ddb.h"
#endif #endif
#ifdef DDB
#define integrate
#define hide
#else
#define integrate static __inline
#define hide static
#endif
static void lewrcsr __P((struct lance_softc *, u_int16_t, u_int16_t)); static void lewrcsr __P((struct lance_softc *, u_int16_t, u_int16_t));
static u_int16_t lerdcsr __P((struct lance_softc *, u_int16_t)); static u_int16_t lerdcsr __P((struct lance_softc *, u_int16_t));
@ -121,9 +113,11 @@ lewrcsr(sc, port, val)
u_int16_t port, val; u_int16_t port, val;
{ {
struct le_softc *lesc = (struct le_softc *)sc; struct le_softc *lesc = (struct le_softc *)sc;
bus_space_tag_t t = lesc->sc_bustag;
bus_space_handle_t h = lesc->sc_reg;
bus_space_write_2(lesc->sc_bustag, lesc->sc_reg, LEREG1_RAP, port); bus_space_write_2(t, h, LEREG1_RAP, port);
bus_space_write_2(lesc->sc_bustag, lesc->sc_reg, LEREG1_RDP, val); bus_space_write_2(t, h, LEREG1_RDP, val);
#if defined(SUN4M) #if defined(SUN4M)
/* /*
@ -131,11 +125,7 @@ lewrcsr(sc, port, val)
* easily be accomplished by reading back the register that we * easily be accomplished by reading back the register that we
* just wrote (thanks to Chris Torek for this solution). * just wrote (thanks to Chris Torek for this solution).
*/ */
if (CPU_ISSUN4M) { (void)bus_space_read_2(t, h, LEREG1_RDP);
volatile u_int16_t discard;
discard = bus_space_read_2(lesc->sc_bustag, lesc->sc_reg,
LEREG1_RDP);
}
#endif #endif
} }
@ -145,9 +135,11 @@ lerdcsr(sc, port)
u_int16_t port; u_int16_t port;
{ {
struct le_softc *lesc = (struct le_softc *)sc; struct le_softc *lesc = (struct le_softc *)sc;
bus_space_tag_t t = lesc->sc_bustag;
bus_space_handle_t h = lesc->sc_reg;
bus_space_write_2(lesc->sc_bustag, lesc->sc_reg, LEREG1_RAP, port); bus_space_write_2(t, h, LEREG1_RAP, port);
return (bus_space_read_2(lesc->sc_bustag, lesc->sc_reg, LEREG1_RDP)); return (bus_space_read_2(t, h, LEREG1_RDP));
} }

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_le_lebuffer.c,v 1.16 2002/12/10 13:44:48 pk Exp $ */ /* $NetBSD: if_le_lebuffer.c,v 1.17 2003/11/11 15:01:05 pk Exp $ */
/*- /*-
* Copyright (c) 1997, 1998 The NetBSD Foundation, Inc. * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@ -38,7 +38,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: if_le_lebuffer.c,v 1.16 2002/12/10 13:44:48 pk Exp $"); __KERNEL_RCSID(0, "$NetBSD: if_le_lebuffer.c,v 1.17 2003/11/11 15:01:05 pk Exp $");
#include "opt_inet.h" #include "opt_inet.h"
#include "bpfilter.h" #include "bpfilter.h"
@ -107,14 +107,6 @@ extern struct cfdriver le_cd;
#include "opt_ddb.h" #include "opt_ddb.h"
#endif #endif
#ifdef DDB
#define integrate
#define hide
#else
#define integrate static __inline
#define hide static
#endif
static void lewrcsr __P((struct lance_softc *, u_int16_t, u_int16_t)); static void lewrcsr __P((struct lance_softc *, u_int16_t, u_int16_t));
static u_int16_t lerdcsr __P((struct lance_softc *, u_int16_t)); static u_int16_t lerdcsr __P((struct lance_softc *, u_int16_t));
@ -124,9 +116,11 @@ lewrcsr(sc, port, val)
u_int16_t port, val; u_int16_t port, val;
{ {
struct le_softc *lesc = (struct le_softc *)sc; struct le_softc *lesc = (struct le_softc *)sc;
bus_space_tag_t t = lesc->sc_bustag;
bus_space_handle_t h = lesc->sc_reg;
bus_space_write_2(lesc->sc_bustag, lesc->sc_reg, LEREG1_RAP, port); bus_space_write_2(t, h, LEREG1_RAP, port);
bus_space_write_2(lesc->sc_bustag, lesc->sc_reg, LEREG1_RDP, val); bus_space_write_2(t, h, LEREG1_RDP, val);
#if defined(SUN4M) #if defined(SUN4M)
/* /*
@ -134,11 +128,7 @@ lewrcsr(sc, port, val)
* easily be accomplished by reading back the register that we * easily be accomplished by reading back the register that we
* just wrote (thanks to Chris Torek for this solution). * just wrote (thanks to Chris Torek for this solution).
*/ */
if (CPU_ISSUN4M) { (void)bus_space_read_2(t, h, LEREG1_RDP);
volatile u_int16_t discard;
discard = bus_space_read_2(lesc->sc_bustag, lesc->sc_reg,
LEREG1_RDP);
}
#endif #endif
} }
@ -148,9 +138,11 @@ lerdcsr(sc, port)
u_int16_t port; u_int16_t port;
{ {
struct le_softc *lesc = (struct le_softc *)sc; struct le_softc *lesc = (struct le_softc *)sc;
bus_space_tag_t t = lesc->sc_bustag;
bus_space_handle_t h = lesc->sc_reg;
bus_space_write_2(lesc->sc_bustag, lesc->sc_reg, LEREG1_RAP, port); bus_space_write_2(t, h, LEREG1_RAP, port);
return (bus_space_read_2(lesc->sc_bustag, lesc->sc_reg, LEREG1_RDP)); return (bus_space_read_2(t, h, LEREG1_RDP));
} }
int int

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_le_ledma.c,v 1.22 2002/12/10 13:44:48 pk Exp $ */ /* $NetBSD: if_le_ledma.c,v 1.23 2003/11/11 15:01:05 pk Exp $ */
/*- /*-
* Copyright (c) 1997, 1998 The NetBSD Foundation, Inc. * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@ -38,7 +38,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: if_le_ledma.c,v 1.22 2002/12/10 13:44:48 pk Exp $"); __KERNEL_RCSID(0, "$NetBSD: if_le_ledma.c,v 1.23 2003/11/11 15:01:05 pk Exp $");
#include "opt_inet.h" #include "opt_inet.h"
#include "bpfilter.h" #include "bpfilter.h"
@ -120,19 +120,11 @@ extern struct cfdriver le_cd;
#include "opt_ddb.h" #include "opt_ddb.h"
#endif #endif
#ifdef DDB
#define integrate
#define hide
#else
#define integrate static __inline
#define hide static
#endif
static void lewrcsr __P((struct lance_softc *, u_int16_t, u_int16_t)); static void lewrcsr __P((struct lance_softc *, u_int16_t, u_int16_t));
static u_int16_t lerdcsr __P((struct lance_softc *, u_int16_t)); static u_int16_t lerdcsr __P((struct lance_softc *, u_int16_t));
hide void lehwreset __P((struct lance_softc *)); static void lehwreset __P((struct lance_softc *));
hide void lehwinit __P((struct lance_softc *)); static void lehwinit __P((struct lance_softc *));
hide void lenocarrier __P((struct lance_softc *)); static void lenocarrier __P((struct lance_softc *));
static void static void
lewrcsr(sc, port, val) lewrcsr(sc, port, val)
@ -140,9 +132,11 @@ lewrcsr(sc, port, val)
u_int16_t port, val; u_int16_t port, val;
{ {
struct le_softc *lesc = (struct le_softc *)sc; struct le_softc *lesc = (struct le_softc *)sc;
bus_space_tag_t t = lesc->sc_bustag;
bus_space_handle_t h = lesc->sc_reg;
bus_space_write_2(lesc->sc_bustag, lesc->sc_reg, LEREG1_RAP, port); bus_space_write_2(t, h, LEREG1_RAP, port);
bus_space_write_2(lesc->sc_bustag, lesc->sc_reg, LEREG1_RDP, val); bus_space_write_2(t, h, LEREG1_RDP, val);
#if defined(SUN4M) #if defined(SUN4M)
/* /*
@ -150,11 +144,7 @@ lewrcsr(sc, port, val)
* easily be accomplished by reading back the register that we * easily be accomplished by reading back the register that we
* just wrote (thanks to Chris Torek for this solution). * just wrote (thanks to Chris Torek for this solution).
*/ */
if (CPU_ISSUN4M) { (void)bus_space_read_2(t, h, LEREG1_RDP);
volatile u_int16_t discard;
discard = bus_space_read_2(lesc->sc_bustag, lesc->sc_reg,
LEREG1_RDP);
}
#endif #endif
} }
@ -164,9 +154,11 @@ lerdcsr(sc, port)
u_int16_t port; u_int16_t port;
{ {
struct le_softc *lesc = (struct le_softc *)sc; struct le_softc *lesc = (struct le_softc *)sc;
bus_space_tag_t t = lesc->sc_bustag;
bus_space_handle_t h = lesc->sc_reg;
bus_space_write_2(lesc->sc_bustag, lesc->sc_reg, LEREG1_RAP, port); bus_space_write_2(t, h, LEREG1_RAP, port);
return (bus_space_read_2(lesc->sc_bustag, lesc->sc_reg, LEREG1_RDP)); return (bus_space_read_2(t, h, LEREG1_RDP));
} }
void void
@ -245,7 +237,7 @@ lemediastatus(sc, ifmr)
ifmr->ifm_active = IFM_ETHER|IFM_10_5; ifmr->ifm_active = IFM_ETHER|IFM_10_5;
} }
hide void static void
lehwreset(sc) lehwreset(sc)
struct lance_softc *sc; struct lance_softc *sc;
{ {
@ -277,7 +269,7 @@ lehwreset(sc)
delay(20000); /* must not touch le for 20ms */ delay(20000); /* must not touch le for 20ms */
} }
hide void static void
lehwinit(sc) lehwinit(sc)
struct lance_softc *sc; struct lance_softc *sc;
{ {
@ -297,7 +289,7 @@ lehwinit(sc)
} }
} }
hide void static void
lenocarrier(sc) lenocarrier(sc)
struct lance_softc *sc; struct lance_softc *sc;
{ {