struct device * -> device_t

struct cfdata * -> cfdata_t
split device/softc (CFATTACH_DECL_NEW)
use device_accessors and device_private
constify
This commit is contained in:
matt 2011-06-17 19:03:00 +00:00
parent 168c99375b
commit 036ca983e1
24 changed files with 262 additions and 268 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: booke_autoconf.c,v 1.2 2011/01/18 01:02:52 matt Exp $ */ /* $NetBSD: booke_autoconf.c,v 1.3 2011/06/17 19:03:03 matt Exp $ */
/*- /*-
* Copyright (c) 2010, 2011 The NetBSD Foundation, Inc. * Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
* All rights reserved. * All rights reserved.
@ -35,7 +35,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: booke_autoconf.c,v 1.2 2011/01/18 01:02:52 matt Exp $"); __KERNEL_RCSID(0, "$NetBSD: booke_autoconf.c,v 1.3 2011/06/17 19:03:03 matt Exp $");
#include <sys/param.h> #include <sys/param.h>
#include <sys/conf.h> #include <sys/conf.h>
@ -73,7 +73,7 @@ e500_device_register(device_t dev, void *aux)
if (prop_dictionary_set(device_properties(dev), if (prop_dictionary_set(device_properties(dev),
"mac-address", pd) == false) { "mac-address", pd) == false) {
printf("WARNING: unable to set mac-addr " printf("WARNING: unable to set mac-addr "
"property for %s\n", dev->dv_xname); "property for %s\n", device_xname(dev));
} }
} }
return; return;

View File

@ -1,4 +1,4 @@
/* $NetBSD: pq3etsec.c,v 1.4 2011/06/12 05:37:54 matt Exp $ */ /* $NetBSD: pq3etsec.c,v 1.5 2011/06/17 19:03:03 matt Exp $ */
/*- /*-
* Copyright (c) 2010, 2011 The NetBSD Foundation, Inc. * Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
* All rights reserved. * All rights reserved.
@ -458,6 +458,7 @@ pq3etsec_attach(device_t parent, device_t self, void *aux)
struct pq3etsec_softc * const sc = device_private(self); struct pq3etsec_softc * const sc = device_private(self);
struct cpunode_attach_args * const cna = aux; struct cpunode_attach_args * const cna = aux;
struct cpunode_locators * const cnl = &cna->cna_locs; struct cpunode_locators * const cnl = &cna->cna_locs;
cfdata_t cf = device_cfdata(self);
int error; int error;
psc->sc_children |= cna->cna_childmask; psc->sc_children |= cna->cna_childmask;
@ -468,15 +469,13 @@ pq3etsec_attach(device_t parent, device_t self, void *aux)
/* /*
* If we have a common MDIO bus, if all off instance 1. * If we have a common MDIO bus, if all off instance 1.
*/ */
device_t miiself = (self->dv_cfdata->cf_flags & 0x100) device_t miiself = (cf->cf_flags & 0x100) ? tsec_cd.cd_devs[0] : self;
? tsec_cd.cd_devs[0]
: self;
/* /*
* See if the phy is in the config file... * See if the phy is in the config file...
*/ */
if (self->dv_cfdata->cf_flags & 0x3f) { if (cf->cf_flags & 0x3f) {
sc->sc_phy_addr = (self->dv_cfdata->cf_flags & 0x3f) - 1; sc->sc_phy_addr = (cf->cf_flags & 0x3f) - 1;
} else { } else {
unsigned char prop_name[20]; unsigned char prop_name[20];
snprintf(prop_name, sizeof(prop_name), "tsec%u-phy-addr", snprintf(prop_name, sizeof(prop_name), "tsec%u-phy-addr",

View File

@ -1,4 +1,4 @@
/* $NetBSD: comopbvar.h,v 1.2 2005/12/11 12:18:42 christos Exp $ */ /* $NetBSD: comopbvar.h,v 1.3 2011/06/17 19:03:01 matt Exp $ */
/* /*
* Copyright (c) 2004 Shigeyuki Fukushima. * Copyright (c) 2004 Shigeyuki Fukushima.
@ -37,6 +37,6 @@
#include <sys/device.h> #include <sys/device.h>
extern void com_opb_cnattach(int, int, int, int); extern void com_opb_cnattach(int, int, int, int);
extern void com_opb_device_register(struct device *, int); extern void com_opb_device_register(device_t, int);
#endif /* __IBM4XX_COMOPBVAR_H__ */ #endif /* __IBM4XX_COMOPBVAR_H__ */

View File

@ -1,4 +1,4 @@
/* $NetBSD: ecc_plb.c,v 1.12 2010/03/18 13:47:04 kiyohara Exp $ */ /* $NetBSD: ecc_plb.c,v 1.13 2011/06/17 19:03:01 matt Exp $ */
/* /*
* Copyright 2001 Wasabi Systems, Inc. * Copyright 2001 Wasabi Systems, Inc.
@ -36,7 +36,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ecc_plb.c,v 1.12 2010/03/18 13:47:04 kiyohara Exp $"); __KERNEL_RCSID(0, "$NetBSD: ecc_plb.c,v 1.13 2011/06/17 19:03:01 matt Exp $");
#include "locators.h" #include "locators.h"
@ -52,26 +52,26 @@ __KERNEL_RCSID(0, "$NetBSD: ecc_plb.c,v 1.12 2010/03/18 13:47:04 kiyohara Exp $"
struct ecc_plb_softc { struct ecc_plb_softc {
struct device sc_dev; device_t sc_dev;
u_quad_t sc_ecc_tb; uint64_t sc_ecc_tb;
u_quad_t sc_ecc_iv; /* Interval */ uint64_t sc_ecc_iv; /* Interval */
u_int32_t sc_ecc_cnt; uint32_t sc_ecc_cnt;
u_int sc_memsize; u_int sc_memsize;
int sc_irq; int sc_irq;
}; };
static int ecc_plbmatch(struct device *, struct cfdata *, void *); static int ecc_plbmatch(device_t, cfdata_t, void *);
static void ecc_plbattach(struct device *, struct device *, void *); static void ecc_plbattach(device_t, device_t, void *);
static void ecc_plb_deferred(struct device *); static void ecc_plb_deferred(device_t);
static int ecc_plb_intr(void *); static int ecc_plb_intr(void *);
CFATTACH_DECL(ecc_plb, sizeof(struct ecc_plb_softc), CFATTACH_DECL_NEW(ecc_plb, sizeof(struct ecc_plb_softc),
ecc_plbmatch, ecc_plbattach, NULL, NULL); ecc_plbmatch, ecc_plbattach, NULL, NULL);
static int ecc_plb_found; static int ecc_plb_found;
static int static int
ecc_plbmatch(struct device *parent, struct cfdata *cf, void *aux) ecc_plbmatch(device_t parent, cfdata_t cf, void *aux)
{ {
struct plb_attach_args *paa = aux; struct plb_attach_args *paa = aux;
@ -87,9 +87,9 @@ ecc_plbmatch(struct device *parent, struct cfdata *cf, void *aux)
} }
static void static void
ecc_plbattach(struct device *parent, struct device *self, void *aux) ecc_plbattach(device_t parent, device_t self, void *aux)
{ {
struct ecc_plb_softc *sc = (struct ecc_plb_softc *)self; struct ecc_plb_softc *sc = device_private(self);
struct plb_attach_args *paa = aux; struct plb_attach_args *paa = aux;
unsigned int processor_freq; unsigned int processor_freq;
unsigned int memsiz; unsigned int memsiz;
@ -105,8 +105,9 @@ ecc_plbattach(struct device *parent, struct device *self, void *aux)
KASSERT(pn != NULL); KASSERT(pn != NULL);
memsiz = (unsigned int) prop_number_integer_value(pn); memsiz = (unsigned int) prop_number_integer_value(pn);
printf(": ECC controller\n"); aprint_normal(": ECC controller\n");
sc->sc_dev = self;
sc->sc_ecc_tb = 0; sc->sc_ecc_tb = 0;
sc->sc_ecc_cnt = 0; sc->sc_ecc_cnt = 0;
sc->sc_ecc_iv = processor_freq; /* Set interval */ sc->sc_ecc_iv = processor_freq; /* Set interval */
@ -121,11 +122,11 @@ ecc_plbattach(struct device *parent, struct device *self, void *aux)
} }
static void static void
ecc_plb_deferred(struct device *self) ecc_plb_deferred(device_t self)
{ {
struct ecc_plb_softc *sc = (struct ecc_plb_softc *)self; struct ecc_plb_softc *sc = device_private(self);
intr_establish(sc->sc_irq, IST_LEVEL, IPL_SERIAL, ecc_plb_intr, NULL); intr_establish(sc->sc_irq, IST_LEVEL, IPL_SERIAL, ecc_plb_intr, sc);
} }
/* /*

View File

@ -1,4 +1,4 @@
/* $Id: exb.c,v 1.2 2010/11/06 16:30:15 uebayasi Exp $ */ /* $Id: exb.c,v 1.3 2011/06/17 19:03:02 matt Exp $ */
/*- /*-
* Copyright (c) 2010 The NetBSD Foundation, Inc. * Copyright (c) 2010 The NetBSD Foundation, Inc.
@ -30,7 +30,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: exb.c,v 1.2 2010/11/06 16:30:15 uebayasi Exp $"); __KERNEL_RCSID(0, "$NetBSD: exb.c,v 1.3 2011/06/17 19:03:02 matt Exp $");
#include "locators.h" #include "locators.h"
@ -48,8 +48,8 @@ struct exb_softc {
extern const struct exb_conf exb_confs[]; extern const struct exb_conf exb_confs[];
static int exb_match(device_t, struct cfdata *, void *); static int exb_match(device_t, cfdata_t, void *);
static void exb_attach(device_t, struct device *, void *); static void exb_attach(device_t, device_t, void *);
static int exb_print(void *, const char *); static int exb_print(void *, const char *);
CFATTACH_DECL_NEW(exb, sizeof(struct exb_softc), exb_match, exb_attach, CFATTACH_DECL_NEW(exb, sizeof(struct exb_softc), exb_match, exb_attach,
@ -59,7 +59,7 @@ static struct powerpc_bus_space exb_bus_space_tag =
{ _BUS_SPACE_BIG_ENDIAN | _BUS_SPACE_MEM_TYPE, 0 }; { _BUS_SPACE_BIG_ENDIAN | _BUS_SPACE_MEM_TYPE, 0 };
static int static int
exb_match(device_t parent, struct cfdata *cf, void *aux) exb_match(device_t parent, cfdata_t cf, void *aux)
{ {
return 1; return 1;

View File

@ -1,4 +1,4 @@
/* $NetBSD: gpiic_opb.c,v 1.7 2011/06/12 07:19:49 kiyohara Exp $ */ /* $NetBSD: gpiic_opb.c,v 1.8 2011/06/17 19:03:02 matt Exp $ */
/* /*
* Copyright 2002, 2003 Wasabi Systems, Inc. * Copyright 2002, 2003 Wasabi Systems, Inc.
@ -51,7 +51,7 @@
#include <powerpc/ibm4xx/dev/gpiicreg.h> #include <powerpc/ibm4xx/dev/gpiicreg.h>
struct gpiic_softc { struct gpiic_softc {
struct device sc_dev; device_t sc_dev;
bus_space_tag_t sc_bust; bus_space_tag_t sc_bust;
bus_space_handle_t sc_bush; bus_space_handle_t sc_bush;
uint8_t sc_txen; uint8_t sc_txen;
@ -61,10 +61,10 @@ struct gpiic_softc {
kmutex_t sc_buslock; kmutex_t sc_buslock;
}; };
static int gpiic_match(struct device *, struct cfdata *, void *); static int gpiic_match(device_t, cfdata_t, void *);
static void gpiic_attach(struct device *, struct device *, void *); static void gpiic_attach(device_t, device_t, void *);
CFATTACH_DECL(gpiic, sizeof(struct gpiic_softc), CFATTACH_DECL_NEW(gpiic, sizeof(struct gpiic_softc),
gpiic_match, gpiic_attach, NULL, NULL); gpiic_match, gpiic_attach, NULL, NULL);
static int gpiic_acquire_bus(void *, int); static int gpiic_acquire_bus(void *, int);
@ -79,9 +79,9 @@ static void gpiic_set_bits(void *, uint32_t);
static uint32_t gpiic_read_bits(void *); static uint32_t gpiic_read_bits(void *);
static int static int
gpiic_match(struct device *parent, struct cfdata *cf, void *args) gpiic_match(device_t parent, cfdata_t cf, void *args)
{ {
struct opb_attach_args *oaa = args; struct opb_attach_args * const oaa = args;
if (strcmp(oaa->opb_name, cf->cf_name) != 0) if (strcmp(oaa->opb_name, cf->cf_name) != 0)
return 0; return 0;
@ -90,15 +90,16 @@ gpiic_match(struct device *parent, struct cfdata *cf, void *args)
} }
static void static void
gpiic_attach(struct device *parent, struct device *self, void *args) gpiic_attach(device_t parent, device_t self, void *args)
{ {
struct gpiic_softc *sc = (struct gpiic_softc *)self; struct gpiic_softc * const sc = device_private(self);
struct opb_attach_args *oaa = args; struct opb_attach_args * const oaa = args;
struct i2cbus_attach_args iba; struct i2cbus_attach_args iba;
aprint_naive(": IIC controller\n"); aprint_naive(": IIC controller\n");
aprint_normal(": On-Chip IIC controller\n"); aprint_normal(": On-Chip IIC controller\n");
sc->sc_dev = self;
sc->sc_bust = oaa->opb_bt; sc->sc_bust = oaa->opb_bt;
bus_space_map(sc->sc_bust, oaa->opb_addr, IIC_NREG, 0, &sc->sc_bush); bus_space_map(sc->sc_bust, oaa->opb_addr, IIC_NREG, 0, &sc->sc_bush);
@ -137,13 +138,13 @@ gpiic_attach(struct device *parent, struct device *self, void *args)
memset(&iba, 0, sizeof(iba)); memset(&iba, 0, sizeof(iba));
iba.iba_tag = &sc->sc_i2c; iba.iba_tag = &sc->sc_i2c;
(void) config_found_ia(&sc->sc_dev, "i2cbus", &iba, iicbus_print); (void) config_found_ia(self, "i2cbus", &iba, iicbus_print);
} }
static int static int
gpiic_acquire_bus(void *arg, int flags) gpiic_acquire_bus(void *arg, int flags)
{ {
struct gpiic_softc *sc = arg; struct gpiic_softc * const sc = arg;
if (flags & I2C_F_POLL) if (flags & I2C_F_POLL)
return (0); return (0);
@ -155,7 +156,7 @@ gpiic_acquire_bus(void *arg, int flags)
static void static void
gpiic_release_bus(void *arg, int flags) gpiic_release_bus(void *arg, int flags)
{ {
struct gpiic_softc *sc = arg; struct gpiic_softc * const sc = arg;
if (flags & I2C_F_POLL) if (flags & I2C_F_POLL)
return; return;
@ -166,7 +167,7 @@ gpiic_release_bus(void *arg, int flags)
static int static int
gpiic_send_start(void *arg, int flags) gpiic_send_start(void *arg, int flags)
{ {
struct gpiic_softc *sc = arg; struct gpiic_softc * const sc = arg;
return (i2c_bitbang_send_start(sc, flags, &sc->sc_bops)); return (i2c_bitbang_send_start(sc, flags, &sc->sc_bops));
} }
@ -174,7 +175,7 @@ gpiic_send_start(void *arg, int flags)
static int static int
gpiic_send_stop(void *arg, int flags) gpiic_send_stop(void *arg, int flags)
{ {
struct gpiic_softc *sc = arg; struct gpiic_softc * const sc = arg;
return (i2c_bitbang_send_stop(sc, flags, &sc->sc_bops)); return (i2c_bitbang_send_stop(sc, flags, &sc->sc_bops));
} }
@ -182,7 +183,7 @@ gpiic_send_stop(void *arg, int flags)
static int static int
gpiic_initiate_xfer(void *arg, i2c_addr_t addr, int flags) gpiic_initiate_xfer(void *arg, i2c_addr_t addr, int flags)
{ {
struct gpiic_softc *sc = arg; struct gpiic_softc * const sc = arg;
return (i2c_bitbang_initiate_xfer(sc, addr, flags, &sc->sc_bops)); return (i2c_bitbang_initiate_xfer(sc, addr, flags, &sc->sc_bops));
} }
@ -190,7 +191,7 @@ gpiic_initiate_xfer(void *arg, i2c_addr_t addr, int flags)
static int static int
gpiic_read_byte(void *arg, uint8_t *vp, int flags) gpiic_read_byte(void *arg, uint8_t *vp, int flags)
{ {
struct gpiic_softc *sc = arg; struct gpiic_softc * const sc = arg;
return (i2c_bitbang_read_byte(sc, vp, flags, &sc->sc_bops)); return (i2c_bitbang_read_byte(sc, vp, flags, &sc->sc_bops));
} }
@ -198,7 +199,7 @@ gpiic_read_byte(void *arg, uint8_t *vp, int flags)
static int static int
gpiic_write_byte(void *arg, uint8_t v, int flags) gpiic_write_byte(void *arg, uint8_t v, int flags)
{ {
struct gpiic_softc *sc = arg; struct gpiic_softc * const sc = arg;
return (i2c_bitbang_write_byte(sc, v, flags, &sc->sc_bops)); return (i2c_bitbang_write_byte(sc, v, flags, &sc->sc_bops));
} }
@ -206,7 +207,7 @@ gpiic_write_byte(void *arg, uint8_t v, int flags)
static void static void
gpiic_set_dir(void *arg, uint32_t bits) gpiic_set_dir(void *arg, uint32_t bits)
{ {
struct gpiic_softc *sc = arg; struct gpiic_softc * const sc = arg;
uint8_t tx, txen; uint8_t tx, txen;
txen = (uint8_t)bits; txen = (uint8_t)bits;
@ -224,7 +225,7 @@ gpiic_set_dir(void *arg, uint32_t bits)
static void static void
gpiic_set_bits(void *arg, uint32_t bits) gpiic_set_bits(void *arg, uint32_t bits)
{ {
struct gpiic_softc *sc = arg; struct gpiic_softc * const sc = arg;
sc->sc_tx = (uint8_t)bits; sc->sc_tx = (uint8_t)bits;
if (sc->sc_txen == 0) if (sc->sc_txen == 0)
@ -236,7 +237,7 @@ gpiic_set_bits(void *arg, uint32_t bits)
static uint32_t static uint32_t
gpiic_read_bits(void *arg) gpiic_read_bits(void *arg)
{ {
struct gpiic_softc *sc = arg; struct gpiic_softc * const sc = arg;
uint8_t rv; uint8_t rv;
rv = bus_space_read_1(sc->sc_bust, sc->sc_bush, IIC_DIRECTCNTL) << 2; rv = bus_space_read_1(sc->sc_bust, sc->sc_bush, IIC_DIRECTCNTL) << 2;

View File

@ -1,4 +1,4 @@
/* $NetBSD: gpio_opb.c,v 1.7 2010/03/18 13:47:04 kiyohara Exp $ */ /* $NetBSD: gpio_opb.c,v 1.8 2011/06/17 19:03:02 matt Exp $ */
/* /*
* Copyright (c) 2004 Shigeyuki Fukushima. * Copyright (c) 2004 Shigeyuki Fukushima.
@ -45,7 +45,7 @@
#include <powerpc/ibm4xx/dev/gpioreg.h> #include <powerpc/ibm4xx/dev/gpioreg.h>
struct gpio_opb_softc { struct gpio_opb_softc {
struct device sc_dev; /* device generic */ device_t sc_dev; /* device generic */
/* GPIO interface */ /* GPIO interface */
bus_space_tag_t sc_gpio_iot; bus_space_tag_t sc_gpio_iot;
bus_space_handle_t sc_gpio_ioh; bus_space_handle_t sc_gpio_ioh;
@ -53,21 +53,44 @@ struct gpio_opb_softc {
gpio_pin_t sc_gpio_pins[GPIO_NPINS]; gpio_pin_t sc_gpio_pins[GPIO_NPINS];
}; };
static int gpio_opb_match(struct device *, struct cfdata *, void *); static int gpio_opb_match(device_t, cfdata_t, void *);
static void gpio_opb_attach(struct device *, struct device *, void *); static void gpio_opb_attach(device_t, device_t, void *);
CFATTACH_DECL(opbgpio, sizeof(struct gpio_opb_softc), CFATTACH_DECL_NEW(opbgpio, sizeof(struct gpio_opb_softc),
gpio_opb_match, gpio_opb_attach, NULL, NULL); gpio_opb_match, gpio_opb_attach, NULL, NULL);
static int gpio_opb_pin_read(void *, int); static int gpio_opb_pin_read(void *, int);
static void gpio_opb_pin_write(void *, int, int); static void gpio_opb_pin_write(void *, int, int);
static void gpio_opb_pin_ctl(void *, int, int); static void gpio_opb_pin_ctl(void *, int, int);
static inline uint32_t
gpio_read(struct gpio_opb_softc *sc, bus_size_t o)
{
return bus_space_read_4(sc->sc_gpio_iot, sc->sc_gpio_ioh, o);
}
static inline void
gpio_write(struct gpio_opb_softc *sc, bus_size_t o, uint32_t v)
{
bus_space_write_4(sc->sc_gpio_iot, sc->sc_gpio_ioh, o, v);
}
static inline void
gpio_set(struct gpio_opb_softc *sc, bus_size_t o, uint32_t v)
{
gpio_write(sc, o, gpio_read(sc, o) | v);
}
static inline void
gpio_clear(struct gpio_opb_softc *sc, bus_size_t o, uint32_t v)
{
gpio_write(sc, o, gpio_read(sc, o) & ~v);
}
static int static int
gpio_opb_match(struct device *parent, struct cfdata *cf, void *aux) gpio_opb_match(device_t parent, cfdata_t cf, void *aux)
{ {
struct opb_attach_args *oaa = aux; struct opb_attach_args * const oaa = aux;
if (strcmp(oaa->opb_name, cf->cf_name) != 0) if (strcmp(oaa->opb_name, cf->cf_name) != 0)
return 0; return 0;
@ -76,45 +99,46 @@ gpio_opb_match(struct device *parent, struct cfdata *cf, void *aux)
} }
static void static void
gpio_opb_attach(struct device *parent, struct device *self, void *aux) gpio_opb_attach(device_t parent, device_t self, void *aux)
{ {
struct gpio_opb_softc *sc = (struct gpio_opb_softc *)self; struct gpio_opb_softc * const sc = device_private(self);
struct opb_attach_args *oaa = aux; struct opb_attach_args * const oaa = aux;
struct gpiobus_attach_args gba; struct gpiobus_attach_args gba;
int i; uint32_t reg_ir, reg_tcr, reg_odr;
uint32_t reg1, reg2, reg3;
aprint_naive(": GPIO controller\n"); aprint_naive(": GPIO controller\n");
aprint_normal(": On-Chip GPIO controller\n"); aprint_normal(": On-Chip GPIO controller\n");
sc->sc_dev = self;
/* Map GPIO I/O space */ /* Map GPIO I/O space */
sc->sc_gpio_iot = oaa->opb_bt; sc->sc_gpio_iot = oaa->opb_bt;
bus_space_map(sc->sc_gpio_iot, oaa->opb_addr, bus_space_map(sc->sc_gpio_iot, oaa->opb_addr,
GPIO_NREG, 0, &sc->sc_gpio_ioh); GPIO_NREG, 0, &sc->sc_gpio_ioh);
/* Read current register status */ /* Read current register status */
reg1 = bus_space_read_4(sc->sc_gpio_iot, sc->sc_gpio_ioh, GPIO_IR); reg_ir = gpio_read(sc, GPIO_IR);
reg2 = bus_space_read_4(sc->sc_gpio_iot, sc->sc_gpio_ioh, GPIO_TCR); reg_tcr = gpio_read(sc, GPIO_TCR);
reg3 = bus_space_read_4(sc->sc_gpio_iot, sc->sc_gpio_ioh, GPIO_ODR); reg_odr = gpio_read(sc, GPIO_ODR);
/* Initialize pins array */ /* Initialize pins array */
for (i = 0 ; i < GPIO_NPINS ; i++) { gpio_pin_t *pin = sc->sc_gpio_pins;
int p = i + 1; for (u_int i = 0 ; i < GPIO_NPINS ; i++, pin++) {
sc->sc_gpio_pins[i].pin_num = i; const uint32_t pin_mask = 1 << GPIO_PIN_SHIFT(i + 1);
sc->sc_gpio_pins[i].pin_caps = GPIO_PIN_INOUT pin->pin_num = i;
pin->pin_caps = GPIO_PIN_INOUT
| GPIO_PIN_OPENDRAIN | GPIO_PIN_OPENDRAIN
| GPIO_PIN_TRISTATE; | GPIO_PIN_TRISTATE;
/* current defaults */ /* current defaults */
sc->sc_gpio_pins[i].pin_flags = pin->pin_flags =
((reg3 >> GPIO_PIN_SHIFT(p)) & 0x01) (reg_odr & pin_mask)
? GPIO_PIN_OPENDRAIN ? GPIO_PIN_OPENDRAIN
: (((reg2 >> GPIO_PIN_SHIFT(p)) & 0x01) : ((reg_tcr & pin_mask)
? GPIO_PIN_INOUT ? GPIO_PIN_INOUT
: GPIO_PIN_TRISTATE); : GPIO_PIN_TRISTATE);
sc->sc_gpio_pins[i].pin_state = pin->pin_state = (reg_ir & pin_mask) != 0;
((reg1 >> GPIO_PIN_SHIFT(p)) & 0x01); pin->pin_mapped = 0;
sc->sc_gpio_pins[i].pin_mapped = 0;
} }
/* Create controller tag */ /* Create controller tag */
@ -128,90 +152,58 @@ gpio_opb_attach(struct device *parent, struct device *self, void *aux)
gba.gba_npins = GPIO_NPINS; gba.gba_npins = GPIO_NPINS;
/* Attach GPIO framework */ /* Attach GPIO framework */
(void) config_found(&sc->sc_dev, &gba, gpiobus_print); (void) config_found(self, &gba, gpiobus_print);
} }
static int static int
gpio_opb_pin_read(void *arg, int pin) gpio_opb_pin_read(void *arg, int pin)
{ {
struct gpio_opb_softc *sc = arg; struct gpio_opb_softc * const sc = arg;
uint32_t data; const u_int p = (pin % GPIO_NPINS) + 1;
int p; uint32_t reg_ir = gpio_read(sc, GPIO_IR);
p = pin % GPIO_NPINS; return (reg_ir >> GPIO_PIN_SHIFT(p)) & 0x01;
p = p + 1;
data = bus_space_read_4(sc->sc_gpio_iot, sc->sc_gpio_ioh, GPIO_IR);
return (data >> GPIO_PIN_SHIFT(p)) & 0x01;
} }
static void static void
gpio_opb_pin_write(void *arg, int pin, int value) gpio_opb_pin_write(void *arg, int pin, int value)
{ {
struct gpio_opb_softc *sc = arg; struct gpio_opb_softc * const sc = arg;
uint32_t data; const u_int p = (pin % GPIO_NPINS) + 1;
int p; const uint32_t pin_mask = 1 << GPIO_PIN_SHIFT(p);
p = pin % GPIO_NPINS;
p = p + 1;
data = bus_space_read_4(sc->sc_gpio_iot, sc->sc_gpio_ioh, GPIO_OR);
if (value == 0) { if (value == 0) {
data &= ~(1 << GPIO_PIN_SHIFT(p)); gpio_clear(sc, GPIO_OR, pin_mask);
} else if (value == 1) { } else if (value == 1) {
data |= (1 << GPIO_PIN_SHIFT(p)); gpio_set(sc, GPIO_OR, pin_mask);
} }
bus_space_write_4(sc->sc_gpio_iot, sc->sc_gpio_ioh, GPIO_OR, data);
} }
static void static void
gpio_opb_pin_ctl(void *arg, int pin, int flags) gpio_opb_pin_ctl(void *arg, int pin, int flags)
{ {
struct gpio_opb_softc *sc = arg; struct gpio_opb_softc * const sc = arg;
uint32_t data; const u_int p = (pin % GPIO_NPINS) + 1;
int p; const uint32_t pin_mask = 1 << GPIO_PIN_SHIFT(p);
p = pin % GPIO_NPINS;
p = p + 1;
if (flags & GPIO_PIN_INOUT) { if (flags & GPIO_PIN_INOUT) {
/* GPIOn_ODR register bit is 0 */ /* GPIOn_ODR register bit is 0 */
data = bus_space_read_4(sc->sc_gpio_iot, sc->sc_gpio_ioh, gpio_clear(sc, GPIO_ODR, pin_mask);
GPIO_ODR);
data &= ~(1 << GPIO_PIN_SHIFT(p));
bus_space_write_4(sc->sc_gpio_iot, sc->sc_gpio_ioh,
GPIO_ODR, data);
/* GPIOn_TCR register bit is 1 */ /* GPIOn_TCR register bit is 1 */
data = bus_space_read_4(sc->sc_gpio_iot, sc->sc_gpio_ioh, gpio_set(sc, GPIO_TCR, pin_mask);
GPIO_TCR);
data |= (1 << GPIO_PIN_SHIFT(p));
bus_space_write_4(sc->sc_gpio_iot, sc->sc_gpio_ioh,
GPIO_TCR, data);
} }
if (flags & GPIO_PIN_TRISTATE) { if (flags & GPIO_PIN_TRISTATE) {
/* GPIOn_ODR register bit is 0 */ /* GPIOn_ODR register bit is 0 */
data = bus_space_read_4(sc->sc_gpio_iot, sc->sc_gpio_ioh, gpio_clear(sc, GPIO_ODR, pin_mask);
GPIO_ODR);
data &= ~(1 << GPIO_PIN_SHIFT(p));
bus_space_write_4(sc->sc_gpio_iot, sc->sc_gpio_ioh,
GPIO_ODR, data);
/* GPIOn_TCR register bit is 0 */ /* GPIOn_TCR register bit is 0 */
data = bus_space_read_4(sc->sc_gpio_iot, sc->sc_gpio_ioh, gpio_clear(sc, GPIO_TCR, pin_mask);
GPIO_TCR);
data &= ~(1 << GPIO_PIN_SHIFT(p));
bus_space_write_4(sc->sc_gpio_iot, sc->sc_gpio_ioh,
GPIO_TCR, data);
} }
if (flags & GPIO_PIN_OPENDRAIN) { if (flags & GPIO_PIN_OPENDRAIN) {
/* GPIOn_ODR register bit is 1 */ /* GPIOn_ODR register bit is 1 */
data = bus_space_read_4(sc->sc_gpio_iot, sc->sc_gpio_ioh, gpio_set(sc, GPIO_ODR, pin_mask);
GPIO_ODR);
data |= (1 << GPIO_PIN_SHIFT(p));
bus_space_write_4(sc->sc_gpio_iot, sc->sc_gpio_ioh,
GPIO_ODR, data);
} }
} }

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_emac.c,v 1.37 2010/04/05 07:19:31 joerg Exp $ */ /* $NetBSD: if_emac.c,v 1.38 2011/06/17 19:03:02 matt Exp $ */
/* /*
* Copyright 2001, 2002 Wasabi Systems, Inc. * Copyright 2001, 2002 Wasabi Systems, Inc.
@ -52,7 +52,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: if_emac.c,v 1.37 2010/04/05 07:19:31 joerg Exp $"); __KERNEL_RCSID(0, "$NetBSD: if_emac.c,v 1.38 2011/06/17 19:03:02 matt Exp $");
#include "opt_emac.h" #include "opt_emac.h"
@ -332,6 +332,7 @@ emac_attach(device_t parent, device_t self, void *aux)
struct emac_softc *sc = device_private(self); struct emac_softc *sc = device_private(self);
struct ifnet *ifp = &sc->sc_ethercom.ec_if; struct ifnet *ifp = &sc->sc_ethercom.ec_if;
struct mii_data *mii = &sc->sc_mii; struct mii_data *mii = &sc->sc_mii;
const char * xname = device_xname(self);
bus_dma_segment_t seg; bus_dma_segment_t seg;
int error, i, nseg, opb_freq, opbc, mii_phy = MII_PHY_ANY; int error, i, nseg, opb_freq, opbc, mii_phy = MII_PHY_ANY;
const uint8_t *enaddr; const uint8_t *enaddr;
@ -526,7 +527,7 @@ emac_attach(device_t parent, device_t self, void *aux)
ifmedia_set(&mii->mii_media, IFM_ETHER|IFM_AUTO); ifmedia_set(&mii->mii_media, IFM_ETHER|IFM_AUTO);
ifp = &sc->sc_ethercom.ec_if; ifp = &sc->sc_ethercom.ec_if;
strcpy(ifp->if_xname, self->dv_xname); strcpy(ifp->if_xname, xname);
ifp->if_softc = sc; ifp->if_softc = sc;
ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
ifp->if_start = emac_start; ifp->if_start = emac_start;
@ -552,26 +553,26 @@ emac_attach(device_t parent, device_t self, void *aux)
* Attach the event counters. * Attach the event counters.
*/ */
evcnt_attach_dynamic(&sc->sc_ev_txintr, EVCNT_TYPE_INTR, evcnt_attach_dynamic(&sc->sc_ev_txintr, EVCNT_TYPE_INTR,
NULL, self->dv_xname, "txintr"); NULL, xname, "txintr");
evcnt_attach_dynamic(&sc->sc_ev_rxintr, EVCNT_TYPE_INTR, evcnt_attach_dynamic(&sc->sc_ev_rxintr, EVCNT_TYPE_INTR,
NULL, self->dv_xname, "rxintr"); NULL, xname, "rxintr");
evcnt_attach_dynamic(&sc->sc_ev_txde, EVCNT_TYPE_INTR, evcnt_attach_dynamic(&sc->sc_ev_txde, EVCNT_TYPE_INTR,
NULL, self->dv_xname, "txde"); NULL, xname, "txde");
evcnt_attach_dynamic(&sc->sc_ev_rxde, EVCNT_TYPE_INTR, evcnt_attach_dynamic(&sc->sc_ev_rxde, EVCNT_TYPE_INTR,
NULL, self->dv_xname, "rxde"); NULL, xname, "rxde");
evcnt_attach_dynamic(&sc->sc_ev_intr, EVCNT_TYPE_INTR, evcnt_attach_dynamic(&sc->sc_ev_intr, EVCNT_TYPE_INTR,
NULL, self->dv_xname, "intr"); NULL, xname, "intr");
evcnt_attach_dynamic(&sc->sc_ev_txreap, EVCNT_TYPE_MISC, evcnt_attach_dynamic(&sc->sc_ev_txreap, EVCNT_TYPE_MISC,
NULL, self->dv_xname, "txreap"); NULL, xname, "txreap");
evcnt_attach_dynamic(&sc->sc_ev_txsstall, EVCNT_TYPE_MISC, evcnt_attach_dynamic(&sc->sc_ev_txsstall, EVCNT_TYPE_MISC,
NULL, self->dv_xname, "txsstall"); NULL, xname, "txsstall");
evcnt_attach_dynamic(&sc->sc_ev_txdstall, EVCNT_TYPE_MISC, evcnt_attach_dynamic(&sc->sc_ev_txdstall, EVCNT_TYPE_MISC,
NULL, self->dv_xname, "txdstall"); NULL, xname, "txdstall");
evcnt_attach_dynamic(&sc->sc_ev_txdrop, EVCNT_TYPE_MISC, evcnt_attach_dynamic(&sc->sc_ev_txdrop, EVCNT_TYPE_MISC,
NULL, self->dv_xname, "txdrop"); NULL, xname, "txdrop");
evcnt_attach_dynamic(&sc->sc_ev_tu, EVCNT_TYPE_MISC, evcnt_attach_dynamic(&sc->sc_ev_tu, EVCNT_TYPE_MISC,
NULL, self->dv_xname, "tu"); NULL, xname, "tu");
#endif /* EMAC_EVENT_COUNTERS */ #endif /* EMAC_EVENT_COUNTERS */
/* /*

View File

@ -1,4 +1,4 @@
/* $NetBSD: wdog.c,v 1.10 2010/02/25 23:31:47 matt Exp $ */ /* $NetBSD: wdog.c,v 1.11 2011/06/17 19:03:02 matt Exp $ */
/* /*
* Copyright (c) 2002 Wasabi Systems, Inc. * Copyright (c) 2002 Wasabi Systems, Inc.
@ -40,7 +40,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: wdog.c,v 1.10 2010/02/25 23:31:47 matt Exp $"); __KERNEL_RCSID(0, "$NetBSD: wdog.c,v 1.11 2011/06/17 19:03:02 matt Exp $");
#include <sys/param.h> #include <sys/param.h>
#include <sys/systm.h> #include <sys/systm.h>
@ -55,25 +55,25 @@ __KERNEL_RCSID(0, "$NetBSD: wdog.c,v 1.10 2010/02/25 23:31:47 matt Exp $");
#include <dev/sysmon/sysmonvar.h> #include <dev/sysmon/sysmonvar.h>
static int wdog_match(struct device *, struct cfdata *, void *); static int wdog_match(device_t, cfdata_t, void *);
static void wdog_attach(struct device *, struct device *, void *); static void wdog_attach(device_t, device_t, void *);
static int wdog_tickle(struct sysmon_wdog *); static int wdog_tickle(struct sysmon_wdog *);
static int wdog_setmode(struct sysmon_wdog *); static int wdog_setmode(struct sysmon_wdog *);
struct wdog_softc { struct wdog_softc {
struct device sc_dev; device_t sc_dev;
struct sysmon_wdog sc_smw; struct sysmon_wdog sc_smw;
int sc_wdog_armed; bool sc_wdog_armed;
int sc_wdog_period; int sc_wdog_period;
}; };
CFATTACH_DECL(wdog, sizeof(struct wdog_softc), CFATTACH_DECL_NEW(wdog, sizeof(struct wdog_softc),
wdog_match, wdog_attach, NULL, NULL); wdog_match, wdog_attach, NULL, NULL);
static int static int
wdog_match(struct device *parent, struct cfdata *cf, void *aux) wdog_match(device_t parent, cfdata_t cf, void *aux)
{ {
struct opb_attach_args *oaa = aux; struct opb_attach_args * const oaa = aux;
/* match only watchdog devices */ /* match only watchdog devices */
if (strcmp(oaa->opb_name, cf->cf_name) != 0) if (strcmp(oaa->opb_name, cf->cf_name) != 0)
@ -83,9 +83,9 @@ wdog_match(struct device *parent, struct cfdata *cf, void *aux)
} }
static void static void
wdog_attach(struct device *parent, struct device *self, void *aux) wdog_attach(device_t parent, device_t self, void *aux)
{ {
struct wdog_softc *sc = (void *)self; struct wdog_softc * const sc = device_private(self);
unsigned int processor_freq; unsigned int processor_freq;
prop_number_t freq; prop_number_t freq;
@ -96,16 +96,15 @@ wdog_attach(struct device *parent, struct device *self, void *aux)
sc->sc_wdog_period = (2LL << 29) / processor_freq; sc->sc_wdog_period = (2LL << 29) / processor_freq;
printf(": %d second period\n", sc->sc_wdog_period); printf(": %d second period\n", sc->sc_wdog_period);
sc->sc_smw.smw_name = sc->sc_dev.dv_xname; sc->sc_dev = self;
sc->sc_smw.smw_name = device_xname(self);
sc->sc_smw.smw_cookie = sc; sc->sc_smw.smw_cookie = sc;
sc->sc_smw.smw_setmode = wdog_setmode; sc->sc_smw.smw_setmode = wdog_setmode;
sc->sc_smw.smw_tickle = wdog_tickle; sc->sc_smw.smw_tickle = wdog_tickle;
sc->sc_smw.smw_period = sc->sc_wdog_period; sc->sc_smw.smw_period = sc->sc_wdog_period;
if (sysmon_wdog_register(&sc->sc_smw) != 0) if (sysmon_wdog_register(&sc->sc_smw) != 0)
printf("%s: unable to register with sysmon\n", aprint_error_dev(self, "unable to register with sysmon\n");
sc->sc_dev.dv_xname);
} }
static int static int
@ -122,14 +121,14 @@ wdog_tickle(struct sysmon_wdog *smw)
static int static int
wdog_setmode(struct sysmon_wdog *smw) wdog_setmode(struct sysmon_wdog *smw)
{ {
struct wdog_softc *sc = smw->smw_cookie; struct wdog_softc * const sc = smw->smw_cookie;
uint32_t tcr, tsr;
if ((smw->smw_mode & WDOG_MODE_MASK) == WDOG_MODE_DISARMED) { if ((smw->smw_mode & WDOG_MODE_MASK) == WDOG_MODE_DISARMED) {
if (sc->sc_wdog_armed) { if (sc->sc_wdog_armed) {
tsr = mfspr(SPR_TSR); uint32_t tsr = mfspr(SPR_TSR);
tsr &= ~(TSR_ENW | TSR_WIS); tsr &= ~(TSR_ENW | TSR_WIS);
mtspr(SPR_TSR, tsr); mtspr(SPR_TSR, tsr);
sc->sc_wdog_armed = false;
} }
} else { } else {
if (smw->smw_period == WDOG_PERIOD_DEFAULT) if (smw->smw_period == WDOG_PERIOD_DEFAULT)
@ -142,9 +141,9 @@ wdog_setmode(struct sysmon_wdog *smw)
*/ */
return (EOPNOTSUPP); return (EOPNOTSUPP);
} }
sc->sc_wdog_armed = 1; sc->sc_wdog_armed = true;
tcr = mfspr(SPR_TCR); uint32_t tcr = mfspr(SPR_TCR);
tcr |= TCR_WP_2_29 | TCR_WRC_SYSTEM; tcr |= TCR_WP_2_29 | TCR_WRC_SYSTEM;
mtspr(SPR_TCR, tcr); mtspr(SPR_TCR, tcr);

View File

@ -1,4 +1,4 @@
/* $NetBSD: ibm4xx_autoconf.c,v 1.13 2010/03/18 13:47:05 kiyohara Exp $ */ /* $NetBSD: ibm4xx_autoconf.c,v 1.14 2011/06/17 19:03:01 matt Exp $ */
/* Original Tag: ibm4xxgpx_autoconf.c,v 1.2 2004/10/23 17:12:22 thorpej Exp $ */ /* Original Tag: ibm4xxgpx_autoconf.c,v 1.2 2004/10/23 17:12:22 thorpej Exp $ */
/* /*
@ -33,7 +33,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ibm4xx_autoconf.c,v 1.13 2010/03/18 13:47:05 kiyohara Exp $"); __KERNEL_RCSID(0, "$NetBSD: ibm4xx_autoconf.c,v 1.14 2011/06/17 19:03:01 matt Exp $");
#include <sys/param.h> #include <sys/param.h>
#include <sys/conf.h> #include <sys/conf.h>
@ -48,9 +48,9 @@ __KERNEL_RCSID(0, "$NetBSD: ibm4xx_autoconf.c,v 1.13 2010/03/18 13:47:05 kiyohar
#include <powerpc/ibm4xx/dev/opbvar.h> #include <powerpc/ibm4xx/dev/opbvar.h>
void void
ibm4xx_device_register(struct device *dev, void *aux) ibm4xx_device_register(device_t dev, void *aux)
{ {
struct device *parent = device_parent(dev); device_t parent = device_parent(dev);
if (device_is_a(dev, "emac") && device_is_a(parent, "opb")) { if (device_is_a(dev, "emac") && device_is_a(parent, "opb")) {
/* Set the mac-address of the on-chip Ethernet. */ /* Set the mac-address of the on-chip Ethernet. */
@ -73,7 +73,7 @@ ibm4xx_device_register(struct device *dev, void *aux)
if (prop_dictionary_set(dict, "mac-address", pd) == if (prop_dictionary_set(dict, "mac-address", pd) ==
false) false)
printf("WARNING: unable to set mac-address " printf("WARNING: unable to set mac-address "
"property for %s\n", dev->dv_xname); "property for %s\n", device_xname(dev));
snprintf(prop_name, sizeof(prop_name), snprintf(prop_name, sizeof(prop_name),
"emac%d-mii-phy", oaa->opb_instance); "emac%d-mii-phy", oaa->opb_instance);

View File

@ -1,4 +1,4 @@
/* $NetBSD: pchb.c,v 1.8 2011/06/06 16:42:18 matt Exp $ */ /* $NetBSD: pchb.c,v 1.9 2011/06/17 19:03:02 matt Exp $ */
/*- /*-
* Copyright (c) 1996 The NetBSD Foundation, Inc. * Copyright (c) 1996 The NetBSD Foundation, Inc.
@ -29,7 +29,7 @@
* POSSIBILITY OF SUCH DAMAGE. * POSSIBILITY OF SUCH DAMAGE.
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: pchb.c,v 1.8 2011/06/06 16:42:18 matt Exp $"); __KERNEL_RCSID(0, "$NetBSD: pchb.c,v 1.9 2011/06/17 19:03:02 matt Exp $");
#include "pci.h" #include "pci.h"
#include "opt_pci.h" #include "opt_pci.h"
@ -135,7 +135,7 @@ pchbattach(device_t parent, device_t self, void *aux)
class = pci_conf_read(pc, tag, PCI_CLASS_REG); class = pci_conf_read(pc, tag, PCI_CLASS_REG);
id = pci_conf_read(pc, tag, PCI_ID_REG); id = pci_conf_read(pc, tag, PCI_ID_REG);
printf("\n"); aprint_normal("\n");
pcifound++; pcifound++;
/* /*
* All we do is print out a description. Eventually, we * All we do is print out a description. Eventually, we
@ -144,7 +144,7 @@ pchbattach(device_t parent, device_t self, void *aux)
*/ */
pci_devinfo(id, class, 0, devinfo, sizeof(devinfo)); pci_devinfo(id, class, 0, devinfo, sizeof(devinfo));
printf("%s: %s (rev. 0x%02x)\n", self->dv_xname, devinfo, aprint_normal_dev(self, "%s (rev. 0x%02x)\n", devinfo,
PCI_REVISION(class)); PCI_REVISION(class));
pci_machdep_init(); /* Redundant... */ pci_machdep_init(); /* Redundant... */

View File

@ -1,4 +1,4 @@
/* $NetBSD: pci_machdep.c,v 1.7 2010/03/18 13:58:38 kiyohara Exp $ */ /* $NetBSD: pci_machdep.c,v 1.8 2011/06/17 19:03:02 matt Exp $ */
/* /*
* Copyright (c) 1996 Christopher G. Demetriou. All rights reserved. * Copyright (c) 1996 Christopher G. Demetriou. All rights reserved.
@ -43,7 +43,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: pci_machdep.c,v 1.7 2010/03/18 13:58:38 kiyohara Exp $"); __KERNEL_RCSID(0, "$NetBSD: pci_machdep.c,v 1.8 2011/06/17 19:03:02 matt Exp $");
#include <sys/types.h> #include <sys/types.h>
#include <sys/param.h> #include <sys/param.h>
@ -86,7 +86,7 @@ pci_machdep_init(void)
} }
void void
pci_attach_hook(struct device *parent, struct device *self, pci_attach_hook(device_t parent, device_t self,
struct pcibus_attach_args *pba) struct pcibus_attach_args *pba)
{ {

View File

@ -1,4 +1,4 @@
/* $NetBSD: cpu.h,v 1.16 2011/01/18 01:02:54 matt Exp $ */ /* $NetBSD: cpu.h,v 1.17 2011/06/17 19:03:03 matt Exp $ */
/* /*
* Copyright 2002 Wasabi Systems, Inc. * Copyright 2002 Wasabi Systems, Inc.
@ -74,7 +74,7 @@ extern char bootpath[];
#include <prop/proplib.h> #include <prop/proplib.h>
/* export from ibm4xx/autoconf.c */ /* export from ibm4xx/autoconf.c */
extern void (*md_device_register)(struct device *dev, void *aux); extern void (*md_device_register)(device_t dev, void *aux);
/* export from ibm4xx/machdep.c */ /* export from ibm4xx/machdep.c */
extern void (*md_consinit)(void); extern void (*md_consinit)(void);
@ -90,7 +90,7 @@ extern void ibm4xx_dumpsys(void);
extern void ibm4xx_install_extint(void (*)(void)); extern void ibm4xx_install_extint(void (*)(void));
/* export from ibm4xx/ibm4xx_autoconf.c */ /* export from ibm4xx/ibm4xx_autoconf.c */
extern void ibm4xx_device_register(struct device *dev, void *aux); extern void ibm4xx_device_register(device_t dev, void *aux);
/* export from ibm4xx/clock.c */ /* export from ibm4xx/clock.c */
extern void calc_delayconst(void); extern void calc_delayconst(void);

View File

@ -1,4 +1,4 @@
/* $NetBSD: pci_machdep.h,v 1.5 2011/04/04 20:37:52 dyoung Exp $ */ /* $NetBSD: pci_machdep.h,v 1.6 2011/06/17 19:03:03 matt Exp $ */
/* /*
* Copyright (c) 1996 Christopher G. Demetriou. All rights reserved. * Copyright (c) 1996 Christopher G. Demetriou. All rights reserved.
@ -67,7 +67,7 @@ struct ibm4xx_pci_chipset {
/* /*
* Functions provided to machine-independent PCI code. * Functions provided to machine-independent PCI code.
*/ */
void pci_attach_hook(struct device *, struct device *, void pci_attach_hook(device_t, device_t,
struct pcibus_attach_args *); struct pcibus_attach_args *);
int pci_bus_maxdevs(pci_chipset_tag_t, int); int pci_bus_maxdevs(pci_chipset_tag_t, int);
pcitag_t pci_make_tag(pci_chipset_tag_t, int, int, int); pcitag_t pci_make_tag(pci_chipset_tag_t, int, int, int);

View File

@ -1,4 +1,4 @@
/* $NetBSD: isa_machdep.h,v 1.6 2009/08/20 14:21:12 dyoung Exp $ */ /* $NetBSD: isa_machdep.h,v 1.7 2011/06/17 19:03:00 matt Exp $ */
/*- /*-
* Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc. * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
@ -99,12 +99,11 @@ struct pic_ops; /* XXX */
/* /*
* Functions provided to machine-independent ISA code. * Functions provided to machine-independent ISA code.
*/ */
void genppc_isa_attach_hook(struct device *, struct device *, void genppc_isa_attach_hook(device_t, device_t, struct isabus_attach_args *);
struct isabus_attach_args *);
void genppc_isa_detach_hook(isa_chipset_tag_t, device_t); void genppc_isa_detach_hook(isa_chipset_tag_t, device_t);
const struct evcnt *genppc_isa_intr_evcnt(isa_chipset_tag_t, int); const struct evcnt *genppc_isa_intr_evcnt(isa_chipset_tag_t, int);
void *genppc_isa_intr_establish(isa_chipset_tag_t, int /*irq*/, int /*type*/, void *genppc_isa_intr_establish(isa_chipset_tag_t, int /*irq*/, int /*type*/,
int /*level*/, int (*ih_fun)(void *), void *); int /*level*/, int (* /*ih_fun*/)(void *), void *);
void genppc_isa_intr_disestablish(isa_chipset_tag_t, void *); void genppc_isa_intr_disestablish(isa_chipset_tag_t, void *);
int genppc_isa_intr_alloc(isa_chipset_tag_t, struct pic_ops *, int, int genppc_isa_intr_alloc(isa_chipset_tag_t, struct pic_ops *, int,
int, int *); int, int *);

View File

@ -1,4 +1,4 @@
/* $NetBSD: cpu_subr.c,v 1.65 2011/06/16 04:25:13 matt Exp $ */ /* $NetBSD: cpu_subr.c,v 1.66 2011/06/17 19:03:04 matt Exp $ */
/*- /*-
* Copyright (c) 2001 Matt Thomas. * Copyright (c) 2001 Matt Thomas.
@ -34,7 +34,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: cpu_subr.c,v 1.65 2011/06/16 04:25:13 matt Exp $"); __KERNEL_RCSID(0, "$NetBSD: cpu_subr.c,v 1.66 2011/06/17 19:03:04 matt Exp $");
#include "opt_ppcparam.h" #include "opt_ppcparam.h"
#include "opt_multiprocessor.h" #include "opt_multiprocessor.h"
@ -402,8 +402,9 @@ cpu_attach_common(device_t self, int id)
*/ */
if (id != 0) { if (id != 0) {
aprint_normal(": ID %d\n", id); aprint_normal(": ID %d\n", id);
aprint_normal("%s: processor off-line; multiprocessor support " aprint_normal_dev(self,
"not present in kernel\n", self->dv_xname); "processor off-line; "
"multiprocessor support not present in kernel\n");
return (NULL); return (NULL);
} }
#endif #endif
@ -455,6 +456,7 @@ void
cpu_setup(device_t self, struct cpu_info *ci) cpu_setup(device_t self, struct cpu_info *ci)
{ {
u_int hid0, hid0_save, pvr, vers; u_int hid0, hid0_save, pvr, vers;
const char * const xname = device_xname(self);
const char *bitmask; const char *bitmask;
char hidbuf[128]; char hidbuf[128];
char model[80]; char model[80];
@ -593,8 +595,7 @@ cpu_setup(device_t self, struct cpu_info *ci)
break; break;
} }
snprintb(hidbuf, sizeof hidbuf, bitmask, hid0); snprintb(hidbuf, sizeof hidbuf, bitmask, hid0);
aprint_normal("%s: HID0 %s, powersave: %d\n", self->dv_xname, hidbuf, aprint_normal_dev(self, "HID0 %s, powersave: %d\n", hidbuf, powersave);
powersave);
ci->ci_khz = 0; ci->ci_khz = 0;
@ -615,7 +616,7 @@ cpu_setup(device_t self, struct cpu_info *ci)
case MPC7450: case MPC7450:
case MPC7455: case MPC7455:
case MPC7457: case MPC7457:
aprint_normal("%s: ", self->dv_xname); aprint_normal_dev(self, "");
cpu_probe_speed(ci); cpu_probe_speed(ci);
aprint_normal("%u.%02u MHz", aprint_normal("%u.%02u MHz",
ci->ci_khz / 1000, (ci->ci_khz / 10) % 100); ci->ci_khz / 1000, (ci->ci_khz / 10) % 100);
@ -653,51 +654,51 @@ cpu_setup(device_t self, struct cpu_info *ci)
#endif #endif
evcnt_attach_dynamic(&ci->ci_ev_clock, EVCNT_TYPE_INTR, evcnt_attach_dynamic(&ci->ci_ev_clock, EVCNT_TYPE_INTR,
NULL, self->dv_xname, "clock"); NULL, xname, "clock");
evcnt_attach_dynamic(&ci->ci_ev_softclock, EVCNT_TYPE_INTR, evcnt_attach_dynamic(&ci->ci_ev_softclock, EVCNT_TYPE_INTR,
NULL, self->dv_xname, "soft clock"); NULL, xname, "soft clock");
evcnt_attach_dynamic(&ci->ci_ev_softnet, EVCNT_TYPE_INTR, evcnt_attach_dynamic(&ci->ci_ev_softnet, EVCNT_TYPE_INTR,
NULL, self->dv_xname, "soft net"); NULL, xname, "soft net");
evcnt_attach_dynamic(&ci->ci_ev_softserial, EVCNT_TYPE_INTR, evcnt_attach_dynamic(&ci->ci_ev_softserial, EVCNT_TYPE_INTR,
NULL, self->dv_xname, "soft serial"); NULL, xname, "soft serial");
evcnt_attach_dynamic(&ci->ci_ev_traps, EVCNT_TYPE_TRAP, evcnt_attach_dynamic(&ci->ci_ev_traps, EVCNT_TYPE_TRAP,
NULL, self->dv_xname, "traps"); NULL, xname, "traps");
evcnt_attach_dynamic(&ci->ci_ev_kdsi, EVCNT_TYPE_TRAP, evcnt_attach_dynamic(&ci->ci_ev_kdsi, EVCNT_TYPE_TRAP,
&ci->ci_ev_traps, self->dv_xname, "kernel DSI traps"); &ci->ci_ev_traps, xname, "kernel DSI traps");
evcnt_attach_dynamic(&ci->ci_ev_udsi, EVCNT_TYPE_TRAP, evcnt_attach_dynamic(&ci->ci_ev_udsi, EVCNT_TYPE_TRAP,
&ci->ci_ev_traps, self->dv_xname, "user DSI traps"); &ci->ci_ev_traps, xname, "user DSI traps");
evcnt_attach_dynamic(&ci->ci_ev_udsi_fatal, EVCNT_TYPE_TRAP, evcnt_attach_dynamic(&ci->ci_ev_udsi_fatal, EVCNT_TYPE_TRAP,
&ci->ci_ev_udsi, self->dv_xname, "user DSI failures"); &ci->ci_ev_udsi, xname, "user DSI failures");
evcnt_attach_dynamic(&ci->ci_ev_kisi, EVCNT_TYPE_TRAP, evcnt_attach_dynamic(&ci->ci_ev_kisi, EVCNT_TYPE_TRAP,
&ci->ci_ev_traps, self->dv_xname, "kernel ISI traps"); &ci->ci_ev_traps, xname, "kernel ISI traps");
evcnt_attach_dynamic(&ci->ci_ev_isi, EVCNT_TYPE_TRAP, evcnt_attach_dynamic(&ci->ci_ev_isi, EVCNT_TYPE_TRAP,
&ci->ci_ev_traps, self->dv_xname, "user ISI traps"); &ci->ci_ev_traps, xname, "user ISI traps");
evcnt_attach_dynamic(&ci->ci_ev_isi_fatal, EVCNT_TYPE_TRAP, evcnt_attach_dynamic(&ci->ci_ev_isi_fatal, EVCNT_TYPE_TRAP,
&ci->ci_ev_isi, self->dv_xname, "user ISI failures"); &ci->ci_ev_isi, xname, "user ISI failures");
evcnt_attach_dynamic(&ci->ci_ev_scalls, EVCNT_TYPE_TRAP, evcnt_attach_dynamic(&ci->ci_ev_scalls, EVCNT_TYPE_TRAP,
&ci->ci_ev_traps, self->dv_xname, "system call traps"); &ci->ci_ev_traps, xname, "system call traps");
evcnt_attach_dynamic(&ci->ci_ev_pgm, EVCNT_TYPE_TRAP, evcnt_attach_dynamic(&ci->ci_ev_pgm, EVCNT_TYPE_TRAP,
&ci->ci_ev_traps, self->dv_xname, "PGM traps"); &ci->ci_ev_traps, xname, "PGM traps");
evcnt_attach_dynamic(&ci->ci_ev_fpu, EVCNT_TYPE_TRAP, evcnt_attach_dynamic(&ci->ci_ev_fpu, EVCNT_TYPE_TRAP,
&ci->ci_ev_traps, self->dv_xname, "FPU unavailable traps"); &ci->ci_ev_traps, xname, "FPU unavailable traps");
evcnt_attach_dynamic(&ci->ci_ev_fpusw, EVCNT_TYPE_TRAP, evcnt_attach_dynamic(&ci->ci_ev_fpusw, EVCNT_TYPE_TRAP,
&ci->ci_ev_fpu, self->dv_xname, "FPU context switches"); &ci->ci_ev_fpu, xname, "FPU context switches");
evcnt_attach_dynamic(&ci->ci_ev_ali, EVCNT_TYPE_TRAP, evcnt_attach_dynamic(&ci->ci_ev_ali, EVCNT_TYPE_TRAP,
&ci->ci_ev_traps, self->dv_xname, "user alignment traps"); &ci->ci_ev_traps, xname, "user alignment traps");
evcnt_attach_dynamic(&ci->ci_ev_ali_fatal, EVCNT_TYPE_TRAP, evcnt_attach_dynamic(&ci->ci_ev_ali_fatal, EVCNT_TYPE_TRAP,
&ci->ci_ev_ali, self->dv_xname, "user alignment traps"); &ci->ci_ev_ali, xname, "user alignment traps");
evcnt_attach_dynamic(&ci->ci_ev_umchk, EVCNT_TYPE_TRAP, evcnt_attach_dynamic(&ci->ci_ev_umchk, EVCNT_TYPE_TRAP,
&ci->ci_ev_umchk, self->dv_xname, "user MCHK failures"); &ci->ci_ev_umchk, xname, "user MCHK failures");
evcnt_attach_dynamic(&ci->ci_ev_vec, EVCNT_TYPE_TRAP, evcnt_attach_dynamic(&ci->ci_ev_vec, EVCNT_TYPE_TRAP,
&ci->ci_ev_traps, self->dv_xname, "AltiVec unavailable"); &ci->ci_ev_traps, xname, "AltiVec unavailable");
#ifdef ALTIVEC #ifdef ALTIVEC
if (cpu_altivec) { if (cpu_altivec) {
evcnt_attach_dynamic(&ci->ci_ev_vecsw, EVCNT_TYPE_TRAP, evcnt_attach_dynamic(&ci->ci_ev_vecsw, EVCNT_TYPE_TRAP,
&ci->ci_ev_vec, self->dv_xname, "AltiVec context switches"); &ci->ci_ev_vec, xname, "AltiVec context switches");
} }
#endif #endif
evcnt_attach_dynamic(&ci->ci_ev_ipi, EVCNT_TYPE_INTR, evcnt_attach_dynamic(&ci->ci_ev_ipi, EVCNT_TYPE_INTR,
NULL, self->dv_xname, "IPIs"); NULL, xname, "IPIs");
} }
/* /*
@ -1130,13 +1131,13 @@ cpu_tau_setup(struct cpu_info *ci)
return; return;
} }
sme->sme_name = ci->ci_dev->dv_xname; sme->sme_name = device_xname(ci->ci_dev);
sme->sme_cookie = ci; sme->sme_cookie = ci;
sme->sme_refresh = cpu_tau_refresh; sme->sme_refresh = cpu_tau_refresh;
if ((error = sysmon_envsys_register(sme)) != 0) { if ((error = sysmon_envsys_register(sme)) != 0) {
aprint_error("%s: unable to register with sysmon (%d)\n", aprint_error_dev(ci->ci_dev,
ci->ci_dev->dv_xname, error); " unable to register with sysmon (%d)\n", error);
sysmon_envsys_destroy(sme); sysmon_envsys_destroy(sme);
} }
} }

View File

@ -1,4 +1,4 @@
/* $NetBSD: ofw_autoconf.c,v 1.12 2010/06/09 04:41:43 kiyohara Exp $ */ /* $NetBSD: ofw_autoconf.c,v 1.13 2011/06/17 19:03:04 matt Exp $ */
/* /*
* Copyright (C) 1995, 1996 Wolfgang Solfrank. * Copyright (C) 1995, 1996 Wolfgang Solfrank.
* Copyright (C) 1995, 1996 TooLs GmbH. * Copyright (C) 1995, 1996 TooLs GmbH.
@ -31,7 +31,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ofw_autoconf.c,v 1.12 2010/06/09 04:41:43 kiyohara Exp $"); __KERNEL_RCSID(0, "$NetBSD: ofw_autoconf.c,v 1.13 2011/06/17 19:03:04 matt Exp $");
#ifdef ofppc #ifdef ofppc
#include "gtpci.h" #include "gtpci.h"
@ -205,9 +205,9 @@ canonicalize_bootpath(void)
* known OF boot device. * known OF boot device.
*/ */
void void
device_register(struct device *dev, void *aux) device_register(device_t dev, void *aux)
{ {
static struct device *parent; static device_t parent;
static char *bp = bootpath + 1, *cp = cbootpath; static char *bp = bootpath + 1, *cp = cbootpath;
unsigned long addr, addr2; unsigned long addr, addr2;
char *p; char *p;
@ -474,7 +474,7 @@ void
cpu_rootconf(void) cpu_rootconf(void)
{ {
printf("boot device: %s\n", printf("boot device: %s\n",
booted_device ? booted_device->dv_xname : "<unknown>"); booted_device ? device_xname(booted_device) : "<unknown>");
setroot(booted_device, booted_partition); setroot(booted_device, booted_partition);
} }

View File

@ -1,4 +1,4 @@
/* $NetBSD: pchb.c,v 1.5 2011/06/06 16:42:18 matt Exp $ */ /* $NetBSD: pchb.c,v 1.6 2011/06/17 19:03:00 matt Exp $ */
/*- /*-
* Copyright (c) 2007 The NetBSD Foundation, Inc. * Copyright (c) 2007 The NetBSD Foundation, Inc.
@ -30,7 +30,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: pchb.c,v 1.5 2011/06/06 16:42:18 matt Exp $"); __KERNEL_RCSID(0, "$NetBSD: pchb.c,v 1.6 2011/06/17 19:03:00 matt Exp $");
#include <sys/types.h> #include <sys/types.h>
#include <sys/param.h> #include <sys/param.h>
@ -82,7 +82,7 @@ mpc105_print(struct pci_attach_args *pa, device_t self)
reg1 = pci_conf_read(pa->pa_pc, pa->pa_tag, MPC105_PICR1); reg1 = pci_conf_read(pa->pa_pc, pa->pa_tag, MPC105_PICR1);
reg2 = pci_conf_read(pa->pa_pc, pa->pa_tag, MPC105_PICR2); reg2 = pci_conf_read(pa->pa_pc, pa->pa_tag, MPC105_PICR2);
aprint_normal("%s: L2 cache: ", self->dv_xname); aprint_normal_dev(self, "L2 cache: ");
switch (reg2 & MPC105_PICR2_L2_SIZE) { switch (reg2 & MPC105_PICR2_L2_SIZE) {
case MPC105_PICR2_L2_SIZE_256K: case MPC105_PICR2_L2_SIZE_256K:
@ -125,7 +125,7 @@ mpc106_print(struct pci_attach_args *pa, device_t self)
reg1 = pci_conf_read(pa->pa_pc, pa->pa_tag, MPC106_PICR1); reg1 = pci_conf_read(pa->pa_pc, pa->pa_tag, MPC106_PICR1);
reg2 = pci_conf_read(pa->pa_pc, pa->pa_tag, MPC106_PICR2); reg2 = pci_conf_read(pa->pa_pc, pa->pa_tag, MPC106_PICR2);
aprint_normal("%s: L2 cache: ", self->dv_xname); aprint_normal_dev(self, "L2 cache: ");
switch (reg2 & MPC106_PICR2_L2_SIZE) { switch (reg2 & MPC106_PICR2_L2_SIZE) {
case MPC106_PICR2_L2_SIZE_256K: case MPC106_PICR2_L2_SIZE_256K:
@ -195,9 +195,9 @@ ibm82660_print(struct pci_attach_args *pa, device_t self)
else else
s1 = "enabled"; s1 = "enabled";
if (reg2 & IBM_82660_SYSTEM_CTRL_L2_MI) if (reg2 & IBM_82660_SYSTEM_CTRL_L2_MI)
s2 = "(normal operation)"; s2 = " (normal operation)";
else else
s2 = "(miss updates inhibited)"; s2 = " (miss updates inhibited)";
} else { } else {
s1 = "disabled"; s1 = "disabled";
s2 = ""; s2 = "";
@ -209,24 +209,24 @@ ibm82660_print(struct pci_attach_args *pa, device_t self)
s1 = "disabled"; s1 = "disabled";
s2 = ""; s2 = "";
#endif #endif
aprint_normal("%s: L1: %s L2: %s %s\n", self->dv_xname, aprint_normal_dev(self, "L1 %s L2 %s%s\n",
(reg1 & IBM_82660_CACHE_STATUS_L1_EN) ? "enabled" : "disabled", (reg1 & IBM_82660_CACHE_STATUS_L1_EN) ? "enabled" : "disabled",
s1, s2); s1, s2);
reg1 = pci_conf_read(pa->pa_pc, pa->pa_tag, IBM_82660_OPTIONS_1); reg1 = pci_conf_read(pa->pa_pc, pa->pa_tag, IBM_82660_OPTIONS_1);
aprint_verbose("%s: MCP# assertion %s " aprint_verbose_dev(self, "MCP# assertion %s "
"TEA# assertion %s\n", self->dv_xname, "TEA# assertion %s\n",
(reg1 & IBM_82660_OPTIONS_1_MCP) ? "enabled" : "disabled", (reg1 & IBM_82660_OPTIONS_1_MCP) ? "enabled" : "disabled",
(reg1 & IBM_82660_OPTIONS_1_TEA) ? "enabled" : "disabled"); (reg1 & IBM_82660_OPTIONS_1_TEA) ? "enabled" : "disabled");
aprint_verbose("%s: PCI/ISA I/O mapping %s\n", self->dv_xname, aprint_verbose_dev(self, "PCI/ISA I/O mapping %s\n",
(reg1 & IBM_82660_OPTIONS_1_ISA) ? "contiguous" : "non-contiguous"); (reg1 & IBM_82660_OPTIONS_1_ISA) ? "contiguous" : "non-contiguous");
reg1 = pci_conf_read(pa->pa_pc, pa->pa_tag, IBM_82660_OPTIONS_3); reg1 = pci_conf_read(pa->pa_pc, pa->pa_tag, IBM_82660_OPTIONS_3);
aprint_normal("%s: DRAM %s (%s) SRAM %s\n", self->dv_xname, aprint_normal_dev(self, "DRAM %s (%s) SRAM %s\n",
(reg1 & IBM_82660_OPTIONS_3_DRAM) ? "EDO" : "standard", (reg1 & IBM_82660_OPTIONS_3_DRAM) ? "EDO" : "standard",
(reg1 & IBM_82660_OPTIONS_3_ECC) ? "ECC" : "parity", (reg1 & IBM_82660_OPTIONS_3_ECC) ? "ECC" : "parity",
(reg1 & IBM_82660_OPTIONS_3_SRAM) ? "sync" : "async"); (reg1 & IBM_82660_OPTIONS_3_SRAM) ? "sync" : "async");
aprint_verbose("%s: Snoop mode %s\n", self->dv_xname, aprint_verbose_dev(self, "Snoop mode %s\n",
(reg1 & IBM_82660_OPTIONS_3_SNOOP) ? "603" : "601/604"); (reg1 & IBM_82660_OPTIONS_3_SNOOP) ? "603" : "601/604");
} }
@ -250,7 +250,7 @@ pchbattach(device_t parent, device_t self, void *aux)
*/ */
pci_devinfo(pa->pa_id, pa->pa_class, 0, devinfo, sizeof(devinfo)); pci_devinfo(pa->pa_id, pa->pa_class, 0, devinfo, sizeof(devinfo));
aprint_normal("%s: %s (rev. 0x%02x)\n", self->dv_xname, devinfo, aprint_normal_dev(self, "%s (rev. 0x%02x)\n", devinfo,
PCI_REVISION(pa->pa_class)); PCI_REVISION(pa->pa_class));
switch (PCI_VENDOR(pa->pa_id)) { switch (PCI_VENDOR(pa->pa_id)) {

View File

@ -1,4 +1,4 @@
/* $NetBSD: pci_machdep_common.c,v 1.10 2011/04/04 20:37:53 dyoung Exp $ */ /* $NetBSD: pci_machdep_common.c,v 1.11 2011/06/17 19:03:01 matt Exp $ */
/*- /*-
* Copyright (c) 2007 The NetBSD Foundation, Inc. * Copyright (c) 2007 The NetBSD Foundation, Inc.
@ -37,7 +37,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: pci_machdep_common.c,v 1.10 2011/04/04 20:37:53 dyoung Exp $"); __KERNEL_RCSID(0, "$NetBSD: pci_machdep_common.c,v 1.11 2011/06/17 19:03:01 matt Exp $");
#include <sys/types.h> #include <sys/types.h>
#include <sys/param.h> #include <sys/param.h>
@ -206,11 +206,11 @@ bad:
#include <machine/isa_machdep.h> #include <machine/isa_machdep.h>
#include "isa.h" #include "isa.h"
void *genppc_pciide_machdep_compat_intr_establish(struct device *, void *genppc_pciide_machdep_compat_intr_establish(device_t,
struct pci_attach_args *, int, int (*)(void *), void *); struct pci_attach_args *, int, int (*)(void *), void *);
void * void *
genppc_pciide_machdep_compat_intr_establish(struct device *dev, genppc_pciide_machdep_compat_intr_establish(device_t dev,
struct pci_attach_args *pa, int chan, int (*func)(void *), void *arg) struct pci_attach_args *pa, int chan, int (*func)(void *), void *arg)
{ {
#if NISA > 0 #if NISA > 0
@ -221,7 +221,7 @@ genppc_pciide_machdep_compat_intr_establish(struct device *dev,
cookie = isa_intr_establish(NULL, irq, IST_LEVEL, IPL_BIO, func, arg); cookie = isa_intr_establish(NULL, irq, IST_LEVEL, IPL_BIO, func, arg);
if (cookie == NULL) if (cookie == NULL)
return (NULL); return (NULL);
printf("%s: %s channel interrupting at irq %d\n", dev->dv_xname, aprint_normal_dev(dev, "%s channel interrupting at irq %d\n",
PCIIDE_CHANNEL_NAME(chan), irq); PCIIDE_CHANNEL_NAME(chan), irq);
return (cookie); return (cookie);
#else #else

View File

@ -1,4 +1,4 @@
/* $NetBSD: pcib.c,v 1.5 2008/05/04 00:18:16 martin Exp $ */ /* $NetBSD: pcib.c,v 1.6 2011/06/17 19:03:01 matt Exp $ */
/*- /*-
* Copyright (c) 1996, 1998 The NetBSD Foundation, Inc. * Copyright (c) 1996, 1998 The NetBSD Foundation, Inc.
@ -30,7 +30,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: pcib.c,v 1.5 2008/05/04 00:18:16 martin Exp $"); __KERNEL_RCSID(0, "$NetBSD: pcib.c,v 1.6 2011/06/17 19:03:01 matt Exp $");
#include <sys/types.h> #include <sys/types.h>
#include <sys/param.h> #include <sys/param.h>
@ -121,12 +121,11 @@ pcibattach(device_t parent, device_t self, void *aux)
v = pci_conf_read(pa->pa_pc, pa->pa_tag, 0x40); v = pci_conf_read(pa->pa_pc, pa->pa_tag, 0x40);
if ((v & 0x20) == 0) { if ((v & 0x20) == 0) {
aprint_verbose("%s: PIRQ[0-3] not used\n", self->dv_xname); aprint_verbose_dev(self, "PIRQ[0-3] not used\n");
} else { } else {
v = pci_conf_read(pa->pa_pc, pa->pa_tag, 0x60); v = pci_conf_read(pa->pa_pc, pa->pa_tag, 0x60);
if ((v & 0x80808080) == 0x80808080) { if ((v & 0x80808080) == 0x80808080) {
aprint_verbose("%s: PIRQ[0-3] disabled\n", aprint_verbose_dev(self, "PIRQ[0-3] disabled\n");
self->dv_xname);
} else { } else {
int i; int i;
aprint_verbose("%s:", device_xname(self)); aprint_verbose("%s:", device_xname(self));

View File

@ -1,4 +1,4 @@
/* $NetBSD: pciconf_indirect.c,v 1.3 2008/04/28 20:23:32 martin Exp $ */ /* $NetBSD: pciconf_indirect.c,v 1.4 2011/06/17 19:03:01 matt Exp $ */
/*- /*-
* Copyright (c) 2007 The NetBSD Foundation, Inc. * Copyright (c) 2007 The NetBSD Foundation, Inc.
@ -35,7 +35,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: pciconf_indirect.c,v 1.3 2008/04/28 20:23:32 martin Exp $"); __KERNEL_RCSID(0, "$NetBSD: pciconf_indirect.c,v 1.4 2011/06/17 19:03:01 matt Exp $");
#include <sys/types.h> #include <sys/types.h>
#include <sys/param.h> #include <sys/param.h>
@ -62,7 +62,7 @@ __KERNEL_RCSID(0, "$NetBSD: pciconf_indirect.c,v 1.3 2008/04/28 20:23:32 martin
#define PCI_MODE1_ENABLE 0x80000000UL #define PCI_MODE1_ENABLE 0x80000000UL
void void
genppc_pci_indirect_attach_hook(struct device *parent, struct device *self, genppc_pci_indirect_attach_hook(device_t parent, device_t self,
struct pcibus_attach_args *pba) struct pcibus_attach_args *pba)
{ {

View File

@ -1,4 +1,4 @@
/* $NetBSD: pciconf_ofmethod.c,v 1.2 2008/04/28 20:23:32 martin Exp $ */ /* $NetBSD: pciconf_ofmethod.c,v 1.3 2011/06/17 19:03:01 matt Exp $ */
/*- /*-
* Copyright (c) 2007 The NetBSD Foundation, Inc. * Copyright (c) 2007 The NetBSD Foundation, Inc.
@ -35,7 +35,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: pciconf_ofmethod.c,v 1.2 2008/04/28 20:23:32 martin Exp $"); __KERNEL_RCSID(0, "$NetBSD: pciconf_ofmethod.c,v 1.3 2011/06/17 19:03:01 matt Exp $");
#include <sys/types.h> #include <sys/types.h>
#include <sys/param.h> #include <sys/param.h>
@ -62,7 +62,7 @@ __KERNEL_RCSID(0, "$NetBSD: pciconf_ofmethod.c,v 1.2 2008/04/28 20:23:32 martin
#include <dev/pci/pcidevs.h> #include <dev/pci/pcidevs.h>
void void
genppc_pci_ofmethod_attach_hook(struct device *parent, struct device *self, genppc_pci_ofmethod_attach_hook(device_t parent, device_t self,
struct pcibus_attach_args *pba) struct pcibus_attach_args *pba)
{ {

View File

@ -1,4 +1,4 @@
/* $NetBSD: powerpc_machdep.c,v 1.54 2011/06/14 05:50:25 matt Exp $ */ /* $NetBSD: powerpc_machdep.c,v 1.55 2011/06/17 19:03:01 matt Exp $ */
/* /*
* Copyright (C) 1995, 1996 Wolfgang Solfrank. * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@ -32,7 +32,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: powerpc_machdep.c,v 1.54 2011/06/14 05:50:25 matt Exp $"); __KERNEL_RCSID(0, "$NetBSD: powerpc_machdep.c,v 1.55 2011/06/17 19:03:01 matt Exp $");
#include "opt_altivec.h" #include "opt_altivec.h"
#include "opt_modular.h" #include "opt_modular.h"
@ -167,9 +167,11 @@ sysctl_machdep_booted_device(SYSCTLFN_ARGS)
if (booted_device == NULL) if (booted_device == NULL)
return (EOPNOTSUPP); return (EOPNOTSUPP);
const char * const xname = device_xname(booted_device);
node = *rnode; node = *rnode;
node.sysctl_data = booted_device->dv_xname; node.sysctl_data = __UNCONST(xname);
node.sysctl_size = strlen(booted_device->dv_xname) + 1; node.sysctl_size = strlen(xname) + 1;
return (sysctl_lookup(SYSCTLFN_CALL(&node))); return (sysctl_lookup(SYSCTLFN_CALL(&node)));
} }

View File

@ -1,4 +1,4 @@
/* $NetBSD: rtas.c,v 1.10 2011/06/12 21:28:26 mrg Exp $ */ /* $NetBSD: rtas.c,v 1.11 2011/06/17 19:03:01 matt Exp $ */
/* /*
* CHRP RTAS support routines * CHRP RTAS support routines
@ -9,7 +9,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: rtas.c,v 1.10 2011/06/12 21:28:26 mrg Exp $"); __KERNEL_RCSID(0, "$NetBSD: rtas.c,v 1.11 2011/06/17 19:03:01 matt Exp $");
#include <sys/param.h> #include <sys/param.h>
#include <sys/systm.h> #include <sys/systm.h>
@ -68,10 +68,10 @@ static struct {
{ "thaw-time-base", RTAS_FUNC_THAW_TIME_BASE }, { "thaw-time-base", RTAS_FUNC_THAW_TIME_BASE },
}; };
static int rtas_match(struct device *, struct cfdata *, void *); static int rtas_match(device_t, cfdata_t, void *);
static void rtas_attach(struct device *, struct device *, void *); static void rtas_attach(device_t, device_t, void *);
static int rtas_detach(struct device *, int); static int rtas_detach(device_t, int);
static int rtas_activate(struct device *, enum devact); static int rtas_activate(device_t, enum devact);
static int rtas_todr_gettime_ymdhms(struct todr_chip_handle *, static int rtas_todr_gettime_ymdhms(struct todr_chip_handle *,
struct clock_ymdhms *); struct clock_ymdhms *);
static int rtas_todr_settime_ymdhms(struct todr_chip_handle *, static int rtas_todr_settime_ymdhms(struct todr_chip_handle *,
@ -81,7 +81,7 @@ CFATTACH_DECL_NEW(rtas, sizeof (struct rtas_softc),
rtas_match, rtas_attach, rtas_detach, rtas_activate); rtas_match, rtas_attach, rtas_detach, rtas_activate);
static int static int
rtas_match(struct device *parent, struct cfdata *match, void *aux) rtas_match(device_t parent, cfdata_t match, void *aux)
{ {
struct confargs *ca = aux; struct confargs *ca = aux;
@ -92,7 +92,7 @@ rtas_match(struct device *parent, struct cfdata *match, void *aux)
} }
static void static void
rtas_attach(struct device *parent, struct device *self, void *aux) rtas_attach(device_t parent, device_t self, void *aux)
{ {
struct confargs *ca = aux; struct confargs *ca = aux;
struct rtas_softc *sc = device_private(self); struct rtas_softc *sc = device_private(self);
@ -179,13 +179,13 @@ fail:
} }
static int static int
rtas_detach(struct device *self, int flags) rtas_detach(device_t self, int flags)
{ {
return EOPNOTSUPP; return EOPNOTSUPP;
} }
static int static int
rtas_activate(struct device *self, enum devact act) rtas_activate(device_t self, enum devact act)
{ {
return EOPNOTSUPP; return EOPNOTSUPP;
} }