Split device_t/softc, use aprint_*().

This commit is contained in:
tsutsui 2009-04-17 14:48:17 +00:00
parent a23ae1c696
commit e2c7edc059

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_tlp_ap.c,v 1.10 2008/04/28 20:23:30 martin Exp $ */
/* $NetBSD: if_tlp_ap.c,v 1.11 2009/04/17 14:48:17 tsutsui Exp $ */
/*
* Copyright (c) 2000 The NetBSD Foundation, Inc.
@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: if_tlp_ap.c,v 1.10 2008/04/28 20:23:30 martin Exp $");
__KERNEL_RCSID(0, "$NetBSD: if_tlp_ap.c,v 1.11 2009/04/17 14:48:17 tsutsui Exp $");
#include <sys/param.h>
#include <sys/device.h>
@ -78,10 +78,10 @@ struct tulip_ap_softc {
bus_space_handle_t sc_cfsh;
};
static int tlp_ap_match(struct device *, struct cfdata *, void *);
static void tlp_ap_attach(struct device *, struct device *, void *);
static int tlp_ap_match(device_t, cfdata_t, void *);
static void tlp_ap_attach(device_t, device_t, void *);
CFATTACH_DECL(tlp_ap, sizeof(struct tulip_ap_softc),
CFATTACH_DECL_NEW(tlp_ap, sizeof(struct tulip_ap_softc),
tlp_ap_match, tlp_ap_attach, NULL, NULL);
static void tlp_ap_preinit(struct tulip_softc *);
@ -94,7 +94,7 @@ const struct tulip_mediasw tlp_ap_mediasw = {
};
static int
tlp_ap_match(struct device *parent, struct cfdata *cf, void *aux)
tlp_ap_match(device_t parent, cfdata_t cf, void *aux)
{
struct apbus_attach_args *apa = aux;
@ -108,16 +108,18 @@ tlp_ap_match(struct device *parent, struct cfdata *cf, void *aux)
* Install interface into kernel networking data structures
*/
static void
tlp_ap_attach(struct device *parent, struct device *self, void *aux)
tlp_ap_attach(device_t parent, device_t self, void *aux)
{
struct tulip_ap_softc *psc = (void *) self;
struct tulip_ap_softc *psc = device_private(self);
struct tulip_softc *sc = &psc->sc_tulip;
struct apbus_attach_args *apa = aux;
uint8_t enaddr[ETHER_ADDR_LEN];
u_int intrmask;
int i;
printf(" slot%d addr 0x%lx", apa->apa_slotno, apa->apa_hwbase);
sc->sc_dev = self;
aprint_normal(" slot%d addr 0x%lx", apa->apa_slotno, apa->apa_hwbase);
/* PCI configuration register */
psc->sc_cfst = 0;
@ -133,11 +135,11 @@ tlp_ap_attach(struct device *parent, struct device *self, void *aux)
sc->sc_chip = TULIP_CHIP_21140;
break;
default:
printf(": unable to handle your board\n");
aprint_error(": unable to handle your board\n");
return;
}
printf(": %s Ethernet, pass %d.%d\n",
aprint_normal(": %s Ethernet, pass %d.%d\n",
tlp_chip_names[sc->sc_chip],
(sc->sc_rev >> 4) & 0xf, sc->sc_rev & 0xf);
@ -146,7 +148,7 @@ tlp_ap_attach(struct device *parent, struct device *self, void *aux)
sc->sc_sh = apa->apa_hwbase + TLP_AP_CSR;
sc->sc_dmat = apbus_dmatag_init(apa);
if (sc->sc_dmat == NULL) {
printf("%s: cannot allocate memory\n", sc->sc_dev.dv_xname);
aprint_error_dev(self, "cannot allocate memory\n");
return;
}
@ -202,7 +204,7 @@ tlp_ap_attach(struct device *parent, struct device *self, void *aux)
TULIP_WRITE(sc, CSR_GPP, 0xcf); /* mask abort/DMA err */
if (tlp_read_srom(sc) == 0) {
printf("%s: srom read failed\n", sc->sc_dev.dv_xname);
aprint_error_dev(self, "srom read failed\n");
free(sc->sc_dmat, M_DEVBUF);
return;
}