summaryrefslogtreecommitdiff
path: root/sys/dev/cardbus/if_dc_cardbus.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev/cardbus/if_dc_cardbus.c')
-rw-r--r--sys/dev/cardbus/if_dc_cardbus.c29
1 files changed, 16 insertions, 13 deletions
diff --git a/sys/dev/cardbus/if_dc_cardbus.c b/sys/dev/cardbus/if_dc_cardbus.c
index 8ec8054da66..b11b715c877 100644
--- a/sys/dev/cardbus/if_dc_cardbus.c
+++ b/sys/dev/cardbus/if_dc_cardbus.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_dc_cardbus.c,v 1.32 2010/03/27 20:04:03 jsg Exp $ */
+/* $OpenBSD: if_dc_cardbus.c,v 1.33 2010/03/27 21:40:13 jsg Exp $ */
/*
* Copyright (c) 1997, 1998, 1999
@@ -79,6 +79,7 @@ struct dc_cardbus_softc {
int sc_intrline;
cardbus_devfunc_t sc_ct;
+ pci_chipset_tag_t sc_pc;
pcitag_t sc_tag;
bus_size_t sc_mapsize;
int sc_actype;
@@ -126,6 +127,7 @@ dc_cardbus_attach(struct device *parent, struct device *self, void *aux)
struct cardbus_attach_args *ca = aux;
struct cardbus_devfunc *ct = ca->ca_ct;
cardbus_chipset_tag_t cc = ct->ct_cc;
+ pci_chipset_tag_t pc = ca->ca_pc;
cardbus_function_tag_t cf = ct->ct_cf;
pcireg_t reg;
bus_addr_t addr;
@@ -133,6 +135,7 @@ dc_cardbus_attach(struct device *parent, struct device *self, void *aux)
sc->sc_dmat = ca->ca_dmat;
csc->sc_ct = ct;
csc->sc_tag = ca->ca_tag;
+ csc->sc_pc = ca->ca_pc;
Cardbus_function_enable(ct);
@@ -152,7 +155,7 @@ dc_cardbus_attach(struct device *parent, struct device *self, void *aux)
csc->sc_intrline = ca->ca_intrline;
- sc->dc_cachesize = cardbus_conf_read(cc, cf, ca->ca_tag, DC_PCI_CFLT)
+ sc->dc_cachesize = pci_conf_read(csc->sc_pc, ca->ca_tag, DC_PCI_CFLT)
& 0xFF;
dc_cardbus_setup(csc);
@@ -215,11 +218,11 @@ dc_cardbus_attach(struct device *parent, struct device *self, void *aux)
/*
* set latency timer, do we really need this?
*/
- reg = cardbus_conf_read(cc, cf, ca->ca_tag, PCI_BHLC_REG);
+ reg = pci_conf_read(pc, ca->ca_tag, PCI_BHLC_REG);
if (PCI_LATTIMER(reg) < 0x20) {
reg &= ~(PCI_LATTIMER_MASK << PCI_LATTIMER_SHIFT);
reg |= (0x20 << PCI_LATTIMER_SHIFT);
- cardbus_conf_write(cc, cf, ca->ca_tag, PCI_BHLC_REG, reg);
+ pci_conf_write(pc, ca->ca_tag, PCI_BHLC_REG, reg);
}
sc->sc_ih = cardbus_intr_establish(cc, cf, ca->ca_intrline, IPL_NET,
@@ -260,33 +263,33 @@ dc_cardbus_setup(struct dc_cardbus_softc *csc)
{
cardbus_devfunc_t ct = csc->sc_ct;
cardbus_chipset_tag_t cc = ct->ct_cc;
- cardbus_function_tag_t cf = ct->ct_cf;
+ pci_chipset_tag_t pc = csc->sc_pc;
pcireg_t reg;
int r;
/* wakeup the card if needed */
- reg = cardbus_conf_read(cc, cf, csc->sc_tag, PCI_CFDA);
+ reg = pci_conf_read(pc, csc->sc_tag, PCI_CFDA);
if (reg | (DC_CFDA_SUSPEND|DC_CFDA_STANDBY)) {
- cardbus_conf_write(cc, cf, csc->sc_tag, PCI_CFDA,
+ pci_conf_write(pc, csc->sc_tag, PCI_CFDA,
reg & ~(DC_CFDA_SUSPEND|DC_CFDA_STANDBY));
}
- if (cardbus_get_capability(cc, cf, csc->sc_tag, PCI_CAP_PWRMGMT, &r,
+ if (pci_get_capability(csc->sc_pc, csc->sc_tag, PCI_CAP_PWRMGMT, &r,
0)) {
- r = cardbus_conf_read(cc, cf, csc->sc_tag, r + 4) & 3;
+ r = pci_conf_read(csc->sc_pc, csc->sc_tag, r + 4) & 3;
if (r) {
printf("%s: awakening from state D%d\n",
csc->sc_dc.sc_dev.dv_xname, r);
- cardbus_conf_write(cc, cf, csc->sc_tag, r + 4, 0);
+ pci_conf_write(csc->sc_pc, csc->sc_tag, r + 4, 0);
}
}
(*ct->ct_cf->cardbus_ctrl)(cc, csc->sc_actype);
(*ct->ct_cf->cardbus_ctrl)(cc, CARDBUS_BM_ENABLE);
- reg = cardbus_conf_read(cc, cf, csc->sc_tag, PCI_COMMAND_STATUS_REG);
+ reg = pci_conf_read(csc->sc_pc, csc->sc_tag, PCI_COMMAND_STATUS_REG);
reg |= PCI_COMMAND_IO_ENABLE | PCI_COMMAND_MEM_ENABLE |
PCI_COMMAND_MASTER_ENABLE;
- cardbus_conf_write(cc, cf, csc->sc_tag, PCI_COMMAND_STATUS_REG, reg);
- reg = cardbus_conf_read(cc, cf, csc->sc_tag, PCI_COMMAND_STATUS_REG);
+ pci_conf_write(csc->sc_pc, csc->sc_tag, PCI_COMMAND_STATUS_REG, reg);
+ reg = pci_conf_read(csc->sc_pc, csc->sc_tag, PCI_COMMAND_STATUS_REG);
}