remove the useless (always 0) device number from cardbus driver state,
autoconf attach structures and configuration cycle functions (just leave the kernel configuration attribute for now to avoid breaking config(1) files)
This commit is contained in:
parent
ce9fc42a2b
commit
1af44f3c6e
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: cardbus.c,v 1.65 2005/09/08 15:02:48 drochner Exp $ */
|
||||
/* $NetBSD: cardbus.c,v 1.66 2005/09/09 14:50:58 drochner Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997, 1998, 1999 and 2000
|
||||
@ -33,7 +33,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: cardbus.c,v 1.65 2005/09/08 15:02:48 drochner Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: cardbus.c,v 1.66 2005/09/09 14:50:58 drochner Exp $");
|
||||
|
||||
#include "opt_cardbus.h"
|
||||
|
||||
@ -120,12 +120,11 @@ cardbusattach(struct device *parent, struct device *self, void *aux)
|
||||
struct cbslot_attach_args *cba = aux;
|
||||
|
||||
sc->sc_bus = cba->cba_bus;
|
||||
sc->sc_device = 0;
|
||||
sc->sc_intrline = cba->cba_intrline;
|
||||
sc->sc_cacheline = cba->cba_cacheline;
|
||||
sc->sc_lattimer = cba->cba_lattimer;
|
||||
|
||||
printf(": bus %d device %d", sc->sc_bus, sc->sc_device);
|
||||
printf(": bus %d", sc->sc_bus);
|
||||
if (bootverbose)
|
||||
printf(" cacheline 0x%x, lattimer 0x%x", sc->sc_cacheline,
|
||||
sc->sc_lattimer);
|
||||
@ -424,11 +423,6 @@ cardbus_rescan(struct device *self, const char *ifattr, const int *locators)
|
||||
cc = sc->sc_cc;
|
||||
cf = sc->sc_cf;
|
||||
|
||||
/* XXX what a nonsense */
|
||||
if (locators[CARDBUSCF_DEV] != CARDBUSCF_DEV_DEFAULT &&
|
||||
locators[CARDBUSCF_DEV] != sc->sc_device)
|
||||
return (0);
|
||||
|
||||
/* inspect initial voltage */
|
||||
if ((cdstatus = (*cf->cardbus_ctrl)(cc, CARDBUS_CD)) == 0) {
|
||||
DPRINTF(("cardbusattach: no CardBus card on cb%d\n",
|
||||
@ -443,7 +437,7 @@ cardbus_rescan(struct device *self, const char *ifattr, const int *locators)
|
||||
enable_function(sc, cdstatus, 8);
|
||||
function = 0;
|
||||
|
||||
tag = cardbus_make_tag(cc, cf, sc->sc_bus, sc->sc_device, function);
|
||||
tag = cardbus_make_tag(cc, cf, sc->sc_bus, function);
|
||||
|
||||
/*
|
||||
* Wait until power comes up. Maxmum 500 ms.
|
||||
@ -486,8 +480,7 @@ cardbus_rescan(struct device *self, const char *ifattr, const int *locators)
|
||||
if (sc->sc_funcs[function])
|
||||
continue;
|
||||
|
||||
tag = cardbus_make_tag(cc, cf, sc->sc_bus, sc->sc_device,
|
||||
function);
|
||||
tag = cardbus_make_tag(cc, cf, sc->sc_bus, function);
|
||||
|
||||
id = cardbus_conf_read(cc, cf, tag, CARDBUS_ID_REG);
|
||||
class = cardbus_conf_read(cc, cf, tag, CARDBUS_CLASS_REG);
|
||||
@ -548,7 +541,6 @@ cardbus_rescan(struct device *self, const char *ifattr, const int *locators)
|
||||
ct->ct_cc = sc->sc_cc;
|
||||
ct->ct_cf = sc->sc_cf;
|
||||
ct->ct_bus = sc->sc_bus;
|
||||
ct->ct_dev = sc->sc_device;
|
||||
ct->ct_func = function;
|
||||
ct->ct_sc = sc;
|
||||
sc->sc_funcs[function] = ct;
|
||||
@ -568,7 +560,6 @@ cardbus_rescan(struct device *self, const char *ifattr, const int *locators)
|
||||
|
||||
ca.ca_tag = tag;
|
||||
ca.ca_bus = sc->sc_bus;
|
||||
ca.ca_device = sc->sc_device; /* always 0 */
|
||||
ca.ca_function = function;
|
||||
ca.ca_id = id;
|
||||
ca.ca_class = class;
|
||||
@ -590,7 +581,7 @@ cardbus_rescan(struct device *self, const char *ifattr, const int *locators)
|
||||
}
|
||||
}
|
||||
|
||||
locs[CARDBUSCF_DEV] = sc->sc_device; /* always 0 */
|
||||
locs[CARDBUSCF_DEV] = 0;
|
||||
locs[CARDBUSCF_FUNCTION] = function;
|
||||
|
||||
if ((csc = config_found_sm_loc((void *)sc, "cardbus", locs,
|
||||
@ -635,7 +626,7 @@ cardbusprint(void *aux, const char *pnp)
|
||||
ca->ca_cis.manufacturer, ca->ca_cis.product);
|
||||
aprint_normal(" %s at %s", devinfo, pnp);
|
||||
}
|
||||
aprint_normal(" dev %d function %d", ca->ca_device, ca->ca_function);
|
||||
aprint_normal(" function %d", ca->ca_function);
|
||||
|
||||
return (UNCONF);
|
||||
}
|
||||
@ -781,7 +772,7 @@ cardbus_function_enable(struct cardbus_softc *sc, int func)
|
||||
|
||||
/* exiting critical area */
|
||||
|
||||
tag = cardbus_make_tag(cc, cf, sc->sc_bus, sc->sc_device, func);
|
||||
tag = cardbus_make_tag(cc, cf, sc->sc_bus, func);
|
||||
|
||||
command = cardbus_conf_read(cc, cf, tag, CARDBUS_COMMAND_STATUS_REG);
|
||||
command |= (CARDBUS_COMMAND_MEM_ENABLE | CARDBUS_COMMAND_IO_ENABLE |
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: cardbus_map.c,v 1.16 2005/02/27 00:26:59 perry Exp $ */
|
||||
/* $NetBSD: cardbus_map.c,v 1.17 2005/09/09 14:50:58 drochner Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1999 and 2000
|
||||
@ -33,7 +33,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: cardbus_map.c,v 1.16 2005/02/27 00:26:59 perry Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: cardbus_map.c,v 1.17 2005/09/09 14:50:58 drochner Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -261,7 +261,7 @@ cardbus_mapreg_map(sc, func, reg, type, busflags, tagp, handlep, basep, sizep)
|
||||
int flags;
|
||||
int status = 0;
|
||||
|
||||
cardbustag_t tag = cardbus_make_tag(cc, cf, sc->sc_bus, sc->sc_device, func);
|
||||
cardbustag_t tag = cardbus_make_tag(cc, cf, sc->sc_bus, func);
|
||||
|
||||
DPRINTF(("cardbus_mapreg_map called: %s %x\n", sc->sc_dev.dv_xname,
|
||||
type));
|
||||
@ -371,7 +371,7 @@ cardbus_mapreg_unmap(sc, func, reg, tag, handle, size)
|
||||
}
|
||||
#endif
|
||||
|
||||
cardbustag = cardbus_make_tag(cc, cf, sc->sc_bus, sc->sc_device, func);
|
||||
cardbustag = cardbus_make_tag(cc, cf, sc->sc_bus, func);
|
||||
|
||||
cardbus_conf_write(cc, cf, cardbustag, reg, 0);
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: cardbusvar.h,v 1.33 2005/05/30 04:36:16 christos Exp $ */
|
||||
/* $NetBSD: cardbusvar.h,v 1.34 2005/09/09 14:50:58 drochner Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1998, 1999 and 2000
|
||||
@ -76,7 +76,7 @@ typedef int cardbus_intr_handle_t;
|
||||
* int (*cardbus_power)(cardbus_chipset_tag_t ct, int voltage);
|
||||
*
|
||||
* cardbustag_t (*cardbus_make_tag)(cardbus_chipset_tag_t ct,
|
||||
* int busno, int devno, int functionno);
|
||||
* int busno, int functionno);
|
||||
* void (*cardbus_free_tag)(cardbus_chipset_tag_t ct, cardbustag_t tag);
|
||||
* cardbusreg_t (*cardbus_conf_read)(cardbus_chipset_tag_t ct,
|
||||
* cardbustag_t tag, int offs);
|
||||
@ -95,8 +95,7 @@ typedef struct cardbus_functions {
|
||||
int (*cardbus_ctrl)(cardbus_chipset_tag_t, int);
|
||||
int (*cardbus_power)(cardbus_chipset_tag_t, int);
|
||||
|
||||
cardbustag_t (*cardbus_make_tag)(cardbus_chipset_tag_t, int, int,
|
||||
int);
|
||||
cardbustag_t (*cardbus_make_tag)(cardbus_chipset_tag_t, int, int);
|
||||
void (*cardbus_free_tag)(cardbus_chipset_tag_t, cardbustag_t);
|
||||
cardbusreg_t (*cardbus_conf_read)(cardbus_chipset_tag_t,
|
||||
cardbustag_t, int);
|
||||
@ -119,8 +118,7 @@ typedef struct cardbus_functions {
|
||||
int (*)(void *), void *);
|
||||
void (*cardbus_intr_disestablish)(cardbus_chipset_tag_t, void *);
|
||||
|
||||
cardbustag_t (*cardbus_make_tag)(cardbus_chipset_tag_t, int, int,
|
||||
int);
|
||||
cardbustag_t (*cardbus_make_tag)(cardbus_chipset_tag_t, int, int);
|
||||
cardbusreg_t (*cardbus_conf_read)(cardbus_chipset_tag_t,
|
||||
cardbustag_t, int);
|
||||
void (*cardbus_conf_write)(cardbus_chipset_tag_t, cardbustag_t,
|
||||
@ -162,7 +160,6 @@ struct cardbus_softc {
|
||||
struct device sc_dev; /* fundamental device structure */
|
||||
|
||||
int sc_bus; /* cardbus bus number */
|
||||
int sc_device; /* cardbus device number */
|
||||
int sc_intrline; /* CardBus intrline */
|
||||
|
||||
bus_space_tag_t sc_iot; /* CardBus I/O space tag */
|
||||
@ -200,7 +197,6 @@ typedef struct cardbus_devfunc {
|
||||
cardbus_function_tag_t ct_cf;
|
||||
struct cardbus_softc *ct_sc; /* pointer to the parent */
|
||||
int ct_bus; /* bus number */
|
||||
int ct_dev; /* device number */
|
||||
int ct_func; /* function number */
|
||||
|
||||
#if rbus
|
||||
@ -250,7 +246,6 @@ struct cardbus_attach_args {
|
||||
bus_dma_tag_t ca_dmat; /* DMA tag */
|
||||
|
||||
u_int ca_bus;
|
||||
u_int ca_device;
|
||||
u_int ca_function;
|
||||
cardbustag_t ca_tag;
|
||||
cardbusreg_t ca_id;
|
||||
@ -332,8 +327,8 @@ int cardbus_setpowerstate(const char *, cardbus_devfunc_t, pcitag_t, int);
|
||||
#define Cardbus_mapreg_unmap(ct, reg, tag, handle, size) \
|
||||
cardbus_mapreg_unmap((ct)->ct_sc, (ct->ct_func), (reg), (tag), (handle), (size))
|
||||
|
||||
#define Cardbus_make_tag(ct) (*(ct)->ct_cf->cardbus_make_tag)((ct)->ct_cc, (ct)->ct_bus, (ct)->ct_dev, (ct)->ct_func)
|
||||
#define cardbus_make_tag(cc, cf, bus, device, function) ((cf)->cardbus_make_tag)((cc), (bus), (device), (function))
|
||||
#define Cardbus_make_tag(ct) (*(ct)->ct_cf->cardbus_make_tag)((ct)->ct_cc, (ct)->ct_bus, (ct)->ct_func)
|
||||
#define cardbus_make_tag(cc, cf, bus, function) ((cf)->cardbus_make_tag)((cc), (bus), (function))
|
||||
|
||||
#define Cardbus_free_tag(ct, tag) (*(ct)->ct_cf->cardbus_free_tag)((ct)->ct_cc, (tag))
|
||||
#define cardbus_free_tag(cc, cf, tag) (*(cf)->cardbus_free_tag)(cc, (tag))
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ehci_cardbus.c,v 1.11 2005/02/27 00:26:59 perry Exp $ */
|
||||
/* $NetBSD: ehci_cardbus.c,v 1.12 2005/09/09 14:50:58 drochner Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
||||
@ -38,7 +38,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ehci_cardbus.c,v 1.11 2005/02/27 00:26:59 perry Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ehci_cardbus.c,v 1.12 2005/09/09 14:50:58 drochner Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -182,7 +182,7 @@ XXX (ct->ct_cf->cardbus_mem_open)(cc, 0, iob, iob + 0x40);
|
||||
*/
|
||||
ncomp = 0;
|
||||
TAILQ_FOREACH(up, &ehci_cardbus_alldevs, next) {
|
||||
if (up->bus == ca->ca_bus && up->device == ca->ca_device) {
|
||||
if (up->bus == ca->ca_bus) {
|
||||
DPRINTF(("ehci_cardbus_attach: companion %s\n",
|
||||
USBDEVNAME(up->usb->bdev)));
|
||||
sc->sc.sc_comps[ncomp++] = up->usb;
|
||||
@ -235,7 +235,6 @@ usb_cardbus_add(struct usb_cardbus *up, struct cardbus_attach_args *ca, struct u
|
||||
{
|
||||
TAILQ_INSERT_TAIL(&ehci_cardbus_alldevs, up, next);
|
||||
up->bus = ca->ca_bus;
|
||||
up->device = ca->ca_device;
|
||||
up->function = ca->ca_function;
|
||||
up->usb = bu;
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: if_fxp_cardbus.c,v 1.19 2005/02/04 02:10:36 perry Exp $ */
|
||||
/* $NetBSD: if_fxp_cardbus.c,v 1.20 2005/09/09 14:50:58 drochner Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1999 The NetBSD Foundation, Inc.
|
||||
@ -41,7 +41,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_fxp_cardbus.c,v 1.19 2005/02/04 02:10:36 perry Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_fxp_cardbus.c,v 1.20 2005/09/09 14:50:58 drochner Exp $");
|
||||
|
||||
#include "opt_inet.h"
|
||||
#include "opt_ns.h"
|
||||
@ -202,7 +202,7 @@ fxp_cardbus_setup(struct fxp_softc * sc)
|
||||
pcireg_t command;
|
||||
|
||||
cardbustag_t tag = cardbus_make_tag(cc, cf, csc->ct->ct_bus,
|
||||
csc->ct->ct_dev, csc->ct->ct_func);
|
||||
csc->ct->ct_func);
|
||||
|
||||
command = Cardbus_conf_read(csc->ct, tag, CARDBUS_COMMAND_STATUS_REG);
|
||||
if (csc->base0_reg) {
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: if_tlp_cardbus.c,v 1.46 2005/06/13 15:27:41 tron Exp $ */
|
||||
/* $NetBSD: if_tlp_cardbus.c,v 1.47 2005/09/09 14:50:58 drochner Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1999, 2000 The NetBSD Foundation, Inc.
|
||||
@ -43,7 +43,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_tlp_cardbus.c,v 1.46 2005/06/13 15:27:41 tron Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_tlp_cardbus.c,v 1.47 2005/09/09 14:50:58 drochner Exp $");
|
||||
|
||||
#include "opt_inet.h"
|
||||
#include "opt_ns.h"
|
||||
@ -261,7 +261,7 @@ tlp_cardbus_attach(parent, self, aux)
|
||||
bus_addr_t adr;
|
||||
pcireg_t reg;
|
||||
|
||||
sc->sc_devno = ca->ca_device;
|
||||
sc->sc_devno = 0;
|
||||
sc->sc_dmat = ca->ca_dmat;
|
||||
csc->sc_ct = ct;
|
||||
csc->sc_tag = ca->ca_tag;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: usb_cardbus.h,v 1.1 2001/11/06 03:18:53 augustss Exp $ */
|
||||
/* $NetBSD: usb_cardbus.h,v 1.2 2005/09/09 14:50:58 drochner Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2001 The NetBSD Foundation, Inc.
|
||||
@ -45,7 +45,6 @@
|
||||
struct usb_cardbus {
|
||||
TAILQ_ENTRY(usb_cardbus) next;
|
||||
u_int bus;
|
||||
u_int device;
|
||||
u_int function;
|
||||
struct usbd_bus *usb;
|
||||
};
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: pccbb.c,v 1.124 2005/06/23 14:20:23 wiz Exp $ */
|
||||
/* $NetBSD: pccbb.c,v 1.125 2005/09/09 14:50:58 drochner Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1998, 1999 and 2000
|
||||
@ -31,7 +31,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: pccbb.c,v 1.124 2005/06/23 14:20:23 wiz Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: pccbb.c,v 1.125 2005/09/09 14:50:58 drochner Exp $");
|
||||
|
||||
/*
|
||||
#define CBB_DEBUG
|
||||
@ -157,7 +157,7 @@ static void *pccbb_cb_intr_establish(cardbus_chipset_tag_t, int irq,
|
||||
int level, int (*ih) (void *), void *sc);
|
||||
static void pccbb_cb_intr_disestablish(cardbus_chipset_tag_t ct, void *ih);
|
||||
|
||||
static cardbustag_t pccbb_make_tag(cardbus_chipset_tag_t, int, int, int);
|
||||
static cardbustag_t pccbb_make_tag(cardbus_chipset_tag_t, int, int);
|
||||
static void pccbb_free_tag(cardbus_chipset_tag_t, cardbustag_t);
|
||||
static cardbusreg_t pccbb_conf_read(cardbus_chipset_tag_t, cardbustag_t, int);
|
||||
static void pccbb_conf_write(cardbus_chipset_tag_t, cardbustag_t, int,
|
||||
@ -1984,18 +1984,18 @@ cb_show_regs(pc, tag, memt, memh)
|
||||
|
||||
/*
|
||||
* static cardbustag_t pccbb_make_tag(cardbus_chipset_tag_t cc,
|
||||
* int busno, int devno, int function)
|
||||
* int busno, int function)
|
||||
* This is the function to make a tag to access config space of
|
||||
* a CardBus Card. It works same as pci_conf_read.
|
||||
*/
|
||||
static cardbustag_t
|
||||
pccbb_make_tag(cc, busno, devno, function)
|
||||
pccbb_make_tag(cc, busno, function)
|
||||
cardbus_chipset_tag_t cc;
|
||||
int busno, devno, function;
|
||||
int busno, function;
|
||||
{
|
||||
struct pccbb_softc *sc = (struct pccbb_softc *)cc;
|
||||
|
||||
return pci_make_tag(sc->sc_pc, busno, devno, function);
|
||||
return pci_make_tag(sc->sc_pc, busno, 0, function);
|
||||
}
|
||||
|
||||
static void
|
||||
|
Loading…
Reference in New Issue
Block a user