pci_activate() expects for its void * argument to be a device_t,

so change the type of the argument to device_t.  Update each use
of pci_activate().

Use device_t and accessors.  Use aprint_*_dev().
This commit is contained in:
dyoung 2008-03-21 07:47:43 +00:00
parent 45361f4c9c
commit 8ce2158b0c
22 changed files with 229 additions and 235 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: ahd_pci.c,v 1.25 2006/11/16 01:33:08 christos Exp $ */
/* $NetBSD: ahd_pci.c,v 1.26 2008/03/21 07:47:43 dyoung Exp $ */
/*
* Product specific probe and attach routines for:
@ -49,7 +49,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ahd_pci.c,v 1.25 2006/11/16 01:33:08 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: ahd_pci.c,v 1.26 2008/03/21 07:47:43 dyoung Exp $");
#define AHD_PCI_IOADDR PCI_MAPREG_START /* I/O Address */
#define AHD_PCI_MEMADDR (PCI_MAPREG_START + 4) /* Mem I/O Address */
@ -286,8 +286,7 @@ ahd_find_pci_device(pcireg_t id, pcireg_t subid)
}
static int
ahd_pci_probe(struct device *parent, struct cfdata *match,
void *aux)
ahd_pci_probe(device_t parent, struct cfdata *match, void *aux)
{
struct pci_attach_args *pa = aux;
const struct ahd_pci_identity *entry;
@ -299,10 +298,10 @@ ahd_pci_probe(struct device *parent, struct cfdata *match,
}
static void
ahd_pci_attach(struct device *parent, struct device *self, void *aux)
ahd_pci_attach(device_t parent, device_t self, void *aux)
{
struct pci_attach_args *pa = aux;
struct ahd_softc *ahd = (void *)self;
struct ahd_softc *ahd = device_private(self);
const struct ahd_pci_identity *entry;
@ -480,7 +479,7 @@ ahd_pci_attach(struct device *parent, struct device *self, void *aux)
aprint_naive("\n");
/* power up chip */
if ((error = pci_activate(pa->pa_pc, pa->pa_tag, ahd,
if ((error = pci_activate(pa->pa_pc, pa->pa_tag, self,
pci_activate_null)) && error != EOPNOTSUPP) {
aprint_error("%s: cannot activate %d\n", ahd->sc_dev.dv_xname,
error);

View File

@ -1,4 +1,4 @@
/* $NetBSD: auixp.c,v 1.26 2008/02/29 06:13:39 dyoung Exp $ */
/* $NetBSD: auixp.c,v 1.27 2008/03/21 07:47:43 dyoung Exp $ */
/*
* Copyright (c) 2004, 2005 Reinoud Zandijk <reinoud@netbsd.org>
@ -50,7 +50,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: auixp.c,v 1.26 2008/02/29 06:13:39 dyoung Exp $");
__KERNEL_RCSID(0, "$NetBSD: auixp.c,v 1.27 2008/03/21 07:47:43 dyoung Exp $");
#include <sys/types.h>
#include <sys/errno.h>
@ -130,9 +130,9 @@ struct audio_device auixp_device = {
/* autoconfig */
static int auixp_match( struct device *, struct cfdata *, void *);
static void auixp_attach(struct device *, struct device *, void *);
static int auixp_detach(struct device *, int);
static int auixp_match(device_t, struct cfdata *, void *);
static void auixp_attach(device_t, device_t, void *);
static int auixp_detach(device_t, int);
/* audio(9) function prototypes */
@ -167,7 +167,7 @@ static paddr_t auixp_mappage(void *, void *, off_t, int);
/* Supporting subroutines */
static int auixp_init(struct auixp_softc *);
static void auixp_autodetect_codecs(struct auixp_softc *);
static void auixp_post_config(struct device *);
static void auixp_post_config(device_t);
static void auixp_reset_aclink(struct auixp_softc *);
static int auixp_attach_codec(void *, struct ac97_codec_if *);
@ -1067,8 +1067,7 @@ auixp_mappage(void *hdl, void *mem, off_t off, int prot)
/* Is it my hardware? */
static int
auixp_match(struct device *dev, struct cfdata *match,
void *aux)
auixp_match(device_t dev, struct cfdata *match, void *aux)
{
struct pci_attach_args *pa;
@ -1089,7 +1088,7 @@ auixp_match(struct device *dev, struct cfdata *match,
/* it is... now hook up and set up the resources we need */
static void
auixp_attach(struct device *parent, struct device *self, void *aux)
auixp_attach(device_t parent, device_t self, void *aux)
{
struct auixp_softc *sc;
struct pci_attach_args *pa;
@ -1102,7 +1101,7 @@ auixp_attach(struct device *parent, struct device *self, void *aux)
char devinfo[256];
int revision, error;
sc = (struct auixp_softc *)self;
sc = device_private(self);
pa = (struct pci_attach_args *)aux;
tag = pa->pa_tag;
pc = pa->pa_pc;
@ -1181,7 +1180,7 @@ auixp_attach(struct device *parent, struct device *self, void *aux)
aprint_normal("%s: interrupting at %s\n", sc->sc_dev.dv_xname, intrstr);
/* power up chip */
if ((error = pci_activate(pa->pa_pc, pa->pa_tag, sc,
if ((error = pci_activate(pa->pa_pc, pa->pa_tag, self,
pci_activate_null)) && error != EOPNOTSUPP) {
aprint_error("%s: cannot activate %d\n", sc->sc_dev.dv_xname,
error);
@ -1208,14 +1207,14 @@ auixp_attach(struct device *parent, struct device *self, void *aux)
/* called from autoconfigure system when interrupts are enabled */
static void
auixp_post_config(struct device *self)
auixp_post_config(device_t self)
{
struct auixp_softc *sc;
struct auixp_codec *codec;
int codec_nr;
int res, i;
sc = (struct auixp_softc *)self;
sc = device_private(self);
/* detect the AC97 codecs */
auixp_autodetect_codecs(sc);
@ -1347,11 +1346,11 @@ auixp_disable_interrupts(struct auixp_softc *sc)
/* dismantle what we've set up by undoing setup */
static int
auixp_detach(struct device *self, int flags)
auixp_detach(device_t self, int flags)
{
struct auixp_softc *sc;
sc = (struct auixp_softc *)self;
sc = device_private(self);
/* XXX shouldn't we just reset the chip? XXX */
/*
* should we explicitly disable interrupt generation and acknowledge

View File

@ -1,4 +1,4 @@
/* $NetBSD: cs4280.c,v 1.49 2008/02/29 06:13:39 dyoung Exp $ */
/* $NetBSD: cs4280.c,v 1.50 2008/03/21 07:47:43 dyoung Exp $ */
/*
* Copyright (c) 1999, 2000 Tatoku Ogaito. All rights reserved.
@ -52,7 +52,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: cs4280.c,v 1.49 2008/02/29 06:13:39 dyoung Exp $");
__KERNEL_RCSID(0, "$NetBSD: cs4280.c,v 1.50 2008/03/21 07:47:43 dyoung Exp $");
#include "midi.h"
@ -287,7 +287,7 @@ cs4280_attach(struct device *parent, struct device *self, void *aux)
sc->sc_dmatag = pa->pa_dmat;
/* power up chip */
if ((error = pci_activate(pa->pa_pc, pa->pa_tag, sc,
if ((error = pci_activate(pa->pa_pc, pa->pa_tag, self,
pci_activate_null)) && error != EOPNOTSUPP) {
aprint_error("%s: cannot activate %d\n", sc->sc_dev.dv_xname,
error);

View File

@ -1,4 +1,4 @@
/* $NetBSD: cs4281.c,v 1.37 2008/02/29 06:13:39 dyoung Exp $ */
/* $NetBSD: cs4281.c,v 1.38 2008/03/21 07:47:43 dyoung Exp $ */
/*
* Copyright (c) 2000 Tatoku Ogaito. All rights reserved.
@ -43,7 +43,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: cs4281.c,v 1.37 2008/02/29 06:13:39 dyoung Exp $");
__KERNEL_RCSID(0, "$NetBSD: cs4281.c,v 1.38 2008/03/21 07:47:43 dyoung Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -221,7 +221,7 @@ cs4281_attach(struct device *parent, struct device *self, void *aux)
sc->sc_dmatag = pa->pa_dmat;
/* power up chip */
if ((error = pci_activate(pa->pa_pc, pa->pa_tag, sc,
if ((error = pci_activate(pa->pa_pc, pa->pa_tag, self,
pci_activate_null)) && error != EOPNOTSUPP) {
aprint_error("%s: cannot activate %d\n", sc->sc_dev.dv_xname,
error);

View File

@ -1,4 +1,4 @@
/* $NetBSD: esa.c,v 1.45 2008/02/22 22:19:36 dyoung Exp $ */
/* $NetBSD: esa.c,v 1.46 2008/03/21 07:47:43 dyoung Exp $ */
/*
* Copyright (c) 2001, 2002, 2006 Jared D. McNeill <jmcneill@invisible.ca>
@ -39,7 +39,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: esa.c,v 1.45 2008/02/22 22:19:36 dyoung Exp $");
__KERNEL_RCSID(0, "$NetBSD: esa.c,v 1.46 2008/03/21 07:47:43 dyoung Exp $");
#include <sys/types.h>
#include <sys/errno.h>
@ -1005,7 +1005,7 @@ esa_attach(device_t parent, device_t self, void *aux)
int i;
int error;
sc = (struct esa_softc *)self;
sc = device_private(self);
pa = (struct pci_attach_args *)aux;
tag = pa->pa_tag;
pc = pa->pa_pc;
@ -1059,7 +1059,7 @@ esa_attach(device_t parent, device_t self, void *aux)
aprint_normal("%s: interrupting at %s\n", sc->sc_dev.dv_xname, intrstr);
/* power up chip */
if ((error = pci_activate(pa->pa_pc, pa->pa_tag, sc,
if ((error = pci_activate(pa->pa_pc, pa->pa_tag, self,
pci_activate_null)) && error != EOPNOTSUPP) {
aprint_error("%s: cannot activate %d\n", sc->sc_dev.dv_xname,
error);

View File

@ -1,4 +1,4 @@
/* $NetBSD: esm.c,v 1.45 2008/02/23 02:17:16 dyoung Exp $ */
/* $NetBSD: esm.c,v 1.46 2008/03/21 07:47:43 dyoung Exp $ */
/*-
* Copyright (c) 2002, 2003 Matt Fredette
@ -66,7 +66,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: esm.c,v 1.45 2008/02/23 02:17:16 dyoung Exp $");
__KERNEL_RCSID(0, "$NetBSD: esm.c,v 1.46 2008/03/21 07:47:43 dyoung Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -1659,7 +1659,7 @@ esm_attach(device_t parent, device_t self, void *aux)
*/
/* power up chip */
if ((error = pci_activate(pa->pa_pc, pa->pa_tag, ess,
if ((error = pci_activate(pa->pa_pc, pa->pa_tag, self,
pci_activate_null)) && error != EOPNOTSUPP) {
aprint_error("%s: cannot activate %d\n", ess->sc_dev.dv_xname,
error);

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_atw_pci.c,v 1.16 2008/03/07 22:05:47 dyoung Exp $ */
/* $NetBSD: if_atw_pci.c,v 1.17 2008/03/21 07:47:43 dyoung Exp $ */
/*-
* Copyright (c) 1998, 1999, 2000, 2002 The NetBSD Foundation, Inc.
@ -44,7 +44,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: if_atw_pci.c,v 1.16 2008/03/07 22:05:47 dyoung Exp $");
__KERNEL_RCSID(0, "$NetBSD: if_atw_pci.c,v 1.17 2008/03/21 07:47:43 dyoung Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -202,7 +202,7 @@ atw_pci_attach(device_t parent, device_t self, void *aux)
(sc->sc_rev >> 4) & 0xf, sc->sc_rev & 0xf);
/* power up chip */
if ((error = pci_activate(pa->pa_pc, pa->pa_tag, sc,
if ((error = pci_activate(pa->pa_pc, pa->pa_tag, self,
NULL)) && error != EOPNOTSUPP) {
aprint_error("%s: cannot activate %d\n", sc->sc_dev.dv_xname,
error);

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_epic_pci.c,v 1.33 2007/10/19 12:00:45 ad Exp $ */
/* $NetBSD: if_epic_pci.c,v 1.34 2008/03/21 07:47:43 dyoung Exp $ */
/*-
* Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
@ -43,7 +43,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: if_epic_pci.c,v 1.33 2007/10/19 12:00:45 ad Exp $");
__KERNEL_RCSID(0, "$NetBSD: if_epic_pci.c,v 1.34 2008/03/21 07:47:43 dyoung Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -146,8 +146,7 @@ epic_pci_subsys_lookup(const struct pci_attach_args *pa)
}
static int
epic_pci_match(struct device *parent, struct cfdata *match,
void *aux)
epic_pci_match(device_t parent, struct cfdata *match, void *aux)
{
struct pci_attach_args *pa = aux;
@ -158,9 +157,9 @@ epic_pci_match(struct device *parent, struct cfdata *match,
}
static void
epic_pci_attach(struct device *parent, struct device *self, void *aux)
epic_pci_attach(device_t parent, device_t self, void *aux)
{
struct epic_pci_softc *psc = (struct epic_pci_softc *)self;
struct epic_pci_softc *psc = device_private(self);
struct epic_softc *sc = &psc->sc_epic;
struct pci_attach_args *pa = aux;
pci_chipset_tag_t pc = pa->pa_pc;
@ -185,7 +184,7 @@ epic_pci_attach(struct device *parent, struct device *self, void *aux)
PCI_REVISION(pa->pa_class));
/* power up chip */
if ((error = pci_activate(pa->pa_pc, pa->pa_tag, sc,
if ((error = pci_activate(pa->pa_pc, pa->pa_tag, self,
NULL)) && error != EOPNOTSUPP) {
aprint_error("%s: cannot activate %d\n", sc->sc_dev.dv_xname,
error);

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_ex_pci.c,v 1.44 2007/10/19 12:00:45 ad Exp $ */
/* $NetBSD: if_ex_pci.c,v 1.45 2008/03/21 07:47:43 dyoung Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@ -38,7 +38,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: if_ex_pci.c,v 1.44 2007/10/19 12:00:45 ad Exp $");
__KERNEL_RCSID(0, "$NetBSD: if_ex_pci.c,v 1.45 2008/03/21 07:47:43 dyoung Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -106,7 +106,7 @@ static int ex_pci_enable(struct ex_softc *);
static void ex_pci_disable(struct ex_softc *);
static void ex_pci_confreg_restore(struct ex_pci_softc *);
static int ex_d3tod0(pci_chipset_tag_t, pcitag_t, void *, pcireg_t);
static int ex_d3tod0(pci_chipset_tag_t, pcitag_t, device_t, pcireg_t);
CFATTACH_DECL(ex_pci, sizeof(struct ex_pci_softc),
ex_pci_match, ex_pci_attach, NULL, NULL);
@ -211,10 +211,10 @@ ex_pci_match(struct device *parent, struct cfdata *match,
}
static void
ex_pci_attach(struct device *parent, struct device *self, void *aux)
ex_pci_attach(device_t parent, device_t self, void *aux)
{
struct ex_softc *sc = (void *)self;
struct ex_pci_softc *psc = (void *)self;
struct ex_pci_softc *psc = device_private(self);
struct ex_softc *sc = &psc->sc_ex;
struct pci_attach_args *pa = aux;
pci_chipset_tag_t pc = pa->pa_pc;
pci_intr_handle_t ih;
@ -276,9 +276,9 @@ ex_pci_attach(struct device *parent, struct device *self, void *aux)
psc->psc_regs[PCI_INTERRUPT_REG>>2] =
pci_conf_read(pc, pa->pa_tag, PCI_INTERRUPT_REG);
/* power up chip */
switch ((error = pci_activate(pa->pa_pc, pa->pa_tag, sc, ex_d3tod0))) {
error = pci_activate(pa->pa_pc, pa->pa_tag, self, ex_d3tod0);
switch (error) {
case EOPNOTSUPP:
break;
case 0:
@ -331,7 +331,7 @@ ex_pci_intr_ack(struct ex_softc *sc)
}
static int
ex_d3tod0(pci_chipset_tag_t pc, pcitag_t tag, void *ssc, pcireg_t state)
ex_d3tod0(pci_chipset_tag_t pc, pcitag_t tag, device_t self, pcireg_t state)
{
#define PCI_CACHE_LAT_BIST 0x0c
@ -350,7 +350,7 @@ ex_d3tod0(pci_chipset_tag_t pc, pcitag_t tag, void *ssc, pcireg_t state)
u_int32_t pci_command;
u_int32_t pci_int_lat;
u_int32_t pci_cache_lat;
struct ex_softc *sc = ssc;
struct ex_softc *sc = device_private(self);
if (state != PCI_PMCSR_STATE_D3)
return 0;

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_fxp_pci.c,v 1.56 2008/02/29 06:13:39 dyoung Exp $ */
/* $NetBSD: if_fxp_pci.c,v 1.57 2008/03/21 07:47:43 dyoung Exp $ */
/*-
* Copyright (c) 1997, 1998, 1999, 2000, 2001 The NetBSD Foundation, Inc.
@ -43,7 +43,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: if_fxp_pci.c,v 1.56 2008/02/29 06:13:39 dyoung Exp $");
__KERNEL_RCSID(0, "$NetBSD: if_fxp_pci.c,v 1.57 2008/03/21 07:47:43 dyoung Exp $");
#include "rnd.h"
@ -182,8 +182,7 @@ fxp_pci_lookup(const struct pci_attach_args *pa)
}
static int
fxp_pci_match(struct device *parent, struct cfdata *match,
void *aux)
fxp_pci_match(device_t parent, struct cfdata *match, void *aux)
{
struct pci_attach_args *pa = aux;
@ -252,10 +251,10 @@ fxp_pci_resume(device_t dv PMF_FN_ARGS)
}
static void
fxp_pci_attach(struct device *parent, struct device *self, void *aux)
fxp_pci_attach(device_t parent, device_t self, void *aux)
{
struct fxp_pci_softc *psc = (struct fxp_pci_softc *)self;
struct fxp_softc *sc = (struct fxp_softc *)self;
struct fxp_pci_softc *psc = device_private(self);
struct fxp_softc *sc = &psc->psc_fxp;
struct pci_attach_args *pa = aux;
pci_chipset_tag_t pc = pa->pa_pc;
pci_intr_handle_t ih;
@ -452,7 +451,7 @@ fxp_pci_attach(struct device *parent, struct device *self, void *aux)
pci_conf_read(pc, pa->pa_tag, PCI_MAPREG_START+0x8);
/* power up chip */
switch ((error = pci_activate(pa->pa_pc, pa->pa_tag, sc,
switch ((error = pci_activate(pa->pa_pc, pa->pa_tag, self,
pci_activate_null))) {
case EOPNOTSUPP:
break;

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_iwi.c,v 1.71 2008/03/11 20:41:35 dyoung Exp $ */
/* $NetBSD: if_iwi.c,v 1.72 2008/03/21 07:47:43 dyoung Exp $ */
/*-
* Copyright (c) 2004, 2005
@ -28,7 +28,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: if_iwi.c,v 1.71 2008/03/11 20:41:35 dyoung Exp $");
__KERNEL_RCSID(0, "$NetBSD: if_iwi.c,v 1.72 2008/03/21 07:47:43 dyoung Exp $");
/*-
* Intel(R) PRO/Wireless 2200BG/2225BG/2915ABG driver
@ -232,7 +232,7 @@ iwi_attach(device_t parent, device_t self, void *aux)
sc->sc_unr = 0;
/* power up chip */
if ((error = pci_activate(pa->pa_pc, pa->pa_tag, sc,
if ((error = pci_activate(pa->pa_pc, pa->pa_tag, self,
NULL)) && error != EOPNOTSUPP) {
aprint_error_dev(self, "cannot activate %d\n", error);
return;

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_pcn.c,v 1.44 2008/03/11 23:58:06 dyoung Exp $ */
/* $NetBSD: if_pcn.c,v 1.45 2008/03/21 07:47:43 dyoung Exp $ */
/*
* Copyright (c) 2001 Wasabi Systems, Inc.
@ -65,7 +65,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: if_pcn.c,v 1.44 2008/03/11 23:58:06 dyoung Exp $");
__KERNEL_RCSID(0, "$NetBSD: if_pcn.c,v 1.45 2008/03/21 07:47:43 dyoung Exp $");
#include "bpfilter.h"
#include "rnd.h"
@ -544,7 +544,7 @@ pcn_lookup_variant(uint16_t chipid)
}
static int
pcn_match(struct device *parent, struct cfdata *cf, void *aux)
pcn_match(device_t parent, struct cfdata *cf, void *aux)
{
struct pci_attach_args *pa = aux;
@ -573,9 +573,9 @@ pcn_match(struct device *parent, struct cfdata *cf, void *aux)
}
static void
pcn_attach(struct device *parent, struct device *self, void *aux)
pcn_attach(device_t parent, device_t self, void *aux)
{
struct pcn_softc *sc = (struct pcn_softc *) self;
struct pcn_softc *sc = device_private(self);
struct pci_attach_args *pa = aux;
struct ifnet *ifp = &sc->sc_ethercom.ec_if;
pci_chipset_tag_t pc = pa->pa_pc;
@ -624,7 +624,7 @@ pcn_attach(struct device *parent, struct device *self, void *aux)
PCI_COMMAND_MASTER_ENABLE);
/* power up chip */
if ((error = pci_activate(pa->pa_pc, pa->pa_tag, sc,
if ((error = pci_activate(pa->pa_pc, pa->pa_tag, self,
NULL)) && error != EOPNOTSUPP) {
aprint_error("%s: cannot activate %d\n", sc->sc_dev.dv_xname,
error);
@ -2164,9 +2164,9 @@ pcn_79c971_mediainit(struct pcn_softc *sc)
* Read a PHY register on the MII.
*/
static int
pcn_mii_readreg(struct device *self, int phy, int reg)
pcn_mii_readreg(device_t self, int phy, int reg)
{
struct pcn_softc *sc = (void *) self;
struct pcn_softc *sc = device_private(self);
uint32_t rv;
pcn_bcr_write(sc, LE_BCR33, reg | (phy << PHYAD_SHIFT));
@ -2183,9 +2183,9 @@ pcn_mii_readreg(struct device *self, int phy, int reg)
* Write a PHY register on the MII.
*/
static void
pcn_mii_writereg(struct device *self, int phy, int reg, int val)
pcn_mii_writereg(device_t self, int phy, int reg, int val)
{
struct pcn_softc *sc = (void *) self;
struct pcn_softc *sc = device_private(self);
pcn_bcr_write(sc, LE_BCR33, reg | (phy << PHYAD_SHIFT));
pcn_bcr_write(sc, LE_BCR34, val);
@ -2197,9 +2197,9 @@ pcn_mii_writereg(struct device *self, int phy, int reg, int val)
* Callback from MII layer when media changes.
*/
static void
pcn_mii_statchg(struct device *self)
pcn_mii_statchg(device_t self)
{
struct pcn_softc *sc = (void *) self;
struct pcn_softc *sc = device_private(self);
if ((sc->sc_mii.mii_media_active & IFM_FDX) != 0)
pcn_bcr_write(sc, LE_BCR9, LE_B9_FDEN);

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_rtw_pci.c,v 1.10 2008/03/12 18:02:21 dyoung Exp $ */
/* $NetBSD: if_rtw_pci.c,v 1.11 2008/03/21 07:47:43 dyoung Exp $ */
/*-
* Copyright (c) 1998, 1999, 2000, 2002 The NetBSD Foundation, Inc.
@ -46,7 +46,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: if_rtw_pci.c,v 1.10 2008/03/12 18:02:21 dyoung Exp $");
__KERNEL_RCSID(0, "$NetBSD: if_rtw_pci.c,v 1.11 2008/03/21 07:47:43 dyoung Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -203,7 +203,7 @@ rtw_pci_attach(device_t parent, device_t self, void *aux)
(sc->sc_rev >> 4) & 0xf, sc->sc_rev & 0xf);
/* power up chip */
if ((error = pci_activate(pa->pa_pc, pa->pa_tag, sc, NULL)) != 0 &&
if ((error = pci_activate(pa->pa_pc, pa->pa_tag, self, NULL)) != 0 &&
error != EOPNOTSUPP) {
aprint_error_dev(self, "cannot activate %d\n", error);
return;

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_sf_pci.c,v 1.13 2007/10/19 12:00:47 ad Exp $ */
/* $NetBSD: if_sf_pci.c,v 1.14 2008/03/21 07:47:43 dyoung Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@ -42,7 +42,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: if_sf_pci.c,v 1.13 2007/10/19 12:00:47 ad Exp $");
__KERNEL_RCSID(0, "$NetBSD: if_sf_pci.c,v 1.14 2008/03/21 07:47:43 dyoung Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -78,8 +78,8 @@ struct sf_pci_softc {
void *sc_ih; /* interrupt handle */
};
static int sf_pci_match(struct device *, struct cfdata *, void *);
static void sf_pci_attach(struct device *, struct device *, void *);
static int sf_pci_match(device_t, struct cfdata *, void *);
static void sf_pci_attach(device_t, device_t, void *);
CFATTACH_DECL(sf_pci, sizeof(struct sf_pci_softc),
sf_pci_match, sf_pci_attach, NULL, NULL);
@ -160,8 +160,7 @@ sf_pci_lookup(const struct pci_attach_args *pa)
}
static int
sf_pci_match(struct device *parent, struct cfdata *match,
void *aux)
sf_pci_match(device_t parent, struct cfdata *match, void *aux)
{
struct pci_attach_args *pa = aux;
@ -172,9 +171,9 @@ sf_pci_match(struct device *parent, struct cfdata *match,
}
static void
sf_pci_attach(struct device *parent, struct device *self, void *aux)
sf_pci_attach(device_t parent, device_t self, void *aux)
{
struct sf_pci_softc *psc = (void *) self;
struct sf_pci_softc *psc = device_private(self);
struct sf_softc *sc = &psc->sc_starfire;
struct pci_attach_args *pa = aux;
pci_intr_handle_t ih;
@ -194,8 +193,8 @@ sf_pci_attach(struct device *parent, struct device *self, void *aux)
printf(": %s, rev. %d\n", spp->spp_name, PCI_REVISION(pa->pa_class));
/* power up chip */
if ((error = pci_activate(pa->pa_pc, pa->pa_tag, sc,
NULL)) && error != EOPNOTSUPP) {
if ((error = pci_activate(pa->pa_pc, pa->pa_tag, self, NULL)) &&
error != EOPNOTSUPP) {
aprint_error("%s: cannot activate %d\n", sc->sc_dev.dv_xname,
error);
return;

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_sip.c,v 1.130 2008/03/12 18:02:21 dyoung Exp $ */
/* $NetBSD: if_sip.c,v 1.131 2008/03/21 07:47:43 dyoung Exp $ */
/*-
* Copyright (c) 2001, 2002 The NetBSD Foundation, Inc.
@ -80,7 +80,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: if_sip.c,v 1.130 2008/03/12 18:02:21 dyoung Exp $");
__KERNEL_RCSID(0, "$NetBSD: if_sip.c,v 1.131 2008/03/21 07:47:43 dyoung Exp $");
#include "bpfilter.h"
#include "rnd.h"
@ -1095,8 +1095,8 @@ sipcom_attach(device_t parent, device_t self, void *aux)
pmreg | PCI_COMMAND_MASTER_ENABLE);
/* power up chip */
if ((error = pci_activate(pa->pa_pc, pa->pa_tag, sc,
NULL)) && error != EOPNOTSUPP) {
if ((error = pci_activate(pa->pa_pc, pa->pa_tag, self, NULL)) &&
error != EOPNOTSUPP) {
aprint_error("%s: cannot activate %d\n", sc->sc_dev.dv_xname,
error);
return;

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_ste.c,v 1.33 2008/03/11 23:58:06 dyoung Exp $ */
/* $NetBSD: if_ste.c,v 1.34 2008/03/21 07:47:43 dyoung Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@ -42,7 +42,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: if_ste.c,v 1.33 2008/03/11 23:58:06 dyoung Exp $");
__KERNEL_RCSID(0, "$NetBSD: if_ste.c,v 1.34 2008/03/21 07:47:43 dyoung Exp $");
#include "bpfilter.h"
@ -228,20 +228,20 @@ static int ste_intr(void *);
static void ste_txintr(struct ste_softc *);
static void ste_rxintr(struct ste_softc *);
static int ste_mii_readreg(struct device *, int, int);
static void ste_mii_writereg(struct device *, int, int, int);
static void ste_mii_statchg(struct device *);
static int ste_mii_readreg(device_t, int, int);
static void ste_mii_writereg(device_t, int, int, int);
static void ste_mii_statchg(device_t);
static int ste_match(struct device *, struct cfdata *, void *);
static void ste_attach(struct device *, struct device *, void *);
static int ste_match(device_t, struct cfdata *, void *);
static void ste_attach(device_t, device_t, void *);
int ste_copy_small = 0;
CFATTACH_DECL(ste, sizeof(struct ste_softc),
ste_match, ste_attach, NULL, NULL);
static uint32_t ste_mii_bitbang_read(struct device *);
static void ste_mii_bitbang_write(struct device *, uint32_t);
static uint32_t ste_mii_bitbang_read(device_t);
static void ste_mii_bitbang_write(device_t, uint32_t);
static const struct mii_bitbang_ops ste_mii_bitbang_ops = {
ste_mii_bitbang_read,
@ -290,7 +290,7 @@ ste_lookup(const struct pci_attach_args *pa)
}
static int
ste_match(struct device *parent, struct cfdata *cf, void *aux)
ste_match(device_t parent, struct cfdata *cf, void *aux)
{
struct pci_attach_args *pa = aux;
@ -301,9 +301,9 @@ ste_match(struct device *parent, struct cfdata *cf, void *aux)
}
static void
ste_attach(struct device *parent, struct device *self, void *aux)
ste_attach(device_t parent, device_t self, void *aux)
{
struct ste_softc *sc = (struct ste_softc *) self;
struct ste_softc *sc = device_private(self);
struct pci_attach_args *pa = aux;
struct ifnet *ifp = &sc->sc_ethercom.ec_if;
pci_chipset_tag_t pc = pa->pa_pc;
@ -358,7 +358,7 @@ ste_attach(struct device *parent, struct device *self, void *aux)
PCI_COMMAND_MASTER_ENABLE);
/* power up chip */
if ((error = pci_activate(pa->pa_pc, pa->pa_tag, sc,
if ((error = pci_activate(pa->pa_pc, pa->pa_tag, self,
NULL)) && error != EOPNOTSUPP) {
aprint_error("%s: cannot activate %d\n", sc->sc_dev.dv_xname,
error);
@ -1609,7 +1609,7 @@ ste_set_filter(struct ste_softc *sc)
* Read a PHY register on the MII of the ST-201.
*/
static int
ste_mii_readreg(struct device *self, int phy, int reg)
ste_mii_readreg(device_t self, int phy, int reg)
{
return (mii_bitbang_readreg(self, &ste_mii_bitbang_ops, phy, reg));
@ -1621,7 +1621,7 @@ ste_mii_readreg(struct device *self, int phy, int reg)
* Write a PHY register on the MII of the ST-201.
*/
static void
ste_mii_writereg(struct device *self, int phy, int reg, int val)
ste_mii_writereg(device_t self, int phy, int reg, int val)
{
mii_bitbang_writereg(self, &ste_mii_bitbang_ops, phy, reg, val);
@ -1633,9 +1633,9 @@ ste_mii_writereg(struct device *self, int phy, int reg, int val)
* Callback from MII layer when media changes.
*/
static void
ste_mii_statchg(struct device *self)
ste_mii_statchg(device_t self)
{
struct ste_softc *sc = (struct ste_softc *) self;
struct ste_softc *sc = device_private(self);
if (sc->sc_mii.mii_media_active & IFM_FDX)
sc->sc_MacCtrl0 |= MC0_FullDuplexEnable;
@ -1653,9 +1653,9 @@ ste_mii_statchg(struct device *self)
* Read the MII serial port for the MII bit-bang module.
*/
static uint32_t
ste_mii_bitbang_read(struct device *self)
ste_mii_bitbang_read(device_t self)
{
struct ste_softc *sc = (void *) self;
struct ste_softc *sc = device_private(self);
return (bus_space_read_1(sc->sc_st, sc->sc_sh, STE_PhyCtrl));
}
@ -1666,9 +1666,9 @@ ste_mii_bitbang_read(struct device *self)
* Write the MII serial port for the MII bit-bang module.
*/
static void
ste_mii_bitbang_write(struct device *self, uint32_t val)
ste_mii_bitbang_write(device_t self, uint32_t val)
{
struct ste_softc *sc = (void *) self;
struct ste_softc *sc = device_private(self);
bus_space_write_1(sc->sc_st, sc->sc_sh, STE_PhyCtrl, val);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_stge.c,v 1.42 2008/03/11 23:58:06 dyoung Exp $ */
/* $NetBSD: if_stge.c,v 1.43 2008/03/21 07:47:43 dyoung Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@ -42,7 +42,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: if_stge.c,v 1.42 2008/03/11 23:58:06 dyoung Exp $");
__KERNEL_RCSID(0, "$NetBSD: if_stge.c,v 1.43 2008/03/21 07:47:43 dyoung Exp $");
#include "bpfilter.h"
@ -289,20 +289,20 @@ static int stge_intr(void *);
static void stge_txintr(struct stge_softc *);
static void stge_rxintr(struct stge_softc *);
static int stge_mii_readreg(struct device *, int, int);
static void stge_mii_writereg(struct device *, int, int, int);
static void stge_mii_statchg(struct device *);
static int stge_mii_readreg(device_t, int, int);
static void stge_mii_writereg(device_t, int, int, int);
static void stge_mii_statchg(device_t);
static int stge_match(struct device *, struct cfdata *, void *);
static void stge_attach(struct device *, struct device *, void *);
static int stge_match(device_t, struct cfdata *, void *);
static void stge_attach(device_t, device_t, void *);
int stge_copy_small = 0;
CFATTACH_DECL(stge, sizeof(struct stge_softc),
stge_match, stge_attach, NULL, NULL);
static uint32_t stge_mii_bitbang_read(struct device *);
static void stge_mii_bitbang_write(struct device *, uint32_t);
static uint32_t stge_mii_bitbang_read(device_t);
static void stge_mii_bitbang_write(device_t, uint32_t);
static const struct mii_bitbang_ops stge_mii_bitbang_ops = {
stge_mii_bitbang_read,
@ -370,8 +370,7 @@ stge_lookup(const struct pci_attach_args *pa)
}
static int
stge_match(struct device *parent, struct cfdata *cf,
void *aux)
stge_match(device_t parent, struct cfdata *cf, void *aux)
{
struct pci_attach_args *pa = aux;
@ -382,9 +381,9 @@ stge_match(struct device *parent, struct cfdata *cf,
}
static void
stge_attach(struct device *parent, struct device *self, void *aux)
stge_attach(device_t parent, device_t self, void *aux)
{
struct stge_softc *sc = (struct stge_softc *) self;
struct stge_softc *sc = device_private(self);
struct pci_attach_args *pa = aux;
struct ifnet *ifp = &sc->sc_ethercom.ec_if;
pci_chipset_tag_t pc = pa->pa_pc;
@ -440,8 +439,8 @@ stge_attach(struct device *parent, struct device *self, void *aux)
PCI_COMMAND_MASTER_ENABLE);
/* power up chip */
if ((error = pci_activate(pa->pa_pc, pa->pa_tag, sc,
NULL)) && error != EOPNOTSUPP) {
if ((error = pci_activate(pa->pa_pc, pa->pa_tag, self, NULL)) &&
error != EOPNOTSUPP) {
aprint_error("%s: cannot activate %d\n", sc->sc_dev.dv_xname,
error);
return;
@ -1931,7 +1930,7 @@ stge_set_filter(struct stge_softc *sc)
* Read a PHY register on the MII of the TC9021.
*/
static int
stge_mii_readreg(struct device *self, int phy, int reg)
stge_mii_readreg(device_t self, int phy, int reg)
{
return (mii_bitbang_readreg(self, &stge_mii_bitbang_ops, phy, reg));
@ -1943,7 +1942,7 @@ stge_mii_readreg(struct device *self, int phy, int reg)
* Write a PHY register on the MII of the TC9021.
*/
static void
stge_mii_writereg(struct device *self, int phy, int reg, int val)
stge_mii_writereg(device_t self, int phy, int reg, int val)
{
mii_bitbang_writereg(self, &stge_mii_bitbang_ops, phy, reg, val);
@ -1955,9 +1954,9 @@ stge_mii_writereg(struct device *self, int phy, int reg, int val)
* Callback from MII layer when media changes.
*/
static void
stge_mii_statchg(struct device *self)
stge_mii_statchg(device_t self)
{
struct stge_softc *sc = (struct stge_softc *) self;
struct stge_softc *sc = device_private(self);
if (sc->sc_mii.mii_media_active & IFM_FDX)
sc->sc_MACCtrl |= MC_DuplexSelect;
@ -1975,9 +1974,9 @@ stge_mii_statchg(struct device *self)
* Read the MII serial port for the MII bit-bang module.
*/
static uint32_t
stge_mii_bitbang_read(struct device *self)
stge_mii_bitbang_read(device_t self)
{
struct stge_softc *sc = (void *) self;
struct stge_softc *sc = device_private(self);
return (bus_space_read_1(sc->sc_st, sc->sc_sh, STGE_PhyCtrl));
}
@ -1988,9 +1987,9 @@ stge_mii_bitbang_read(struct device *self)
* Write the MII serial port for the MII bit-bang module.
*/
static void
stge_mii_bitbang_write(struct device *self, uint32_t val)
stge_mii_bitbang_write(device_t self, uint32_t val)
{
struct stge_softc *sc = (void *) self;
struct stge_softc *sc = device_private(self);
bus_space_write_1(sc->sc_st, sc->sc_sh, STGE_PhyCtrl,
val | sc->sc_PhyCtrl);

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_tlp_pci.c,v 1.102 2007/10/19 12:00:49 ad Exp $ */
/* $NetBSD: if_tlp_pci.c,v 1.103 2008/03/21 07:47:43 dyoung Exp $ */
/*-
* Copyright (c) 1998, 1999, 2000, 2002 The NetBSD Foundation, Inc.
@ -43,7 +43,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: if_tlp_pci.c,v 1.102 2007/10/19 12:00:49 ad Exp $");
__KERNEL_RCSID(0, "$NetBSD: if_tlp_pci.c,v 1.103 2008/03/21 07:47:43 dyoung Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -112,8 +112,8 @@ struct tulip_pci_softc {
#define TULIP_PCI_SHAREDROM 0x04 /* ROM is shared */
#define TULIP_PCI_SLAVEROM 0x08 /* slave of shared ROM */
static int tlp_pci_match(struct device *, struct cfdata *, void *);
static void tlp_pci_attach(struct device *, struct device *, void *);
static int tlp_pci_match(device_t, struct cfdata *, void *);
static void tlp_pci_attach(device_t, device_t, void *);
CFATTACH_DECL(tlp_pci, sizeof(struct tulip_pci_softc),
tlp_pci_match, tlp_pci_attach, NULL, NULL);
@ -336,7 +336,7 @@ tlp_pci_check_slaved(struct tulip_pci_softc *psc, int shared, int slaved)
}
static int
tlp_pci_match(struct device *parent, struct cfdata *match, void *aux)
tlp_pci_match(device_t parent, struct cfdata *match, void *aux)
{
struct pci_attach_args *pa = aux;
@ -347,9 +347,9 @@ tlp_pci_match(struct device *parent, struct cfdata *match, void *aux)
}
static void
tlp_pci_attach(struct device *parent, struct device *self, void *aux)
tlp_pci_attach(device_t parent, device_t self, void *aux)
{
struct tulip_pci_softc *psc = (void *) self;
struct tulip_pci_softc *psc = device_private(self);
struct tulip_softc *sc = &psc->sc_tulip;
struct pci_attach_args *pa = aux;
pci_chipset_tag_t pc = pa->pa_pc;
@ -525,7 +525,7 @@ tlp_pci_attach(struct device *parent, struct device *self, void *aux)
}
/* power up chip */
if ((error = pci_activate(pa->pa_pc, pa->pa_tag, sc,
if ((error = pci_activate(pa->pa_pc, pa->pa_tag, self,
NULL)) && error != EOPNOTSUPP) {
aprint_error("%s: cannot activate %d\n", sc->sc_dev.dv_xname,
error);

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_vr.c,v 1.90 2008/03/11 23:58:06 dyoung Exp $ */
/* $NetBSD: if_vr.c,v 1.91 2008/03/21 07:47:43 dyoung Exp $ */
/*-
* Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
@ -104,7 +104,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: if_vr.c,v 1.90 2008/03/11 23:58:06 dyoung Exp $");
__KERNEL_RCSID(0, "$NetBSD: if_vr.c,v 1.91 2008/03/21 07:47:43 dyoung Exp $");
#include "rnd.h"
@ -324,13 +324,14 @@ static void vr_rxdrain(struct vr_softc *);
static void vr_watchdog(struct ifnet *);
static void vr_tick(void *);
static int vr_mii_readreg(struct device *, int, int);
static void vr_mii_writereg(struct device *, int, int, int);
static void vr_mii_statchg(struct device *);
static int vr_mii_readreg(device_t, int, int);
static void vr_mii_writereg(device_t, int, int, int);
static void vr_mii_statchg(device_t);
static void vr_setmulti(struct vr_softc *);
static void vr_reset(struct vr_softc *);
static int vr_restore_state(pci_chipset_tag_t, pcitag_t, void *, pcireg_t);
static int vr_restore_state(pci_chipset_tag_t, pcitag_t, device_t,
pcireg_t);
int vr_copy_small = 0;
@ -361,8 +362,8 @@ int vr_copy_small = 0;
/*
* MII bit-bang glue.
*/
static uint32_t vr_mii_bitbang_read(struct device *);
static void vr_mii_bitbang_write(struct device *, uint32_t);
static uint32_t vr_mii_bitbang_read(device_t);
static void vr_mii_bitbang_write(device_t, uint32_t);
static const struct mii_bitbang_ops vr_mii_bitbang_ops = {
vr_mii_bitbang_read,
@ -377,17 +378,17 @@ static const struct mii_bitbang_ops vr_mii_bitbang_ops = {
};
static uint32_t
vr_mii_bitbang_read(struct device *self)
vr_mii_bitbang_read(device_t self)
{
struct vr_softc *sc = (void *) self;
struct vr_softc *sc = device_private(self);
return (CSR_READ_1(sc, VR_MIICMD));
}
static void
vr_mii_bitbang_write(struct device *self, uint32_t val)
vr_mii_bitbang_write(device_t self, uint32_t val)
{
struct vr_softc *sc = (void *) self;
struct vr_softc *sc = device_private(self);
CSR_WRITE_1(sc, VR_MIICMD, (val & 0xff) | VR_MIICMD_DIRECTPGM);
}
@ -396,9 +397,9 @@ vr_mii_bitbang_write(struct device *self, uint32_t val)
* Read an PHY register through the MII.
*/
static int
vr_mii_readreg(struct device *self, int phy, int reg)
vr_mii_readreg(device_t self, int phy, int reg)
{
struct vr_softc *sc = (void *) self;
struct vr_softc *sc = device_private(self);
CSR_WRITE_1(sc, VR_MIICMD, VR_MIICMD_DIRECTPGM);
return (mii_bitbang_readreg(self, &vr_mii_bitbang_ops, phy, reg));
@ -408,18 +409,18 @@ vr_mii_readreg(struct device *self, int phy, int reg)
* Write to a PHY register through the MII.
*/
static void
vr_mii_writereg(struct device *self, int phy, int reg, int val)
vr_mii_writereg(device_t self, int phy, int reg, int val)
{
struct vr_softc *sc = (void *) self;
struct vr_softc *sc = device_private(self);
CSR_WRITE_1(sc, VR_MIICMD, VR_MIICMD_DIRECTPGM);
mii_bitbang_writereg(self, &vr_mii_bitbang_ops, phy, reg, val);
}
static void
vr_mii_statchg(struct device *self)
vr_mii_statchg(device_t self)
{
struct vr_softc *sc = (struct vr_softc *)self;
struct vr_softc *sc = device_private(self);
/*
* In order to fiddle with the 'full-duplex' bit in the netconfig
@ -1402,8 +1403,8 @@ vr_stop(struct ifnet *ifp, int disable)
vr_rxdrain(sc);
}
static int vr_probe(struct device *, struct cfdata *, void *);
static void vr_attach(struct device *, struct device *, void *);
static int vr_probe(device_t, struct cfdata *, void *);
static void vr_attach(device_t, device_t, void *);
static void vr_shutdown(void *);
CFATTACH_DECL(vr, sizeof (struct vr_softc),
@ -1423,8 +1424,7 @@ vr_lookup(struct pci_attach_args *pa)
}
static int
vr_probe(struct device *parent, struct cfdata *match,
void *aux)
vr_probe(device_t parent, struct cfdata *match, void *aux)
{
struct pci_attach_args *pa = (struct pci_attach_args *)aux;
@ -1451,9 +1451,9 @@ vr_shutdown(void *arg)
* setup and ethernet/BPF attach.
*/
static void
vr_attach(struct device *parent, struct device *self, void *aux)
vr_attach(device_t parent, device_t self, void *aux)
{
struct vr_softc *sc = (struct vr_softc *) self;
struct vr_softc *sc = device_private(self);
struct pci_attach_args *pa = (struct pci_attach_args *) aux;
bus_dma_segment_t seg;
struct vr_type *vrt;
@ -1486,7 +1486,7 @@ vr_attach(struct device *parent, struct device *self, void *aux)
sc->vr_save_irq = PCI_CONF_READ(PCI_INTERRUPT_REG);
/* power up chip */
if ((error = pci_activate(pa->pa_pc, pa->pa_tag, sc,
if ((error = pci_activate(pa->pa_pc, pa->pa_tag, self,
vr_restore_state)) && error != EOPNOTSUPP) {
aprint_error("%s: cannot activate %d\n", sc->vr_dev.dv_xname,
error);
@ -1753,9 +1753,10 @@ vr_attach(struct device *parent, struct device *self, void *aux)
}
static int
vr_restore_state(pci_chipset_tag_t pc, pcitag_t tag, void *ssc, pcireg_t state)
vr_restore_state(pci_chipset_tag_t pc, pcitag_t tag, device_t self,
pcireg_t state)
{
struct vr_softc *sc = ssc;
struct vr_softc *sc = device_private(self);
int error;
if (state == PCI_PMCSR_STATE_D0)

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_wm.c,v 1.156 2008/03/11 23:58:06 dyoung Exp $ */
/* $NetBSD: if_wm.c,v 1.157 2008/03/21 07:47:43 dyoung Exp $ */
/*
* Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@ -79,7 +79,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.156 2008/03/11 23:58:06 dyoung Exp $");
__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.157 2008/03/21 07:47:43 dyoung Exp $");
#include "bpfilter.h"
#include "rnd.h"
@ -544,16 +544,16 @@ static void wm_tbi_check_link(struct wm_softc *);
static void wm_gmii_reset(struct wm_softc *);
static int wm_gmii_i82543_readreg(struct device *, int, int);
static void wm_gmii_i82543_writereg(struct device *, int, int, int);
static int wm_gmii_i82543_readreg(device_t, int, int);
static void wm_gmii_i82543_writereg(device_t, int, int, int);
static int wm_gmii_i82544_readreg(struct device *, int, int);
static void wm_gmii_i82544_writereg(struct device *, int, int, int);
static int wm_gmii_i82544_readreg(device_t, int, int);
static void wm_gmii_i82544_writereg(device_t, int, int, int);
static int wm_gmii_i80003_readreg(struct device *, int, int);
static void wm_gmii_i80003_writereg(struct device *, int, int, int);
static int wm_gmii_i80003_readreg(device_t, int, int);
static void wm_gmii_i80003_writereg(device_t, int, int, int);
static void wm_gmii_statchg(struct device *);
static void wm_gmii_statchg(device_t);
static void wm_gmii_mediainit(struct wm_softc *);
static int wm_gmii_mediachange(struct ifnet *);
@ -562,8 +562,8 @@ static void wm_gmii_mediastatus(struct ifnet *, struct ifmediareq *);
static int wm_kmrn_i80003_readreg(struct wm_softc *, int);
static void wm_kmrn_i80003_writereg(struct wm_softc *, int, int);
static int wm_match(struct device *, struct cfdata *, void *);
static void wm_attach(struct device *, struct device *, void *);
static int wm_match(device_t, struct cfdata *, void *);
static void wm_attach(device_t, device_t, void *);
static int wm_is_onboard_nvm_eeprom(struct wm_softc *);
static void wm_get_auto_rd_done(struct wm_softc *);
static int wm_get_swsm_semaphore(struct wm_softc *);
@ -899,7 +899,7 @@ wm_lookup(const struct pci_attach_args *pa)
}
static int
wm_match(struct device *parent, struct cfdata *cf, void *aux)
wm_match(device_t parent, struct cfdata *cf, void *aux)
{
struct pci_attach_args *pa = aux;
@ -910,9 +910,9 @@ wm_match(struct device *parent, struct cfdata *cf, void *aux)
}
static void
wm_attach(struct device *parent, struct device *self, void *aux)
wm_attach(device_t parent, device_t self, void *aux)
{
struct wm_softc *sc = (void *) self;
struct wm_softc *sc = device_private(self);
struct pci_attach_args *pa = aux;
struct ifnet *ifp = &sc->sc_ethercom.ec_if;
pci_chipset_tag_t pc = pa->pa_pc;
@ -1034,7 +1034,7 @@ wm_attach(struct device *parent, struct device *self, void *aux)
pci_conf_write(pc, pa->pa_tag, PCI_COMMAND_STATUS_REG, preg);
/* power up chip */
if ((error = pci_activate(pa->pa_pc, pa->pa_tag, sc,
if ((error = pci_activate(pa->pa_pc, pa->pa_tag, self,
NULL)) && error != EOPNOTSUPP) {
aprint_error("%s: cannot activate %d\n", sc->sc_dev.dv_xname,
error);
@ -4474,9 +4474,9 @@ i82543_mii_recvbits(struct wm_softc *sc)
* Read a PHY register on the GMII (i82543 version).
*/
static int
wm_gmii_i82543_readreg(struct device *self, int phy, int reg)
wm_gmii_i82543_readreg(device_t self, int phy, int reg)
{
struct wm_softc *sc = (void *) self;
struct wm_softc *sc = device_private(self);
int rv;
i82543_mii_sendbits(sc, 0xffffffffU, 32);
@ -4497,9 +4497,9 @@ wm_gmii_i82543_readreg(struct device *self, int phy, int reg)
* Write a PHY register on the GMII (i82543 version).
*/
static void
wm_gmii_i82543_writereg(struct device *self, int phy, int reg, int val)
wm_gmii_i82543_writereg(device_t self, int phy, int reg, int val)
{
struct wm_softc *sc = (void *) self;
struct wm_softc *sc = device_private(self);
i82543_mii_sendbits(sc, 0xffffffffU, 32);
i82543_mii_sendbits(sc, val | (MII_COMMAND_ACK << 16) |
@ -4513,9 +4513,9 @@ wm_gmii_i82543_writereg(struct device *self, int phy, int reg, int val)
* Read a PHY register on the GMII.
*/
static int
wm_gmii_i82544_readreg(struct device *self, int phy, int reg)
wm_gmii_i82544_readreg(device_t self, int phy, int reg)
{
struct wm_softc *sc = (void *) self;
struct wm_softc *sc = device_private(self);
uint32_t mdic = 0;
int i, rv;
@ -4554,9 +4554,9 @@ wm_gmii_i82544_readreg(struct device *self, int phy, int reg)
* Write a PHY register on the GMII.
*/
static void
wm_gmii_i82544_writereg(struct device *self, int phy, int reg, int val)
wm_gmii_i82544_writereg(device_t self, int phy, int reg, int val)
{
struct wm_softc *sc = (void *) self;
struct wm_softc *sc = device_private(self);
uint32_t mdic = 0;
int i;
@ -4586,9 +4586,9 @@ wm_gmii_i82544_writereg(struct device *self, int phy, int reg, int val)
* ressource ...
*/
static int
wm_gmii_i80003_readreg(struct device *self, int phy, int reg)
wm_gmii_i80003_readreg(device_t self, int phy, int reg)
{
struct wm_softc *sc = (void *) self;
struct wm_softc *sc = device_private(self);
int func = ((CSR_READ(sc, WMREG_STATUS) >> STATUS_FUNCID_SHIFT) & 1);
int rv;
@ -4619,9 +4619,9 @@ wm_gmii_i80003_readreg(struct device *self, int phy, int reg)
* ressource ...
*/
static void
wm_gmii_i80003_writereg(struct device *self, int phy, int reg, int val)
wm_gmii_i80003_writereg(device_t self, int phy, int reg, int val)
{
struct wm_softc *sc = (void *) self;
struct wm_softc *sc = device_private(self);
int func = ((CSR_READ(sc, WMREG_STATUS) >> STATUS_FUNCID_SHIFT) & 1);
if (phy != 1) /* only one PHY on kumeran bus */
@ -4648,9 +4648,9 @@ wm_gmii_i80003_writereg(struct device *self, int phy, int reg, int val)
* Callback from MII layer when media changes.
*/
static void
wm_gmii_statchg(struct device *self)
wm_gmii_statchg(device_t self)
{
struct wm_softc *sc = (void *) self;
struct wm_softc *sc = device_private(self);
struct mii_data *mii = &sc->sc_mii;
sc->sc_ctrl &= ~(CTRL_TFCE | CTRL_RFCE);

View File

@ -1,4 +1,4 @@
/* $NetBSD: pci.c,v 1.113 2008/02/28 14:25:12 drochner Exp $ */
/* $NetBSD: pci.c,v 1.114 2008/03/21 07:47:43 dyoung Exp $ */
/*
* Copyright (c) 1995, 1996, 1997, 1998
@ -36,7 +36,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: pci.c,v 1.113 2008/02/28 14:25:12 drochner Exp $");
__KERNEL_RCSID(0, "$NetBSD: pci.c,v 1.114 2008/03/21 07:47:43 dyoung Exp $");
#include "opt_pci.h"
@ -99,18 +99,19 @@ int pci_enumerate_bus(struct pci_softc *, const int *,
*/
static int
pcirescan(struct device *sc, const char *ifattr, const int *locators)
pcirescan(device_t self, const char *ifattr, const int *locators)
{
struct pci_softc *sc = device_private(self);
KASSERT(ifattr && !strcmp(ifattr, "pci"));
KASSERT(locators);
pci_enumerate_bus((struct pci_softc *)sc, locators, NULL, NULL);
return (0);
pci_enumerate_bus(sc, locators, NULL, NULL);
return 0;
}
static int
pcimatch(struct device *parent, struct cfdata *cf, void *aux)
pcimatch(device_t parent, struct cfdata *cf, void *aux)
{
struct pcibus_attach_args *pba = aux;
@ -131,10 +132,10 @@ pcimatch(struct device *parent, struct cfdata *cf, void *aux)
}
static void
pciattach(struct device *parent, struct device *self, void *aux)
pciattach(device_t parent, device_t self, void *aux)
{
struct pcibus_attach_args *pba = aux;
struct pci_softc *sc = (struct pci_softc *)self;
struct pci_softc *sc = device_private(self);
int io_enabled, mem_enabled, mrl_enabled, mrm_enabled, mwi_enabled;
const char *sep = "";
static const int wildcard[PCICF_NLOCS] = {
@ -153,7 +154,7 @@ pciattach(struct device *parent, struct device *self, void *aux)
mwi_enabled = (pba->pba_flags & PCI_FLAGS_MWI_OKAY);
if (io_enabled == 0 && mem_enabled == 0) {
aprint_error("%s: no spaces enabled!\n", self->dv_xname);
aprint_error_dev(self, "no spaces enabled!\n");
goto fail;
}
@ -163,7 +164,7 @@ do { \
sep = ", "; \
} while (/*CONSTCOND*/0)
aprint_verbose("%s: ", self->dv_xname);
aprint_verbose_dev(self, " ");
if (io_enabled)
PRINT("i/o space");
@ -207,7 +208,7 @@ fail:
}
static int
pcidetach(struct device *self, int flags)
pcidetach(device_t self, int flags)
{
int rc;
@ -274,7 +275,7 @@ pci_probe_device(struct pci_softc *sc, pcitag_t tag,
pcireg_t id, csr, class, intr, bhlcr;
int ret, pin, bus, device, function;
int locs[PCICF_NLOCS];
struct device *subdev;
device_t subdev;
pci_decompose_tag(pc, tag, &bus, &device, &function);
@ -370,15 +371,15 @@ pci_probe_device(struct pci_softc *sc, pcitag_t tag,
}
static void
pcidevdetached(struct device *sc, struct device *dev)
pcidevdetached(device_t self, device_t child)
{
struct pci_softc *psc = (struct pci_softc *)sc;
struct pci_softc *psc = device_private(self);
int d, f;
d = device_locator(dev, PCICF_DEV);
f = device_locator(dev, PCICF_FUNCTION);
d = device_locator(child, PCICF_DEV);
f = device_locator(child, PCICF_FUNCTION);
KASSERT(psc->PCI_SC_DEVICESC(d, f) == dev);
KASSERT(psc->PCI_SC_DEVICESC(d, f) == child);
psc->PCI_SC_DEVICESC(d, f) = 0;
}
@ -436,7 +437,7 @@ pci_find_device(struct pci_attach_args *pa,
int (*match)(struct pci_attach_args *))
{
extern struct cfdriver pci_cd;
struct device *pcidev;
device_t pcidev;
int i;
static const int wildcard[2] = {
PCICF_DEV_DEFAULT,
@ -746,10 +747,9 @@ pci_set_powerstate(pci_chipset_tag_t pc, pcitag_t tag, pcireg_t state)
}
int
pci_activate(pci_chipset_tag_t pc, pcitag_t tag, void *sc,
int (*wakefun)(pci_chipset_tag_t, pcitag_t, void *, pcireg_t))
pci_activate(pci_chipset_tag_t pc, pcitag_t tag, device_t dev,
int (*wakefun)(pci_chipset_tag_t, pcitag_t, device_t, pcireg_t))
{
struct device *dv = sc;
pcireg_t pmode;
int error;
@ -765,20 +765,19 @@ pci_activate(pci_chipset_tag_t pc, pcitag_t tag, void *sc,
* The card has lost all configuration data in
* this state, so punt.
*/
aprint_error(
"%s: unable to wake up from power state D3\n",
dv->dv_xname);
aprint_error_dev(dev,
"unable to wake up from power state D3\n");
return EOPNOTSUPP;
}
/*FALLTHROUGH*/
default:
if (wakefun) {
error = (*wakefun)(pc, tag, sc, pmode);
error = (*wakefun)(pc, tag, dev, pmode);
if (error)
return error;
}
aprint_normal("%s: waking up from power state D%d\n",
dv->dv_xname, pmode);
aprint_normal_dev(dev, "waking up from power state D%d\n",
pmode);
if ((error = pci_set_powerstate(pc, tag, PCI_PMCSR_STATE_D0)))
return error;
}
@ -787,7 +786,7 @@ pci_activate(pci_chipset_tag_t pc, pcitag_t tag, void *sc,
int
pci_activate_null(pci_chipset_tag_t pc, pcitag_t tag,
void *sc, pcireg_t state)
device_t dev, pcireg_t state)
{
return 0;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: pcivar.h,v 1.77 2007/12/09 20:28:12 jmcneill Exp $ */
/* $NetBSD: pcivar.h,v 1.78 2008/03/21 07:47:43 dyoung Exp $ */
/*
* Copyright (c) 1996, 1997 Christopher G. Demetriou. All rights reserved.
@ -243,9 +243,9 @@ void pci_conf_capture(pci_chipset_tag_t, pcitag_t, struct pci_conf_state *);
void pci_conf_restore(pci_chipset_tag_t, pcitag_t, struct pci_conf_state *);
int pci_get_powerstate(pci_chipset_tag_t, pcitag_t, pcireg_t *);
int pci_set_powerstate(pci_chipset_tag_t, pcitag_t, pcireg_t);
int pci_activate(pci_chipset_tag_t, pcitag_t, void *,
int (*)(pci_chipset_tag_t, pcitag_t, void *, pcireg_t));
int pci_activate_null(pci_chipset_tag_t, pcitag_t, void *, pcireg_t);
int pci_activate(pci_chipset_tag_t, pcitag_t, device_t,
int (*)(pci_chipset_tag_t, pcitag_t, device_t, pcireg_t));
int pci_activate_null(pci_chipset_tag_t, pcitag_t, device_t, pcireg_t);
void pci_disable_retry(pci_chipset_tag_t, pcitag_t);
#endif /* _KERNEL */