Change the interface of cardbus_function_enable() and

cardbus_function_disable().
This commit is contained in:
haya 1999-11-01 09:59:23 +00:00
parent 8553661a5e
commit 88f1d44cc2
4 changed files with 37 additions and 32 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: cardbus.c,v 1.8 1999/10/29 12:02:13 joda Exp $ */
/* $NetBSD: cardbus.c,v 1.9 1999/11/01 09:59:23 haya Exp $ */
/*
* Copyright (c) 1997, 1998 and 1999
@ -599,17 +599,16 @@ disable_function(sc, function)
}
/*
* int cardbus_function_enable(cardbus_devfunc_t ct)
* int cardbus_function_enable(struct cardbus_softc *sc, int func)
*
* This function enables a function on a card. When no power is
* applied on the card, power will be applied on it.
*/
int
cardbus_function_enable(ct)
cardbus_devfunc_t ct;
cardbus_function_enable(sc, func)
struct cardbus_softc *sc;
int func;
{
struct cardbus_softc *sc = ct->ct_sc;
int func = ct->ct_func;
cardbus_chipset_tag_t cc = sc->sc_cc;
cardbus_function_tag_t cf = sc->sc_cf;
cardbusreg_t command;
@ -623,12 +622,14 @@ cardbus_function_enable(ct)
/* exiting critical area */
tag = Cardbus_make_tag(ct);
tag = cardbus_make_tag(cc, cf, sc->sc_bus, sc->sc_device, func);
command = cardbus_conf_read(cc, cf, tag, CARDBUS_COMMAND_STATUS_REG);
command |= (CARDBUS_COMMAND_MEM_ENABLE | CARDBUS_COMMAND_IO_ENABLE | CARDBUS_COMMAND_MASTER_ENABLE); /* XXX: good guess needed */
cardbus_conf_write(cc, cf, tag, CARDBUS_COMMAND_STATUS_REG, command);
Cardbus_free_tag(ct, tag);
cardbus_conf_write(cc, cf, tag, CARDBUS_COMMAND_STATUS_REG, command);
cardbus_free_tag(cc, cf, tag);
DPRINTF(("%x\n", sc->sc_poweron_func));
@ -637,19 +638,18 @@ cardbus_function_enable(ct)
/*
* int cardbus_function_disable(cardbus_devfunc_t ct)
* int cardbus_function_disable(struct cardbus_softc *, int func)
*
* This function disable a function on a card. When no functions are
* enabled, it turns off the power.
*/
int
cardbus_function_disable(ct)
cardbus_devfunc_t ct;
cardbus_function_disable(sc, func)
struct cardbus_softc *sc;
int func;
{
struct cardbus_softc *sc = ct->ct_sc;
int func = ct->ct_func;
DPRINTF(("entering cardbus_enable_disable... "));
DPRINTF(("entering cardbus_function_disable... "));
disable_function(sc, func);

View File

@ -1,4 +1,4 @@
/* $NetBSD: cardbusvar.h,v 1.6 1999/10/28 22:29:04 joda Exp $ */
/* $NetBSD: cardbusvar.h,v 1.7 1999/11/01 09:59:23 haya Exp $ */
/*
* Copyright (c) 1998 and 1999
@ -218,9 +218,9 @@ typedef struct cardbus_functions {
} cardbus_function_t, *cardbus_function_tag_t;
#endif /* rbus */
/**********************************************************************
/*
* struct cbslot_attach_args is the attach argument for cardbus card.
**********************************************************************/
*/
struct cbslot_attach_args {
char *cba_busname;
bus_space_tag_t cba_iot; /* cardbus i/o space tag */
@ -252,9 +252,9 @@ struct cbslot_attach_args {
struct cardbus_devfunc;
/**********************************************************************
/*
* struct cardbus_softc is the softc for cardbus card.
**********************************************************************/
*/
struct cardbus_softc {
struct device sc_dev; /* fundamental device structure */
@ -285,13 +285,13 @@ struct cardbus_softc {
};
/**********************************************************************
/*
* struct cardbus_devfunc:
*
* This is the data deposit for each function of a CardBus device.
* This structure is used for memory or i/o space allocation and
* disallocation.
**********************************************************************/
*/
typedef struct cardbus_devfunc {
cardbus_chipset_tag_t ct_cc;
cardbus_function_tag_t ct_cf;
@ -393,8 +393,13 @@ int cardbus_mapreg_map __P((struct cardbus_softc *, int, int, cardbusreg_t,
int cardbus_save_bar __P((cardbus_devfunc_t));
int cardbus_restore_bar __P((cardbus_devfunc_t));
int cardbus_function_enable __P((cardbus_devfunc_t));
int cardbus_function_disable __P((cardbus_devfunc_t));
int cardbus_function_enable __P((struct cardbus_softc *, int function));
int cardbus_function_disable __P((struct cardbus_softc *, int function));
#define Cardbus_function_enable(ct) cardbus_function_enable((ct)->ct_sc, (ct)->ct_func)
#define Cardbus_function_disable(ct) cardbus_function_disable((ct)->ct_sc, (ct)->ct_func)
#define Cardbus_mapreg_map(ct, reg, type, busflags, tagp, handlep, basep, sizep) \
cardbus_mapreg_map((ct)->ct_sc, (ct->ct_func), (reg), (type),\

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_ex_cardbus.c,v 1.5 1999/10/27 10:04:41 haya Exp $ */
/* $NetBSD: if_ex_cardbus.c,v 1.6 1999/11/01 09:59:23 haya Exp $ */
/*
* CardBus specific routines for 3Com 3C575-family CardBus ethernet adapter
@ -361,7 +361,7 @@ ex_cardbus_enable(sc)
cardbus_function_tag_t cf = csc->sc_ct->ct_cf;
cardbus_chipset_tag_t cc = csc->sc_ct->ct_cc;
cardbus_function_enable(csc->sc_ct);
Cardbus_function_enable(csc->sc_ct);
cardbus_restore_bar(csc->sc_ct);
sc->sc_ih = cardbus_intr_establish(cc, cf, csc->sc_intrline, IPL_NET, ex_intr, sc);
@ -387,7 +387,7 @@ ex_cardbus_disable(sc)
cardbus_save_bar(csc->sc_ct);
cardbus_function_disable(csc->sc_ct);
Cardbus_function_disable(csc->sc_ct);
cardbus_intr_disestablish(cc, cf, sc->sc_ih);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_fxp_cardbus.c,v 1.3 1999/10/31 15:12:39 joda Exp $ */
/* $NetBSD: if_fxp_cardbus.c,v 1.4 1999/11/01 09:59:23 haya Exp $ */
/*
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@ -218,7 +218,7 @@ fxp_cardbus_enable(struct fxp_softc *sc)
cardbus_chipset_tag_t cc = psc->sc_cc;
cardbus_function_tag_t cf = psc->sc_cf;
cardbus_function_enable(csc->ct);
Cardbus_function_enable(csc->ct);
fxp_cardbus_setup(sc);
@ -245,5 +245,5 @@ fxp_cardbus_disable(struct fxp_softc *sc)
cardbus_intr_disestablish(cc, cf, sc->sc_ih); /* remove intr handler */
cardbus_function_disable(((struct fxp_cardbus_softc*)sc)->ct);
Cardbus_function_disable(((struct fxp_cardbus_softc*)sc)->ct);
}