parent
b3ac884c36
commit
1368789634
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: fwohci_cardbus.c,v 1.22 2008/03/29 16:36:14 ad Exp $ */
|
||||
/* $NetBSD: fwohci_cardbus.c,v 1.23 2008/03/29 17:50:36 kiyohara Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2000, 2001 The NetBSD Foundation, Inc.
|
||||
|
@ -37,7 +37,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: fwohci_cardbus.c,v 1.22 2008/03/29 16:36:14 ad Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: fwohci_cardbus.c,v 1.23 2008/03/29 17:50:36 kiyohara Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -69,11 +69,11 @@ struct fwohci_cardbus_softc {
|
|||
void *sc_ih;
|
||||
};
|
||||
|
||||
static int fwohci_cardbus_match(struct device *, struct cfdata *, void *);
|
||||
static void fwohci_cardbus_attach(struct device *, struct device *, void *);
|
||||
static int fwohci_cardbus_detach(struct device *, int);
|
||||
static int fwohci_cardbus_match(device_t, struct cfdata *, void *);
|
||||
static void fwohci_cardbus_attach(device_t, device_t, void *);
|
||||
static int fwohci_cardbus_detach(device_t, int);
|
||||
|
||||
CFATTACH_DECL(fwohci_cardbus, sizeof(struct fwohci_cardbus_softc),
|
||||
CFATTACH_DECL_NEW(fwohci_cardbus, sizeof(struct fwohci_cardbus_softc),
|
||||
fwohci_cardbus_match, fwohci_cardbus_attach,
|
||||
fwohci_cardbus_detach, NULL);
|
||||
|
||||
|
@ -82,8 +82,7 @@ CFATTACH_DECL(fwohci_cardbus, sizeof(struct fwohci_cardbus_softc),
|
|||
#define cardbus_devinfo pci_devinfo
|
||||
|
||||
static int
|
||||
fwohci_cardbus_match(struct device *parent,
|
||||
struct cfdata *match, void *aux)
|
||||
fwohci_cardbus_match(device_t parent, struct cfdata *match, void *aux)
|
||||
{
|
||||
struct cardbus_attach_args *ca = (struct cardbus_attach_args *)aux;
|
||||
|
||||
|
@ -97,8 +96,7 @@ fwohci_cardbus_match(struct device *parent,
|
|||
}
|
||||
|
||||
static void
|
||||
fwohci_cardbus_attach(struct device *parent, struct device *self,
|
||||
void *aux)
|
||||
fwohci_cardbus_attach(device_t parent, device_t self, void *aux)
|
||||
{
|
||||
struct cardbus_attach_args *ca = aux;
|
||||
struct fwohci_cardbus_softc *sc = device_private(self);
|
||||
|
@ -107,18 +105,18 @@ fwohci_cardbus_attach(struct device *parent, struct device *self,
|
|||
cardbus_function_tag_t cf = ct->ct_cf;
|
||||
cardbusreg_t csr;
|
||||
char devinfo[256];
|
||||
const char *devname = self->dv_xname;
|
||||
|
||||
cardbus_devinfo(ca->ca_id, ca->ca_class, 0, devinfo, sizeof(devinfo));
|
||||
printf(": %s (rev. 0x%02x)\n", devinfo,
|
||||
aprint_normal(": %s (rev. 0x%02x)\n", devinfo,
|
||||
CARDBUS_REVISION(ca->ca_class));
|
||||
aprint_naive("\n");
|
||||
|
||||
/* Map I/O registers */
|
||||
if (Cardbus_mapreg_map(ct, CARDBUS_OHCI_MAP_REGISTER,
|
||||
CARDBUS_MAPREG_TYPE_MEM, 0,
|
||||
&sc->sc_sc.bst, &sc->sc_sc.bsh,
|
||||
NULL, &sc->sc_sc.bssize)) {
|
||||
printf("%s: can't map OHCI register space\n", devname);
|
||||
aprint_error_dev(self, "can't map OHCI register space\n");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -146,10 +144,10 @@ XXX (ct->ct_cf->cardbus_mem_open)(cc, 0, iob, iob + 0x40);
|
|||
sc->sc_ih = cardbus_intr_establish(cc, cf, ca->ca_intrline,
|
||||
IPL_BIO, fwohci_filt, sc);
|
||||
if (sc->sc_ih == NULL) {
|
||||
printf("%s: couldn't establish interrupt\n", devname);
|
||||
aprint_error_dev(self, "couldn't establish interrupt\n");
|
||||
return;
|
||||
}
|
||||
printf("%s: interrupting at %d\n", devname, ca->ca_intrline);
|
||||
aprint_normal_dev(self, "interrupting at %d\n", ca->ca_intrline);
|
||||
|
||||
/* XXX NULL should be replaced by some call to Cardbus coed */
|
||||
if (fwohci_init(&sc->sc_sc, sc->sc_sc.fc.dev) != 0) {
|
||||
|
@ -159,7 +157,7 @@ XXX (ct->ct_cf->cardbus_mem_open)(cc, 0, iob, iob + 0x40);
|
|||
}
|
||||
|
||||
int
|
||||
fwohci_cardbus_detach(struct device *self, int flags)
|
||||
fwohci_cardbus_detach(device_t self, int flags)
|
||||
{
|
||||
struct fwohci_cardbus_softc *sc = device_private(self);
|
||||
cardbus_devfunc_t ct = sc->sc_ct;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: fwohci_pci.c,v 1.30 2008/03/29 16:37:00 ad Exp $ */
|
||||
/* $NetBSD: fwohci_pci.c,v 1.31 2008/03/29 17:50:36 kiyohara Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2000 The NetBSD Foundation, Inc.
|
||||
|
@ -37,7 +37,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: fwohci_pci.c,v 1.30 2008/03/29 16:37:00 ad Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: fwohci_pci.c,v 1.31 2008/03/29 17:50:36 kiyohara Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -66,17 +66,17 @@ struct fwohci_pci_softc {
|
|||
void *psc_ih;
|
||||
};
|
||||
|
||||
static int fwohci_pci_match(struct device *, struct cfdata *, void *);
|
||||
static void fwohci_pci_attach(struct device *, struct device *, void *);
|
||||
static int fwohci_pci_match(device_t, struct cfdata *, void *);
|
||||
static void fwohci_pci_attach(device_t, device_t, void *);
|
||||
|
||||
static bool fwohci_pci_suspend(device_t PMF_FN_PROTO);
|
||||
static bool fwohci_pci_resume(device_t PMF_FN_PROTO);
|
||||
|
||||
CFATTACH_DECL(fwohci_pci, sizeof(struct fwohci_pci_softc),
|
||||
CFATTACH_DECL_NEW(fwohci_pci, sizeof(struct fwohci_pci_softc),
|
||||
fwohci_pci_match, fwohci_pci_attach, NULL, NULL);
|
||||
|
||||
static int
|
||||
fwohci_pci_match(struct device *parent, struct cfdata *match,
|
||||
fwohci_pci_match(device_t parent, struct cfdata *match,
|
||||
void *aux)
|
||||
{
|
||||
struct pci_attach_args *pa = (struct pci_attach_args *) aux;
|
||||
|
@ -90,11 +90,10 @@ fwohci_pci_match(struct device *parent, struct cfdata *match,
|
|||
}
|
||||
|
||||
static void
|
||||
fwohci_pci_attach(struct device *parent, struct device *self,
|
||||
void *aux)
|
||||
fwohci_pci_attach(device_t parent, device_t self, void *aux)
|
||||
{
|
||||
struct pci_attach_args *pa = (struct pci_attach_args *) aux;
|
||||
struct fwohci_pci_softc *psc = (struct fwohci_pci_softc *) self;
|
||||
struct fwohci_pci_softc *psc = device_private(self);
|
||||
char devinfo[256];
|
||||
char const *intrstr;
|
||||
pci_intr_handle_t ih;
|
||||
|
@ -106,6 +105,7 @@ fwohci_pci_attach(struct device *parent, struct device *self,
|
|||
aprint_normal(": %s (rev. 0x%02x)\n", devinfo,
|
||||
PCI_REVISION(pa->pa_class));
|
||||
|
||||
psc->psc_sc.fc.dev = self;
|
||||
psc->psc_sc.fc.dmat = pa->pa_dmat;
|
||||
psc->psc_pc = pa->pa_pc;
|
||||
psc->psc_tag = pa->pa_tag;
|
||||
|
@ -114,8 +114,7 @@ fwohci_pci_attach(struct device *parent, struct device *self,
|
|||
if (pci_mapreg_map(pa, PCI_OHCI_MAP_REGISTER, PCI_MAPREG_TYPE_MEM, 0,
|
||||
&psc->psc_sc.bst, &psc->psc_sc.bsh,
|
||||
NULL, &psc->psc_sc.bssize)) {
|
||||
aprint_error("%s: can't map OHCI register space\n",
|
||||
self->dv_xname);
|
||||
aprint_error_dev(self, "can't map OHCI register space\n");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
|
@ -129,21 +128,20 @@ fwohci_pci_attach(struct device *parent, struct device *self,
|
|||
|
||||
/* Map and establish the interrupt. */
|
||||
if (pci_intr_map(pa, &ih)) {
|
||||
aprint_error("%s: couldn't map interrupt\n", self->dv_xname);
|
||||
aprint_error_dev(self, "couldn't map interrupt\n");
|
||||
goto fail;
|
||||
}
|
||||
intrstr = pci_intr_string(pa->pa_pc, ih);
|
||||
psc->psc_ih = pci_intr_establish(pa->pa_pc, ih, IPL_BIO, fwohci_filt,
|
||||
&psc->psc_sc);
|
||||
if (psc->psc_ih == NULL) {
|
||||
aprint_error("%s: couldn't establish interrupt",
|
||||
self->dv_xname);
|
||||
aprint_error_dev(self, "couldn't establish interrupt");
|
||||
if (intrstr != NULL)
|
||||
aprint_normal(" at %s", intrstr);
|
||||
aprint_normal("\n");
|
||||
aprint_error(" at %s", intrstr);
|
||||
aprint_error("\n");
|
||||
goto fail;
|
||||
}
|
||||
aprint_normal("%s: interrupting at %s\n", self->dv_xname, intrstr);
|
||||
aprint_normal_dev(self, "interrupting at %s\n", intrstr);
|
||||
|
||||
if (!pmf_device_register(self, fwohci_pci_suspend, fwohci_pci_resume))
|
||||
aprint_error_dev(self, "couldn't establish power handler\n");
|
||||
|
|
Loading…
Reference in New Issue