summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2010-03-22 22:28:28 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2010-03-22 22:28:28 +0000
commit69a26e66b13a7c4261ca3d797c32ad0c9de955b7 (patch)
tree21f4e2c96d7785a8ae79ba3da3cbf18122fd3ad1 /sys
parent15c19a9373d03a7892e33c480376958899e0a94d (diff)
Remove some cardbus defines and types which are identical to
their pci counterparts, similar to recent changes in NetBSD. ok oga@ deraadt@ jasper@
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/cardbus/cardbus.c130
-rw-r--r--sys/dev/cardbus/cardbus_map.c50
-rw-r--r--sys/dev/cardbus/cardbusvar.h172
-rw-r--r--sys/dev/cardbus/com_cardbus.c76
-rw-r--r--sys/dev/cardbus/ehci_cardbus.c29
-rw-r--r--sys/dev/cardbus/if_acx_cardbus.c38
-rw-r--r--sys/dev/cardbus/if_ath_cardbus.c30
-rw-r--r--sys/dev/cardbus/if_athn_cardbus.c34
-rw-r--r--sys/dev/cardbus/if_atw_cardbus.c42
-rw-r--r--sys/dev/cardbus/if_bwi_cardbus.c30
-rw-r--r--sys/dev/cardbus/if_dc_cardbus.c14
-rw-r--r--sys/dev/cardbus/if_fxp_cardbus.c22
-rw-r--r--sys/dev/cardbus/if_malo_cardbus.c28
-rw-r--r--sys/dev/cardbus/if_pgt_cardbus.c24
-rw-r--r--sys/dev/cardbus/if_ral_cardbus.c30
-rw-r--r--sys/dev/cardbus/if_re_cardbus.c32
-rw-r--r--sys/dev/cardbus/if_rl_cardbus.c40
-rw-r--r--sys/dev/cardbus/if_rtw_cardbus.c42
-rw-r--r--sys/dev/cardbus/if_xl_cardbus.c52
-rw-r--r--sys/dev/cardbus/ohci_cardbus.c29
-rw-r--r--sys/dev/cardbus/puc_cardbus.c14
-rw-r--r--sys/dev/cardbus/uhci_cardbus.c29
-rw-r--r--sys/dev/pci/pccbb.c80
23 files changed, 475 insertions, 592 deletions
diff --git a/sys/dev/cardbus/cardbus.c b/sys/dev/cardbus/cardbus.c
index d6064e326f9..a22a0997d50 100644
--- a/sys/dev/cardbus/cardbus.c
+++ b/sys/dev/cardbus/cardbus.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cardbus.c,v 1.41 2010/01/13 09:10:33 jsg Exp $ */
+/* $OpenBSD: cardbus.c,v 1.42 2010/03/22 22:28:27 jsg Exp $ */
/* $NetBSD: cardbus.c,v 1.24 2000/04/02 19:11:37 mycroft Exp $ */
/*
@@ -76,7 +76,7 @@ static void print_tuple(u_int8_t *, int, void *);
#endif
STATIC int cardbus_read_tuples(struct cardbus_attach_args *,
- cardbusreg_t, u_int8_t *, size_t);
+ pcireg_t, u_int8_t *, size_t);
STATIC void enable_function(struct cardbus_softc *, int, int);
STATIC void disable_function(struct cardbus_softc *, int);
@@ -136,14 +136,14 @@ cardbusattach(struct device *parent, struct device *self, void *aux)
}
STATIC int
-cardbus_read_tuples(struct cardbus_attach_args *ca, cardbusreg_t cis_ptr,
+cardbus_read_tuples(struct cardbus_attach_args *ca, pcireg_t cis_ptr,
u_int8_t *tuples, size_t len)
{
struct cardbus_softc *sc = ca->ca_ct->ct_sc;
- cardbus_chipset_tag_t cc = ca->ca_ct->ct_cc;
+ pci_chipset_tag_t cc = ca->ca_ct->ct_cc;
cardbus_function_tag_t cf = ca->ca_ct->ct_cf;
- cardbustag_t tag = ca->ca_tag;
- cardbusreg_t command;
+ pcitag_t tag = ca->ca_tag;
+ pcireg_t command;
int found = 0;
int i, j;
@@ -198,7 +198,7 @@ cardbus_read_tuples(struct cardbus_attach_args *ca, cardbusreg_t cis_ptr,
contents */
cardbus_conf_write(cc, cf, tag, reg, 0);
if (Cardbus_mapreg_map(ca->ca_ct, reg,
- CARDBUS_MAPREG_TYPE_MEM | PCI_MAPREG_MEM_TYPE_32BIT, 0,
+ PCI_MAPREG_TYPE_MEM | PCI_MAPREG_MEM_TYPE_32BIT, 0,
&bar_tag, &bar_memh, &bar_addr, &bar_size)) {
printf("%s: can't map memory\n",
sc->sc_dev.dv_xname);
@@ -206,7 +206,7 @@ cardbus_read_tuples(struct cardbus_attach_args *ca, cardbusreg_t cis_ptr,
}
if (cardbus_space == CARDBUS_CIS_ASI_ROM) {
- cardbusreg_t exrom;
+ pcireg_t exrom;
int save;
struct cardbus_rom_image_head rom_image;
struct cardbus_rom_image *p;
@@ -217,10 +217,10 @@ cardbus_read_tuples(struct cardbus_attach_args *ca, cardbusreg_t cis_ptr,
cardbus_conf_write(cc, cf, tag, reg, exrom | 1);
command = cardbus_conf_read(cc, cf, tag,
- CARDBUS_COMMAND_STATUS_REG);
+ PCI_COMMAND_STATUS_REG);
cardbus_conf_write(cc, cf, tag,
- CARDBUS_COMMAND_STATUS_REG,
- command | CARDBUS_COMMAND_MEM_ENABLE);
+ PCI_COMMAND_STATUS_REG,
+ command | PCI_COMMAND_MEM_ENABLE);
if (cardbus_read_exrom(ca->ca_memt, bar_memh,
&rom_image))
@@ -248,19 +248,19 @@ cardbus_read_tuples(struct cardbus_attach_args *ca, cardbusreg_t cis_ptr,
splx(save);
} else {
command = cardbus_conf_read(cc, cf, tag,
- CARDBUS_COMMAND_STATUS_REG);
+ PCI_COMMAND_STATUS_REG);
cardbus_conf_write(cc, cf, tag,
- CARDBUS_COMMAND_STATUS_REG,
- command | CARDBUS_COMMAND_MEM_ENABLE);
+ PCI_COMMAND_STATUS_REG,
+ command | PCI_COMMAND_MEM_ENABLE);
/* XXX byte order? */
bus_space_read_region_1(ca->ca_memt, bar_memh,
cis_ptr, tuples, 256);
found++;
}
command = cardbus_conf_read(cc, cf, tag,
- CARDBUS_COMMAND_STATUS_REG);
- cardbus_conf_write(cc, cf, tag, CARDBUS_COMMAND_STATUS_REG,
- command & ~CARDBUS_COMMAND_MEM_ENABLE);
+ PCI_COMMAND_STATUS_REG);
+ cardbus_conf_write(cc, cf, tag, PCI_COMMAND_STATUS_REG,
+ command & ~PCI_COMMAND_MEM_ENABLE);
cardbus_conf_write(cc, cf, tag, reg, 0);
Cardbus_mapreg_unmap(ca->ca_ct, reg, bar_tag, bar_memh,
@@ -371,12 +371,12 @@ parse_tuple(u_int8_t *tuple, int len, void *data)
int
cardbus_attach_card(struct cardbus_softc *sc)
{
- cardbus_chipset_tag_t cc;
+ pci_chipset_tag_t cc;
cardbus_function_tag_t cf;
int cdstatus;
- cardbustag_t tag;
- cardbusreg_t id, class, cis_ptr;
- cardbusreg_t bhlc;
+ pcitag_t tag;
+ pcireg_t id, class, cis_ptr;
+ pcireg_t bhlc;
u_int8_t *tuple;
int function, nfunction;
struct cardbus_devfunc **previous_next = &(sc->sc_funcs);
@@ -406,7 +406,7 @@ cardbus_attach_card(struct cardbus_softc *sc)
/* Wait until power comes up. Maximum 500 ms. */
for (i = 0; i < 5; ++i) {
- id = cardbus_conf_read(cc, cf, tag, CARDBUS_ID_REG);
+ id = cardbus_conf_read(cc, cf, tag, PCI_ID_REG);
if (id != 0xffffffff && id != 0)
break;
if (cold) { /* before kernel thread invoked */
@@ -421,9 +421,9 @@ cardbus_attach_card(struct cardbus_softc *sc)
if (i == 5)
return (0);
- bhlc = cardbus_conf_read(cc, cf, tag, CARDBUS_BHLC_REG);
+ bhlc = cardbus_conf_read(cc, cf, tag, PCI_BHLC_REG);
DPRINTF(("%s bhlc 0x%08x -> ", sc->sc_dev.dv_xname, bhlc));
- nfunction = CARDBUS_HDRTYPE_MULTIFN(bhlc) ? 8 : 1;
+ nfunction = PCI_HDRTYPE_MULTIFN(bhlc) ? 8 : 1;
tuple = malloc(2048, M_TEMP, M_NOWAIT);
if (tuple == NULL)
@@ -435,16 +435,16 @@ cardbus_attach_card(struct cardbus_softc *sc)
tag = cardbus_make_tag(cc, cf, sc->sc_bus, sc->sc_device,
function);
- id = cardbus_conf_read(cc, cf, tag, CARDBUS_ID_REG);
- class = cardbus_conf_read(cc, cf, tag, CARDBUS_CLASS_REG);
+ id = cardbus_conf_read(cc, cf, tag, PCI_ID_REG);
+ class = cardbus_conf_read(cc, cf, tag, PCI_CLASS_REG);
cis_ptr = cardbus_conf_read(cc, cf, tag, CARDBUS_CIS_REG);
/* Invalid vendor ID value? */
- if (CARDBUS_VENDOR(id) == PCI_VENDOR_INVALID)
+ if (PCI_VENDOR(id) == PCI_VENDOR_INVALID)
continue;
DPRINTF(("cardbus_attach_card: Vendor 0x%x, Product 0x%x, "
- "CIS 0x%x\n", CARDBUS_VENDOR(id), CARDBUS_PRODUCT(id),
+ "CIS 0x%x\n", PCI_VENDOR(id), PCI_PRODUCT(id),
cis_ptr));
enable_function(sc, cdstatus, function);
@@ -459,25 +459,25 @@ cardbus_attach_card(struct cardbus_softc *sc)
cardbus_conf_write(cc, cf, tag, CARDBUS_ROM_REG, 0);
/* set initial latency and cacheline size */
- bhlc = cardbus_conf_read(cc, cf, tag, CARDBUS_BHLC_REG);
+ bhlc = cardbus_conf_read(cc, cf, tag, PCI_BHLC_REG);
DPRINTF(("%s func%d bhlc 0x%08x -> ", sc->sc_dev.dv_xname,
function, bhlc));
- bhlc &= ~((CARDBUS_LATTIMER_MASK << CARDBUS_LATTIMER_SHIFT) |
- (CARDBUS_CACHELINE_MASK << CARDBUS_CACHELINE_SHIFT));
- bhlc |= ((sc->sc_cacheline & CARDBUS_CACHELINE_MASK) <<
- CARDBUS_CACHELINE_SHIFT);
- bhlc |= ((sc->sc_lattimer & CARDBUS_LATTIMER_MASK) <<
- CARDBUS_LATTIMER_SHIFT);
-
- cardbus_conf_write(cc, cf, tag, CARDBUS_BHLC_REG, bhlc);
- bhlc = cardbus_conf_read(cc, cf, tag, CARDBUS_BHLC_REG);
+ bhlc &= ~((PCI_LATTIMER_MASK << PCI_LATTIMER_SHIFT) |
+ (PCI_CACHELINE_MASK << PCI_CACHELINE_SHIFT));
+ bhlc |= ((sc->sc_cacheline & PCI_CACHELINE_MASK) <<
+ PCI_CACHELINE_SHIFT);
+ bhlc |= ((sc->sc_lattimer & PCI_LATTIMER_MASK) <<
+ PCI_LATTIMER_SHIFT);
+
+ cardbus_conf_write(cc, cf, tag, PCI_BHLC_REG, bhlc);
+ bhlc = cardbus_conf_read(cc, cf, tag, PCI_BHLC_REG);
DPRINTF(("0x%08x\n", bhlc));
- if (CARDBUS_LATTIMER(bhlc) < 0x10) {
- bhlc &= ~(CARDBUS_LATTIMER_MASK <<
- CARDBUS_LATTIMER_SHIFT);
- bhlc |= (0x10 << CARDBUS_LATTIMER_SHIFT);
- cardbus_conf_write(cc, cf, tag, CARDBUS_BHLC_REG,
+ if (PCI_LATTIMER(bhlc) < 0x10) {
+ bhlc &= ~(PCI_LATTIMER_MASK <<
+ PCI_LATTIMER_SHIFT);
+ bhlc |= (0x10 << PCI_LATTIMER_SHIFT);
+ cardbus_conf_write(cc, cf, tag, PCI_BHLC_REG,
bhlc);
}
@@ -635,11 +635,11 @@ cardbus_detach_card(struct cardbus_softc *sc)
* void *cardbus_intr_establish(cc, cf, irq, level, func, arg, name)
* Interrupt handler of pccard.
* args:
- * cardbus_chipset_tag_t *cc
+ * pci_chipset_tag_t *cc
* int irq:
*/
void *
-cardbus_intr_establish(cardbus_chipset_tag_t cc, cardbus_function_tag_t cf,
+cardbus_intr_establish(pci_chipset_tag_t cc, cardbus_function_tag_t cf,
cardbus_intr_handle_t irq, int level, int (*func)(void *), void *arg,
const char *name)
{
@@ -652,10 +652,10 @@ cardbus_intr_establish(cardbus_chipset_tag_t cc, cardbus_function_tag_t cf,
* void cardbus_intr_disestablish(cc, cf, handler)
* Interrupt handler of pccard.
* args:
- * cardbus_chipset_tag_t *cc
+ * pci_chipset_tag_t *cc
*/
void
-cardbus_intr_disestablish(cardbus_chipset_tag_t cc, cardbus_function_tag_t cf,
+cardbus_intr_disestablish(pci_chipset_tag_t cc, cardbus_function_tag_t cf,
void *handler)
{
DPRINTF(("- pccard_intr_disestablish\n"));
@@ -701,10 +701,10 @@ disable_function(struct cardbus_softc *sc, int function)
int
cardbus_function_enable(struct cardbus_softc *sc, int func)
{
- cardbus_chipset_tag_t cc = sc->sc_cc;
+ pci_chipset_tag_t cc = sc->sc_cc;
cardbus_function_tag_t cf = sc->sc_cf;
- cardbusreg_t command;
- cardbustag_t tag;
+ pcireg_t command;
+ pcitag_t tag;
DPRINTF(("entering cardbus_function_enable... "));
@@ -717,11 +717,11 @@ cardbus_function_enable(struct cardbus_softc *sc, int func)
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 */
+ command = cardbus_conf_read(cc, cf, tag, PCI_COMMAND_STATUS_REG);
+ command |= (PCI_COMMAND_MEM_ENABLE | PCI_COMMAND_IO_ENABLE |
+ PCI_COMMAND_MASTER_ENABLE); /* XXX: good guess needed */
- cardbus_conf_write(cc, cf, tag, CARDBUS_COMMAND_STATUS_REG, command);
+ cardbus_conf_write(cc, cf, tag, PCI_COMMAND_STATUS_REG, command);
cardbus_free_tag(cc, cf, tag);
@@ -747,17 +747,17 @@ cardbus_function_disable(struct cardbus_softc *sc, int func)
}
/*
- * int cardbus_get_capability(cardbus_chipset_tag_t cc,
- * cardbus_function_tag_t cf, cardbustag_t tag, int capid, int *offset,
- * cardbusreg_t *value)
+ * int cardbus_get_capability(pci_chipset_tag_t cc,
+ * cardbus_function_tag_t cf, pcitag_t tag, int capid, int *offset,
+ * pcireg_t *value)
*
* Find the specified PCI capability.
*/
int
-cardbus_get_capability(cardbus_chipset_tag_t cc, cardbus_function_tag_t cf,
- cardbustag_t tag, int capid, int *offset, cardbusreg_t *value)
+cardbus_get_capability(pci_chipset_tag_t cc, cardbus_function_tag_t cf,
+ pcitag_t tag, int capid, int *offset, pcireg_t *value)
{
- cardbusreg_t reg;
+ pcireg_t reg;
unsigned int ofs;
reg = cardbus_conf_read(cc, cf, tag, PCI_COMMAND_STATUS_REG);
@@ -787,14 +787,14 @@ cardbus_get_capability(cardbus_chipset_tag_t cc, cardbus_function_tag_t cf,
int
cardbus_matchbyid(struct cardbus_attach_args *ca,
- const struct cardbus_matchid *ids, int nent)
+ const struct pci_matchid *ids, int nent)
{
- const struct cardbus_matchid *cm;
+ const struct pci_matchid *pm;
int i;
- for (i = 0, cm = ids; i < nent; i++, cm++)
- if (CARDBUS_VENDOR(ca->ca_id) == cm->cm_vid &&
- CARDBUS_PRODUCT(ca->ca_id) == cm->cm_pid)
+ for (i = 0, pm = ids; i < nent; i++, pm++)
+ if (PCI_VENDOR(ca->ca_id) == pm->pm_vid &&
+ PCI_PRODUCT(ca->ca_id) == pm->pm_pid)
return (1);
return (0);
}
diff --git a/sys/dev/cardbus/cardbus_map.c b/sys/dev/cardbus/cardbus_map.c
index 86c2bf97394..9b3f68cb7bf 100644
--- a/sys/dev/cardbus/cardbus_map.c
+++ b/sys/dev/cardbus/cardbus_map.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cardbus_map.c,v 1.10 2010/01/13 09:10:33 jsg Exp $ */
+/* $OpenBSD: cardbus_map.c,v 1.11 2010/03/22 22:28:27 jsg Exp $ */
/* $NetBSD: cardbus_map.c,v 1.10 2000/03/07 00:31:46 mycroft Exp $ */
/*
@@ -56,16 +56,16 @@
#endif
-STATIC int cardbus_io_find(cardbus_chipset_tag_t, cardbus_function_tag_t,
- cardbustag_t, int, cardbusreg_t, bus_addr_t *, bus_size_t *,
+STATIC int cardbus_io_find(pci_chipset_tag_t, cardbus_function_tag_t,
+ pcitag_t, int, pcireg_t, bus_addr_t *, bus_size_t *,
int *);
-STATIC int cardbus_mem_find(cardbus_chipset_tag_t, cardbus_function_tag_t,
- cardbustag_t, int, cardbusreg_t, bus_addr_t *, bus_size_t *,
+STATIC int cardbus_mem_find(pci_chipset_tag_t, cardbus_function_tag_t,
+ pcitag_t, int, pcireg_t, bus_addr_t *, bus_size_t *,
int *);
int
-cardbus_mapreg_probe(cardbus_chipset_tag_t cc, cardbus_function_tag_t cf,
- cardbustag_t tag, int reg, pcireg_t *typep)
+cardbus_mapreg_probe(pci_chipset_tag_t cc, cardbus_function_tag_t cf,
+ pcitag_t tag, int reg, pcireg_t *typep)
{
pcireg_t address, mask;
int s;
@@ -86,18 +86,18 @@ cardbus_mapreg_probe(cardbus_chipset_tag_t cc, cardbus_function_tag_t cf,
}
/*
- * STATIC int cardbus_io_find(cardbus_chipset_tag_t cc,
- * cardbus_function_tag_t cf, cardbustag_t tag,
- * int reg, cardbusreg_t type, bus_addr_t *basep,
+ * STATIC int cardbus_io_find(pci_chipset_tag_t cc,
+ * cardbus_function_tag_t cf, pcitag_t tag,
+ * int reg, pcireg_t type, bus_addr_t *basep,
* bus_size_t *sizep, int *flagsp)
* This code is stolen from sys/dev/pci_map.c.
*/
STATIC int
-cardbus_io_find(cardbus_chipset_tag_t cc, cardbus_function_tag_t cf,
- cardbustag_t tag, int reg, cardbusreg_t type, bus_addr_t *basep,
+cardbus_io_find(pci_chipset_tag_t cc, cardbus_function_tag_t cf,
+ pcitag_t tag, int reg, pcireg_t type, bus_addr_t *basep,
bus_size_t *sizep, int *flagsp)
{
- cardbusreg_t address, mask;
+ pcireg_t address, mask;
int s;
/* EXT ROM is able to map on memory space ONLY. */
@@ -146,18 +146,18 @@ cardbus_io_find(cardbus_chipset_tag_t cc, cardbus_function_tag_t cf,
}
/*
- * STATIC int cardbus_mem_find(cardbus_chipset_tag_t cc,
- * cardbus_function_tag_t cf, cardbustag_t tag,
- * int reg, cardbusreg_t type, bus_addr_t *basep,
+ * STATIC int cardbus_mem_find(pci_chipset_tag_t cc,
+ * cardbus_function_tag_t cf, pcitag_t tag,
+ * int reg, pcireg_t type, bus_addr_t *basep,
* bus_size_t *sizep, int *flagsp)
* This code is stolen from sys/dev/pci_map.c.
*/
STATIC int
-cardbus_mem_find(cardbus_chipset_tag_t cc, cardbus_function_tag_t cf,
- cardbustag_t tag, int reg, cardbusreg_t type, bus_addr_t *basep,
+cardbus_mem_find(pci_chipset_tag_t cc, cardbus_function_tag_t cf,
+ pcitag_t tag, int reg, pcireg_t type, bus_addr_t *basep,
bus_size_t *sizep, int *flagsp)
{
- cardbusreg_t address, mask;
+ pcireg_t address, mask;
int s;
if (reg != CARDBUS_ROM_REG &&
@@ -232,7 +232,7 @@ cardbus_mem_find(cardbus_chipset_tag_t cc, cardbus_function_tag_t cf,
}
/*
- * int cardbus_mapreg_map(struct cardbus_softc *, int, int, cardbusreg_t,
+ * int cardbus_mapreg_map(struct cardbus_softc *, int, int, pcireg_t,
* int bus_space_tag_t *, bus_space_handle_t *,
* bus_addr_t *, bus_size_t *)
* This function maps bus-space on the value of Base Address
@@ -243,10 +243,10 @@ cardbus_mem_find(cardbus_chipset_tag_t cc, cardbus_function_tag_t cf,
*/
int
cardbus_mapreg_map(struct cardbus_softc *sc, int func, int reg,
- cardbusreg_t type, int busflags, bus_space_tag_t *tagp,
+ pcireg_t type, int busflags, bus_space_tag_t *tagp,
bus_space_handle_t *handlep, bus_addr_t *basep, bus_size_t *sizep)
{
- cardbus_chipset_tag_t cc = sc->sc_cc;
+ pci_chipset_tag_t cc = sc->sc_cc;
cardbus_function_tag_t cf = sc->sc_cf;
bus_space_tag_t bustag;
rbus_tag_t rbustag;
@@ -256,7 +256,7 @@ cardbus_mapreg_map(struct cardbus_softc *sc, int func, int reg,
int flags;
int status = 0;
- cardbustag_t tag = cardbus_make_tag(cc, cf, sc->sc_bus,
+ pcitag_t tag = cardbus_make_tag(cc, cf, sc->sc_bus,
sc->sc_device, func);
DPRINTF(("cardbus_mapreg_map called: %s %x\n", sc->sc_dev.dv_xname,
@@ -318,10 +318,10 @@ int
cardbus_mapreg_unmap(struct cardbus_softc *sc, int func, int reg,
bus_space_tag_t tag, bus_space_handle_t handle, bus_size_t size)
{
- cardbus_chipset_tag_t cc = sc->sc_cc;
+ pci_chipset_tag_t cc = sc->sc_cc;
cardbus_function_tag_t cf = sc->sc_cf;
int st = 1;
- cardbustag_t cardbustag;
+ pcitag_t cardbustag;
rbus_tag_t rbustag;
if (sc->sc_iot == tag) {
diff --git a/sys/dev/cardbus/cardbusvar.h b/sys/dev/cardbus/cardbusvar.h
index 9e7e4088f0f..79d8cffddb6 100644
--- a/sys/dev/cardbus/cardbusvar.h
+++ b/sys/dev/cardbus/cardbusvar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: cardbusvar.h,v 1.15 2010/01/13 09:10:33 jsg Exp $ */
+/* $OpenBSD: cardbusvar.h,v 1.16 2010/03/22 22:28:27 jsg Exp $ */
/* $NetBSD: cardbusvar.h,v 1.17 2000/04/02 19:11:37 mycroft Exp $ */
/*
@@ -34,111 +34,8 @@
#include <dev/pci/pcivar.h> /* for pcitag_t */
#include <dev/cardbus/rbus.h>
-typedef void *cardbus_chipset_tag_t;
typedef int cardbus_intr_handle_t;
-/* XXX they must be in cardbusreg.h */
-typedef u_int32_t cardbusreg_t;
-typedef pcitag_t cardbustag_t;
-typedef int cardbus_intr_line_t;
-
-#define CARDBUS_ID_REG 0x00
-
-typedef u_int16_t cardbus_vendor_id_t;
-typedef u_int16_t cardbus_product_id_t;
-
-# define CARDBUS_VENDOR_SHIFT 0
-# define CARDBUS_VENDOR_MASK 0xffff
-# define CARDBUS_VENDOR(id) \
- (((id) >> CARDBUS_VENDOR_SHIFT) & CARDBUS_VENDOR_MASK)
-
-# define CARDBUS_PRODUCT_SHIFT 16
-# define CARDBUS_PRODUCT_MASK 0xffff
-# define CARDBUS_PRODUCT(id) \
- (((id) >> CARDBUS_PRODUCT_SHIFT) & CARDBUS_PRODUCT_MASK)
-
-
-#define CARDBUS_COMMAND_STATUS_REG 0x04
-
-# define CARDBUS_COMMAND_IO_ENABLE 0x00000001
-# define CARDBUS_COMMAND_MEM_ENABLE 0x00000002
-# define CARDBUS_COMMAND_MASTER_ENABLE 0x00000004
-
-
-#define CARDBUS_CLASS_REG 0x08
-
-#define CARDBUS_CLASS_SHIFT 24
-#define CARDBUS_CLASS_MASK 0xff
-#define CARDBUS_CLASS(cr) \
- (((cr) >> CARDBUS_CLASS_SHIFT) & CARDBUS_CLASS_MASK)
-
-#define CARDBUS_SUBCLASS_SHIFT 16
-#define CARDBUS_SUBCLASS_MASK 0xff
-#define CARDBUS_SUBCLASS(cr) \
- (((cr) >> CARDBUS_SUBCLASS_SHIFT) & CARDBUS_SUBCLASS_MASK)
-
-#define CARDBUS_INTERFACE_SHIFT 8
-#define CARDBUS_INTERFACE_MASK 0xff
-#define CARDBUS_INTERFACE(cr) \
- (((cr) >> CARDBUS_INTERFACE_SHIFT) & CARDBUS_INTERFACE_MASK)
-
-#define CARDBUS_REVISION_SHIFT 0
-#define CARDBUS_REVISION_MASK 0xff
-#define CARDBUS_REVISION(cr) \
- (((cr) >> CARDBUS_REVISION_SHIFT) & CARDBUS_REVISION_MASK)
-
-/* base classes */
-#define CARDBUS_CLASS_PREHISTORIC 0x00
-#define CARDBUS_CLASS_MASS_STORAGE 0x01
-#define CARDBUS_CLASS_NETWORK 0x02
-#define CARDBUS_CLASS_DISPLAY 0x03
-#define CARDBUS_CLASS_MULTIMEDIA 0x04
-#define CARDBUS_CLASS_MEMORY 0x05
-#define CARDBUS_CLASS_BRIDGE 0x06
-#define CARDBUS_CLASS_COMMUNICATIONS 0x07
-#define CARDBUS_CLASS_SYSTEM 0x08
-#define CARDBUS_CLASS_INPUT 0x09
-#define CARDBUS_CLASS_DOCK 0x0a
-#define CARDBUS_CLASS_PROCESSOR 0x0b
-#define CARDBUS_CLASS_SERIALBUS 0x0c
-#define CARDBUS_CLASS_UNDEFINED 0xff
-
-/* 0x0c serial bus subclasses */
-#define CARDBUS_SUBCLASS_SERIALBUS_FIREWIRE 0x00
-#define CARDBUS_SUBCLASS_SERIALBUS_ACCESS 0x01
-#define CARDBUS_SUBCLASS_SERIALBUS_SSA 0x02
-#define CARDBUS_SUBCLASS_SERIALBUS_USB 0x03
-#define CARDBUS_SUBCLASS_SERIALBUS_FIBER 0x04
-
-/* BIST, Header Type, Latency Timer, Cache Line Size */
-#define CARDBUS_BHLC_REG 0x0c
-
-#define CARDBUS_BIST_SHIFT 24
-#define CARDBUS_BIST_MASK 0xff
-#define CARDBUS_BIST(bhlcr) \
- (((bhlcr) >> CARDBUS_BIST_SHIFT) & CARDBUS_BIST_MASK)
-
-#define CARDBUS_HDRTYPE_SHIFT 16
-#define CARDBUS_HDRTYPE_MASK 0xff
-#define CARDBUS_HDRTYPE(bhlcr) \
- (((bhlcr) >> CARDBUS_HDRTYPE_SHIFT) & CARDBUS_HDRTYPE_MASK)
-
-#define CARDBUS_HDRTYPE_TYPE(bhlcr) \
- (CARDBUS_HDRTYPE(bhlcr) & 0x7f)
-#define CARDBUS_HDRTYPE_MULTIFN(bhlcr) \
- ((CARDBUS_HDRTYPE(bhlcr) & 0x80) != 0)
-
-#define CARDBUS_LATTIMER_SHIFT 8
-#define CARDBUS_LATTIMER_MASK 0xff
-#define CARDBUS_LATTIMER(bhlcr) \
- (((bhlcr) >> CARDBUS_LATTIMER_SHIFT) & CARDBUS_LATTIMER_MASK)
-
-#define CARDBUS_CACHELINE_SHIFT 0
-#define CARDBUS_CACHELINE_MASK 0xff
-#define CARDBUS_CACHELINE(bhlcr) \
- (((bhlcr) >> CARDBUS_CACHELINE_SHIFT) & CARDBUS_CACHELINE_MASK)
-
-
/* Base Registers */
#define CARDBUS_BASE0_REG 0x10
#define CARDBUS_BASE1_REG 0x14
@@ -163,31 +60,26 @@ typedef u_int16_t cardbus_product_id_t;
# define CARDBUS_CIS_ASI_BAR(x) (((CARDBUS_CIS_ASIMASK & (x))-1)*4+0x10)
# define CARDBUS_CIS_ASI_ROM_IMAGE(x) (((x) >> 28) & 0xf)
-#define CARDBUS_INTERRUPT_REG 0x3c
-
-#define CARDBUS_MAPREG_TYPE_MEM 0x00000000
-#define CARDBUS_MAPREG_TYPE_IO 0x00000001
-
/* XXX end */
typedef struct cardbus_functions {
- int (*cardbus_space_alloc)(cardbus_chipset_tag_t, rbus_tag_t,
+ int (*cardbus_space_alloc)(pci_chipset_tag_t, rbus_tag_t,
bus_addr_t, bus_size_t, bus_addr_t, bus_size_t, int, bus_addr_t *,
bus_space_handle_t *);
- int (*cardbus_space_free)(cardbus_chipset_tag_t, rbus_tag_t,
+ int (*cardbus_space_free)(pci_chipset_tag_t, rbus_tag_t,
bus_space_handle_t, bus_size_t);
- void *(*cardbus_intr_establish)(cardbus_chipset_tag_t, int, int,
+ void *(*cardbus_intr_establish)(pci_chipset_tag_t, int, int,
int (*)(void *), void *, const char *);
- void (*cardbus_intr_disestablish)(cardbus_chipset_tag_t, void *);
- 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);
- void (*cardbus_free_tag)(cardbus_chipset_tag_t, cardbustag_t);
- cardbusreg_t (*cardbus_conf_read)(cardbus_chipset_tag_t,
- cardbustag_t, int);
- void (*cardbus_conf_write)(cardbus_chipset_tag_t, cardbustag_t, int,
- cardbusreg_t);
+ void (*cardbus_intr_disestablish)(pci_chipset_tag_t, void *);
+ int (*cardbus_ctrl)(pci_chipset_tag_t, int);
+ int (*cardbus_power)(pci_chipset_tag_t, int);
+
+ pcitag_t (*cardbus_make_tag)(pci_chipset_tag_t, int, int, int);
+ void (*cardbus_free_tag)(pci_chipset_tag_t, pcitag_t);
+ pcireg_t (*cardbus_conf_read)(pci_chipset_tag_t,
+ pcitag_t, int);
+ void (*cardbus_conf_write)(pci_chipset_tag_t, pcitag_t, int,
+ pcireg_t);
} cardbus_function_t, *cardbus_function_tag_t;
/*
@@ -201,7 +93,7 @@ struct cbslot_attach_args {
int cba_bus; /* cardbus bus number */
- cardbus_chipset_tag_t cba_cc; /* cardbus chipset */
+ pci_chipset_tag_t cba_cc; /* cardbus chipset */
cardbus_function_tag_t cba_cf; /* cardbus functions */
int cba_intrline; /* interrupt line */
@@ -235,7 +127,7 @@ struct cardbus_softc {
bus_space_tag_t sc_memt; /* CardBus MEM space tag */
bus_dma_tag_t sc_dmat; /* DMA tag */
- cardbus_chipset_tag_t sc_cc; /* CardBus chipset */
+ pci_chipset_tag_t sc_cc; /* CardBus chipset */
cardbus_function_tag_t sc_cf; /* CardBus function */
rbus_tag_t sc_rbus_iot; /* CardBus i/o rbus tag */
@@ -261,7 +153,7 @@ struct cardbus_softc {
* disallocation.
*/
typedef struct cardbus_devfunc {
- cardbus_chipset_tag_t ct_cc;
+ pci_chipset_tag_t ct_cc;
cardbus_function_tag_t ct_cf;
struct cardbus_softc *ct_sc; /* pointer to the parent */
int ct_bus; /* bus number */
@@ -317,12 +209,12 @@ struct cardbus_attach_args {
u_int ca_bus;
u_int ca_device;
u_int ca_function;
- cardbustag_t ca_tag;
- cardbusreg_t ca_id;
- cardbusreg_t ca_class;
+ pcitag_t ca_tag;
+ pcireg_t ca_id;
+ pcireg_t ca_class;
/* Interrupt information */
- cardbus_intr_line_t ca_intrline;
+ pci_intr_line_t ca_intrline;
rbus_tag_t ca_rbus_iot; /* CardBus i/o rbus tag */
rbus_tag_t ca_rbus_memt; /* CardBus mem rbus tag */
@@ -376,15 +268,15 @@ struct cardbus_attach_args {
int cardbus_attach_card(struct cardbus_softc *);
void cardbus_detach_card(struct cardbus_softc *);
-void *cardbus_intr_establish(cardbus_chipset_tag_t, cardbus_function_tag_t,
+void *cardbus_intr_establish(pci_chipset_tag_t, cardbus_function_tag_t,
cardbus_intr_handle_t irq, int level, int (*func) (void *),
void *arg, const char *);
-void cardbus_intr_disestablish(cardbus_chipset_tag_t,
+void cardbus_intr_disestablish(pci_chipset_tag_t,
cardbus_function_tag_t, void *handler);
-int cardbus_mapreg_probe(cardbus_chipset_tag_t, cardbus_function_tag_t,
- cardbustag_t, int, pcireg_t *);
-int cardbus_mapreg_map(struct cardbus_softc *, int, int, cardbusreg_t,
+int cardbus_mapreg_probe(pci_chipset_tag_t, cardbus_function_tag_t,
+ pcitag_t, int, pcireg_t *);
+int cardbus_mapreg_map(struct cardbus_softc *, int, int, pcireg_t,
int, bus_space_tag_t *, bus_space_handle_t *, bus_addr_t *,
bus_size_t *);
int cardbus_mapreg_unmap(struct cardbus_softc *, int, int,
@@ -393,16 +285,10 @@ int cardbus_mapreg_unmap(struct cardbus_softc *, int, int,
int cardbus_function_enable(struct cardbus_softc *, int function);
int cardbus_function_disable(struct cardbus_softc *, int function);
-int cardbus_get_capability(cardbus_chipset_tag_t, cardbus_function_tag_t,
- cardbustag_t, int, int *, cardbusreg_t *);
-
-struct cardbus_matchid {
- cardbus_vendor_id_t cm_vid;
- cardbus_product_id_t cm_pid;
-};
-
int cardbus_matchbyid(struct cardbus_attach_args *,
- const struct cardbus_matchid *, int);
+ const struct pci_matchid *, int);
+int cardbus_get_capability(pci_chipset_tag_t, cardbus_function_tag_t,
+ pcitag_t, int, int *, pcireg_t *);
#define Cardbus_function_enable(ct) \
cardbus_function_enable((ct)->ct_sc, (ct)->ct_func)
diff --git a/sys/dev/cardbus/com_cardbus.c b/sys/dev/cardbus/com_cardbus.c
index ff4b9cca928..6ed604255e2 100644
--- a/sys/dev/cardbus/com_cardbus.c
+++ b/sys/dev/cardbus/com_cardbus.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: com_cardbus.c,v 1.36 2009/08/20 18:47:03 martynas Exp $ */
+/* $OpenBSD: com_cardbus.c,v 1.37 2010/03/22 22:28:27 jsg Exp $ */
/* $NetBSD: com_cardbus.c,v 1.4 2000/04/17 09:21:59 joda Exp $ */
/*
@@ -69,12 +69,12 @@ struct com_cardbus_softc {
void *cc_ih;
cardbus_devfunc_t cc_ct;
bus_addr_t cc_addr;
- cardbusreg_t cc_base;
+ pcireg_t cc_base;
bus_size_t cc_size;
- cardbusreg_t cc_csr;
+ pcireg_t cc_csr;
int cc_cben;
- cardbustag_t cc_tag;
- cardbusreg_t cc_reg;
+ pcitag_t cc_tag;
+ pcireg_t cc_reg;
int cc_type;
u_char cc_bug;
};
@@ -103,28 +103,28 @@ struct cfattach com_cardbus_ca = {
static struct csdev {
u_short vendor;
u_short product;
- cardbusreg_t reg;
+ pcireg_t reg;
u_char type;
u_char bug;
} csdevs[] = {
{ PCI_VENDOR_3COM, PCI_PRODUCT_3COM_GLOBALMODEM56,
- CARDBUS_BASE0_REG, CARDBUS_MAPREG_TYPE_IO },
+ CARDBUS_BASE0_REG, PCI_MAPREG_TYPE_IO },
{ PCI_VENDOR_3COM, PCI_PRODUCT_3COM_MODEM56,
- CARDBUS_BASE0_REG, CARDBUS_MAPREG_TYPE_IO },
+ CARDBUS_BASE0_REG, PCI_MAPREG_TYPE_IO },
{ PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_SERIAL,
- CARDBUS_BASE0_REG, CARDBUS_MAPREG_TYPE_IO, BUG_BROADCOM },
+ CARDBUS_BASE0_REG, PCI_MAPREG_TYPE_IO, BUG_BROADCOM },
{ PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_SERIAL_2,
- CARDBUS_BASE0_REG, CARDBUS_MAPREG_TYPE_IO, BUG_BROADCOM },
+ CARDBUS_BASE0_REG, PCI_MAPREG_TYPE_IO, BUG_BROADCOM },
{ PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_SERIAL_GC,
- CARDBUS_BASE0_REG, CARDBUS_MAPREG_TYPE_IO },
+ CARDBUS_BASE0_REG, PCI_MAPREG_TYPE_IO },
{ PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_MODEM56,
- CARDBUS_BASE0_REG, CARDBUS_MAPREG_TYPE_IO },
+ CARDBUS_BASE0_REG, PCI_MAPREG_TYPE_IO },
{ PCI_VENDOR_OXFORD2, PCI_PRODUCT_OXFORD2_OXCB950,
- CARDBUS_BASE0_REG, CARDBUS_MAPREG_TYPE_IO },
+ CARDBUS_BASE0_REG, PCI_MAPREG_TYPE_IO },
{ PCI_VENDOR_XIRCOM, PCI_PRODUCT_XIRCOM_CBEM56G,
- CARDBUS_BASE0_REG, CARDBUS_MAPREG_TYPE_IO },
+ CARDBUS_BASE0_REG, PCI_MAPREG_TYPE_IO },
{ PCI_VENDOR_XIRCOM, PCI_PRODUCT_XIRCOM_MODEM56,
- CARDBUS_BASE0_REG, CARDBUS_MAPREG_TYPE_IO }
+ CARDBUS_BASE0_REG, PCI_MAPREG_TYPE_IO }
};
static const int ncsdevs = sizeof(csdevs) / sizeof(csdevs[0]);
@@ -135,8 +135,8 @@ com_cardbus_find_csdev(struct cardbus_attach_args *ca)
struct csdev *cp;
for (cp = csdevs; cp < csdevs + ncsdevs; cp++)
- if (cp->vendor == CARDBUS_VENDOR(ca->ca_id) &&
- cp->product == CARDBUS_PRODUCT(ca->ca_id))
+ if (cp->vendor == PCI_VENDOR(ca->ca_id) &&
+ cp->product == PCI_PRODUCT(ca->ca_id))
return (cp);
return (NULL);
}
@@ -166,7 +166,7 @@ com_cardbus_gofigure(struct cardbus_attach_args *ca,
struct com_cardbus_softc *csc)
{
int i, index = -1;
- cardbusreg_t cis_ptr;
+ pcireg_t cis_ptr;
struct csdev *cp;
/* If this device is listed above, use the known values, */
@@ -201,9 +201,9 @@ com_cardbus_gofigure(struct cardbus_attach_args *ca,
}
csc->cc_reg = CARDBUS_CIS_ASI_BAR(ca->ca_cis.bar[index].flags);
if ((ca->ca_cis.bar[index].flags & 0x10) == 0)
- csc->cc_type = CARDBUS_MAPREG_TYPE_MEM;
+ csc->cc_type = PCI_MAPREG_TYPE_MEM;
else
- csc->cc_type = CARDBUS_MAPREG_TYPE_IO;
+ csc->cc_type = PCI_MAPREG_TYPE_IO;
return (0);
multi_bar:
@@ -213,7 +213,7 @@ com_cardbus_gofigure(struct cardbus_attach_args *ca,
"please report the following information\n",
DEVNAME(csc));
printf("%s: vendor 0x%x product 0x%x\n", DEVNAME(csc),
- CARDBUS_VENDOR(ca->ca_id), CARDBUS_PRODUCT(ca->ca_id));
+ PCI_VENDOR(ca->ca_id), PCI_PRODUCT(ca->ca_id));
for (i = 0; i < 7; i++) {
/* ignore zero sized BARs */
if (ca->ca_cis.bar[i].size == 0)
@@ -250,13 +250,13 @@ com_cardbus_attach(struct device *parent, struct device *self, void *aux)
}
csc->cc_base = csc->cc_addr;
- csc->cc_csr = CARDBUS_COMMAND_MASTER_ENABLE;
- if (csc->cc_type == CARDBUS_MAPREG_TYPE_IO) {
- csc->cc_base |= CARDBUS_MAPREG_TYPE_IO;
- csc->cc_csr |= CARDBUS_COMMAND_IO_ENABLE;
+ csc->cc_csr = PCI_COMMAND_MASTER_ENABLE;
+ if (csc->cc_type == PCI_MAPREG_TYPE_IO) {
+ csc->cc_base |= PCI_MAPREG_TYPE_IO;
+ csc->cc_csr |= PCI_COMMAND_IO_ENABLE;
csc->cc_cben = CARDBUS_IO_ENABLE;
} else {
- csc->cc_csr |= CARDBUS_COMMAND_MEM_ENABLE;
+ csc->cc_csr |= PCI_COMMAND_MEM_ENABLE;
csc->cc_cben = CARDBUS_MEM_ENABLE;
}
@@ -284,9 +284,9 @@ void
com_cardbus_setup(struct com_cardbus_softc *csc)
{
cardbus_devfunc_t ct = csc->cc_ct;
- cardbus_chipset_tag_t cc = ct->ct_cc;
+ pci_chipset_tag_t cc = ct->ct_cc;
cardbus_function_tag_t cf = ct->ct_cf;
- cardbusreg_t reg;
+ pcireg_t reg;
cardbus_conf_write(cc, cf, csc->cc_tag, csc->cc_reg, csc->cc_base);
@@ -295,20 +295,20 @@ com_cardbus_setup(struct com_cardbus_softc *csc)
cf->cardbus_ctrl(cc, CARDBUS_BM_ENABLE);
/* and the card itself */
- reg = cardbus_conf_read(cc, cf, csc->cc_tag, CARDBUS_COMMAND_STATUS_REG);
- reg &= ~(CARDBUS_COMMAND_IO_ENABLE | CARDBUS_COMMAND_MEM_ENABLE);
+ reg = cardbus_conf_read(cc, cf, csc->cc_tag, PCI_COMMAND_STATUS_REG);
+ reg &= ~(PCI_COMMAND_IO_ENABLE | PCI_COMMAND_MEM_ENABLE);
reg |= csc->cc_csr;
- cardbus_conf_write(cc, cf, csc->cc_tag, CARDBUS_COMMAND_STATUS_REG, reg);
+ cardbus_conf_write(cc, cf, csc->cc_tag, PCI_COMMAND_STATUS_REG, reg);
/*
* Make sure the latency timer is set to some reasonable
* value.
*/
- reg = cardbus_conf_read(cc, cf, csc->cc_tag, CARDBUS_BHLC_REG);
- if (CARDBUS_LATTIMER(reg) < 0x20) {
- reg &= ~(CARDBUS_LATTIMER_MASK << CARDBUS_LATTIMER_SHIFT);
- reg |= (0x20 << CARDBUS_LATTIMER_SHIFT);
- cardbus_conf_write(cc, cf, csc->cc_tag, CARDBUS_BHLC_REG, reg);
+ reg = cardbus_conf_read(cc, cf, csc->cc_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, csc->cc_tag, PCI_BHLC_REG, reg);
}
}
@@ -318,7 +318,7 @@ com_cardbus_enable(struct com_softc *sc)
struct com_cardbus_softc *csc = (struct com_cardbus_softc*)sc;
struct cardbus_softc *psc =
(struct cardbus_softc *)sc->sc_dev.dv_parent;
- cardbus_chipset_tag_t cc = psc->sc_cc;
+ pci_chipset_tag_t cc = psc->sc_cc;
cardbus_function_tag_t cf = psc->sc_cf;
Cardbus_function_enable(csc->cc_ct);
@@ -344,7 +344,7 @@ com_cardbus_disable(struct com_softc *sc)
struct com_cardbus_softc *csc = (struct com_cardbus_softc*)sc;
struct cardbus_softc *psc =
(struct cardbus_softc *)sc->sc_dev.dv_parent;
- cardbus_chipset_tag_t cc = psc->sc_cc;
+ pci_chipset_tag_t cc = psc->sc_cc;
cardbus_function_tag_t cf = psc->sc_cf;
cardbus_intr_disestablish(cc, cf, csc->cc_ih);
diff --git a/sys/dev/cardbus/ehci_cardbus.c b/sys/dev/cardbus/ehci_cardbus.c
index ee0f6d7e84e..37e6cb5e821 100644
--- a/sys/dev/cardbus/ehci_cardbus.c
+++ b/sys/dev/cardbus/ehci_cardbus.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ehci_cardbus.c,v 1.12 2009/06/02 12:32:08 deraadt Exp $ */
+/* $OpenBSD: ehci_cardbus.c,v 1.13 2010/03/22 22:28:27 jsg Exp $ */
/* $NetBSD: ehci_cardbus.c,v 1.6.6.3 2004/09/21 13:27:25 skrll Exp $ */
/*
@@ -65,7 +65,7 @@ int ehci_cardbus_detach(struct device *, int);
struct ehci_cardbus_softc {
ehci_softc_t sc;
- cardbus_chipset_tag_t sc_cc;
+ pci_chipset_tag_t sc_cc;
cardbus_function_tag_t sc_cf;
cardbus_devfunc_t sc_ct;
void *sc_ih; /* interrupt vectoring */
@@ -76,7 +76,6 @@ struct cfattach ehci_cardbus_ca = {
ehci_cardbus_attach, ehci_cardbus_detach, ehci_activate
};
-#define CARDBUS_INTERFACE_EHCI PCI_INTERFACE_EHCI
#define CARDBUS_CBMEM PCI_CBMEM
#define cardbus_findvendor pci_findvendor
@@ -85,9 +84,9 @@ ehci_cardbus_match(struct device *parent, void *match, void *aux)
{
struct cardbus_attach_args *ca = (struct cardbus_attach_args *)aux;
- if (CARDBUS_CLASS(ca->ca_class) == CARDBUS_CLASS_SERIALBUS &&
- CARDBUS_SUBCLASS(ca->ca_class) == CARDBUS_SUBCLASS_SERIALBUS_USB &&
- CARDBUS_INTERFACE(ca->ca_class) == CARDBUS_INTERFACE_EHCI)
+ if (PCI_CLASS(ca->ca_class) == PCI_CLASS_SERIALBUS &&
+ PCI_SUBCLASS(ca->ca_class) == PCI_SUBCLASS_SERIALBUS_USB &&
+ PCI_INTERFACE(ca->ca_class) == PCI_INTERFACE_EHCI)
return (1);
return (0);
@@ -99,15 +98,15 @@ ehci_cardbus_attach(struct device *parent, struct device *self, void *aux)
struct ehci_cardbus_softc *sc = (struct ehci_cardbus_softc *)self;
struct cardbus_attach_args *ca = aux;
cardbus_devfunc_t ct = ca->ca_ct;
- cardbus_chipset_tag_t cc = ct->ct_cc;
+ pci_chipset_tag_t cc = ct->ct_cc;
cardbus_function_tag_t cf = ct->ct_cf;
- cardbusreg_t csr;
+ pcireg_t csr;
usbd_status r;
const char *vendor;
const char *devname = sc->sc.sc_bus.bdev.dv_xname;
/* Map I/O registers */
- if (Cardbus_mapreg_map(ct, CARDBUS_CBMEM, CARDBUS_MAPREG_TYPE_MEM, 0,
+ if (Cardbus_mapreg_map(ct, CARDBUS_CBMEM, PCI_MAPREG_TYPE_MEM, 0,
&sc->sc.iot, &sc->sc.ioh, NULL, &sc->sc.sc_size)) {
printf(": can't map mem space\n");
return;
@@ -123,10 +122,10 @@ ehci_cardbus_attach(struct device *parent, struct device *self, void *aux)
/* Enable the device. */
csr = cardbus_conf_read(cc, cf, ca->ca_tag,
- CARDBUS_COMMAND_STATUS_REG);
- cardbus_conf_write(cc, cf, ca->ca_tag, CARDBUS_COMMAND_STATUS_REG,
- csr | CARDBUS_COMMAND_MASTER_ENABLE
- | CARDBUS_COMMAND_MEM_ENABLE);
+ PCI_COMMAND_STATUS_REG);
+ cardbus_conf_write(cc, cf, ca->ca_tag, PCI_COMMAND_STATUS_REG,
+ csr | PCI_COMMAND_MASTER_ENABLE
+ | PCI_COMMAND_MEM_ENABLE);
/* Disable interrupts, so we don't get any spurious ones. */
sc->sc.sc_offs = EREAD1(&sc->sc, EHCI_CAPLENGTH);
@@ -143,12 +142,12 @@ ehci_cardbus_attach(struct device *parent, struct device *self, void *aux)
/* Figure out vendor for root hub descriptor. */
vendor = cardbus_findvendor(ca->ca_id);
- sc->sc.sc_id_vendor = CARDBUS_VENDOR(ca->ca_id);
+ sc->sc.sc_id_vendor = PCI_VENDOR(ca->ca_id);
if (vendor)
strlcpy(sc->sc.sc_vendor, vendor, sizeof(sc->sc.sc_vendor));
else
snprintf(sc->sc.sc_vendor, sizeof(sc->sc.sc_vendor),
- "vendor 0x%04x", CARDBUS_VENDOR(ca->ca_id));
+ "vendor 0x%04x", PCI_VENDOR(ca->ca_id));
r = ehci_init(&sc->sc);
if (r != USBD_NORMAL_COMPLETION) {
diff --git a/sys/dev/cardbus/if_acx_cardbus.c b/sys/dev/cardbus/if_acx_cardbus.c
index 69410183177..87c35fc8f68 100644
--- a/sys/dev/cardbus/if_acx_cardbus.c
+++ b/sys/dev/cardbus/if_acx_cardbus.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_acx_cardbus.c,v 1.15 2009/07/30 21:33:23 miod Exp $ */
+/* $OpenBSD: if_acx_cardbus.c,v 1.16 2010/03/22 22:28:27 jsg Exp $ */
/*
* Copyright (c) 2006 Claudio Jeker <claudio@openbsd.org>
@@ -64,7 +64,7 @@ struct acx_cardbus_softc {
/* cardbus specific goo */
cardbus_devfunc_t sc_ct;
- cardbustag_t sc_tag;
+ pcitag_t sc_tag;
void *sc_ih;
bus_size_t sc_mapsize1;
bus_size_t sc_mapsize2;
@@ -90,7 +90,7 @@ struct cfattach acx_cardbus_ca = {
acx_cardbus_attach, acx_cardbus_detach
};
-static const struct cardbus_matchid acx_cardbus_devices[] = {
+static const struct pci_matchid acx_cardbus_devices[] = {
{ PCI_VENDOR_TI, PCI_PRODUCT_TI_ACX100A },
{ PCI_VENDOR_TI, PCI_PRODUCT_TI_ACX100B },
{ PCI_VENDOR_TI, PCI_PRODUCT_TI_ACX111 },
@@ -129,46 +129,46 @@ acx_cardbus_attach(struct device *parent, struct device *self, void *aux)
sc->sc_disable = acx_cardbus_disable;
sc->sc_power = acx_cardbus_power;
- if (CARDBUS_PRODUCT(ca->ca_id) == PCI_PRODUCT_TI_ACX100A) {
+ if (PCI_PRODUCT(ca->ca_id) == PCI_PRODUCT_TI_ACX100A) {
/* first map I/O space as seen in the dragonfly code */
error = Cardbus_mapreg_map(ct, CARDBUS_BASE0_REG,
- CARDBUS_MAPREG_TYPE_IO, 0, &csc->sc_io_bt, &csc->sc_io_bh,
+ PCI_MAPREG_TYPE_IO, 0, &csc->sc_io_bt, &csc->sc_io_bh,
&base, &csc->sc_iomapsize);
if (error != 0) {
printf(": can't map i/o space\n");
return;
}
- csc->sc_iobar_val = base | CARDBUS_MAPREG_TYPE_IO;
+ csc->sc_iobar_val = base | PCI_MAPREG_TYPE_IO;
b1 = CARDBUS_BASE1_REG;
b2 = CARDBUS_BASE2_REG;
}
/* map control/status registers */
- error = Cardbus_mapreg_map(ct, b1, CARDBUS_MAPREG_TYPE_MEM, 0,
+ error = Cardbus_mapreg_map(ct, b1, PCI_MAPREG_TYPE_MEM, 0,
&sc->sc_mem1_bt, &sc->sc_mem1_bh, &base, &csc->sc_mapsize1);
if (error != 0) {
printf(": can't map mem1 space\n");
return;
}
- csc->sc_bar1_val = base | CARDBUS_MAPREG_TYPE_MEM;
+ csc->sc_bar1_val = base | PCI_MAPREG_TYPE_MEM;
/* map the other memory region */
- error = Cardbus_mapreg_map(ct, b2, CARDBUS_MAPREG_TYPE_MEM, 0,
+ error = Cardbus_mapreg_map(ct, b2, PCI_MAPREG_TYPE_MEM, 0,
&sc->sc_mem2_bt, &sc->sc_mem2_bh, &base, &csc->sc_mapsize2);
if (error != 0) {
printf(": can't map mem2 space\n");
return;
}
- csc->sc_bar2_val = base | CARDBUS_MAPREG_TYPE_MEM;
+ csc->sc_bar2_val = base | PCI_MAPREG_TYPE_MEM;
/* set up the PCI configuration registers */
acx_cardbus_setup(csc);
printf(": irq %d\n", csc->sc_intrline);
- if (CARDBUS_PRODUCT(ca->ca_id) == PCI_PRODUCT_TI_ACX111)
+ if (PCI_PRODUCT(ca->ca_id) == PCI_PRODUCT_TI_ACX111)
acx111_set_param(sc);
else
acx100_set_param(sc);
@@ -185,7 +185,7 @@ acx_cardbus_detach(struct device *self, int flags)
struct acx_cardbus_softc *csc = (struct acx_cardbus_softc *)self;
struct acx_softc *sc = &csc->sc_acx;
cardbus_devfunc_t ct = csc->sc_ct;
- cardbus_chipset_tag_t cc = ct->ct_cc;
+ pci_chipset_tag_t cc = ct->ct_cc;
cardbus_function_tag_t cf = ct->ct_cf;
int error, b1 = CARDBUS_BASE0_REG, b2 = CARDBUS_BASE1_REG;
@@ -225,7 +225,7 @@ acx_cardbus_enable(struct acx_softc *sc)
csc = (struct acx_cardbus_softc *)sc;
cardbus_devfunc_t ct = csc->sc_ct;
- cardbus_chipset_tag_t cc = ct->ct_cc;
+ pci_chipset_tag_t cc = ct->ct_cc;
cardbus_function_tag_t cf = ct->ct_cf;
/* power on the socket */
@@ -254,7 +254,7 @@ acx_cardbus_disable(struct acx_softc *sc)
{
struct acx_cardbus_softc *csc = (struct acx_cardbus_softc *)sc;
cardbus_devfunc_t ct = csc->sc_ct;
- cardbus_chipset_tag_t cc = ct->ct_cc;
+ pci_chipset_tag_t cc = ct->ct_cc;
cardbus_function_tag_t cf = ct->ct_cf;
/* unhook the interrupt handler */
@@ -280,7 +280,7 @@ void
acx_cardbus_setup(struct acx_cardbus_softc *csc)
{
cardbus_devfunc_t ct = csc->sc_ct;
- cardbus_chipset_tag_t cc = ct->ct_cc;
+ pci_chipset_tag_t cc = ct->ct_cc;
cardbus_function_tag_t cf = ct->ct_cf;
pcireg_t reg;
int b1 = CARDBUS_BASE0_REG, b2 = CARDBUS_BASE1_REG;
@@ -303,12 +303,12 @@ acx_cardbus_setup(struct acx_cardbus_softc *csc)
/* enable the appropriate bits in the PCI CSR */
reg = cardbus_conf_read(cc, cf, csc->sc_tag,
- CARDBUS_COMMAND_STATUS_REG);
- reg |= CARDBUS_COMMAND_MASTER_ENABLE | CARDBUS_COMMAND_MEM_ENABLE;
+ PCI_COMMAND_STATUS_REG);
+ reg |= PCI_COMMAND_MASTER_ENABLE | PCI_COMMAND_MEM_ENABLE;
#if 0
if (csc->sc_iobar_val)
- reg |= CARDBUS_COMMAND_IO_ENABLE;
+ reg |= PCI_COMMAND_IO_ENABLE;
#endif
- cardbus_conf_write(cc, cf, csc->sc_tag, CARDBUS_COMMAND_STATUS_REG,
+ cardbus_conf_write(cc, cf, csc->sc_tag, PCI_COMMAND_STATUS_REG,
reg);
}
diff --git a/sys/dev/cardbus/if_ath_cardbus.c b/sys/dev/cardbus/if_ath_cardbus.c
index 3e0cee69599..88c4fab3420 100644
--- a/sys/dev/cardbus/if_ath_cardbus.c
+++ b/sys/dev/cardbus/if_ath_cardbus.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_ath_cardbus.c,v 1.12 2008/06/14 07:20:12 jsing Exp $ */
+/* $OpenBSD: if_ath_cardbus.c,v 1.13 2010/03/22 22:28:27 jsg Exp $ */
/* $NetBSD: if_ath_cardbus.c,v 1.4 2004/08/02 19:14:28 mycroft Exp $ */
/*
@@ -87,7 +87,7 @@ struct ath_cardbus_softc {
/* CardBus-specific goo. */
void *sc_ih; /* interrupt handle */
cardbus_devfunc_t sc_ct; /* our CardBus devfuncs */
- cardbustag_t sc_tag; /* our CardBus tag */
+ pcitag_t sc_tag; /* our CardBus tag */
pcireg_t sc_bar_val; /* value of the BAR */
@@ -150,9 +150,9 @@ ath_cardbus_attach(struct device *parent, struct device *self, void *aux)
/*
* Map the device.
*/
- if (Cardbus_mapreg_map(ct, ATH_PCI_MMBA, CARDBUS_MAPREG_TYPE_MEM, 0,
+ if (Cardbus_mapreg_map(ct, ATH_PCI_MMBA, PCI_MAPREG_TYPE_MEM, 0,
&sc->sc_st, &sc->sc_sh, &adr, &sc->sc_ss) == 0) {
- csc->sc_bar_val = adr | CARDBUS_MAPREG_TYPE_MEM;
+ csc->sc_bar_val = adr | PCI_MAPREG_TYPE_MEM;
}
else {
@@ -220,7 +220,7 @@ ath_cardbus_enable(struct ath_softc *sc)
{
struct ath_cardbus_softc *csc = (void *) sc;
cardbus_devfunc_t ct = csc->sc_ct;
- cardbus_chipset_tag_t cc = ct->ct_cc;
+ pci_chipset_tag_t cc = ct->ct_cc;
cardbus_function_tag_t cf = ct->ct_cf;
/*
@@ -252,7 +252,7 @@ ath_cardbus_disable(struct ath_softc *sc)
{
struct ath_cardbus_softc *csc = (void *) sc;
cardbus_devfunc_t ct = csc->sc_ct;
- cardbus_chipset_tag_t cc = ct->ct_cc;
+ pci_chipset_tag_t cc = ct->ct_cc;
cardbus_function_tag_t cf = ct->ct_cf;
/* Unhook the interrupt handler. */
@@ -274,7 +274,7 @@ void
ath_cardbus_setup(struct ath_cardbus_softc *csc)
{
cardbus_devfunc_t ct = csc->sc_ct;
- cardbus_chipset_tag_t cc = ct->ct_cc;
+ pci_chipset_tag_t cc = ct->ct_cc;
cardbus_function_tag_t cf = ct->ct_cf;
pcireg_t reg;
@@ -293,19 +293,19 @@ ath_cardbus_setup(struct ath_cardbus_softc *csc)
/* Enable the appropriate bits in the PCI CSR. */
reg = cardbus_conf_read(cc, cf, csc->sc_tag,
- CARDBUS_COMMAND_STATUS_REG);
- reg |= CARDBUS_COMMAND_MASTER_ENABLE | CARDBUS_COMMAND_MEM_ENABLE;
- cardbus_conf_write(cc, cf, csc->sc_tag, CARDBUS_COMMAND_STATUS_REG,
+ PCI_COMMAND_STATUS_REG);
+ reg |= PCI_COMMAND_MASTER_ENABLE | PCI_COMMAND_MEM_ENABLE;
+ cardbus_conf_write(cc, cf, csc->sc_tag, PCI_COMMAND_STATUS_REG,
reg);
/*
* Make sure the latency timer is set to some reasonable
* value.
*/
- reg = cardbus_conf_read(cc, cf, csc->sc_tag, CARDBUS_BHLC_REG);
- if (CARDBUS_LATTIMER(reg) < 0x20) {
- reg &= ~(CARDBUS_LATTIMER_MASK << CARDBUS_LATTIMER_SHIFT);
- reg |= (0x20 << CARDBUS_LATTIMER_SHIFT);
- cardbus_conf_write(cc, cf, csc->sc_tag, CARDBUS_BHLC_REG, reg);
+ reg = cardbus_conf_read(cc, cf, csc->sc_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, csc->sc_tag, PCI_BHLC_REG, reg);
}
}
diff --git a/sys/dev/cardbus/if_athn_cardbus.c b/sys/dev/cardbus/if_athn_cardbus.c
index a7612585924..6977f0d3a58 100644
--- a/sys/dev/cardbus/if_athn_cardbus.c
+++ b/sys/dev/cardbus/if_athn_cardbus.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_athn_cardbus.c,v 1.5 2010/02/02 17:16:47 damien Exp $ */
+/* $OpenBSD: if_athn_cardbus.c,v 1.6 2010/03/22 22:28:27 jsg Exp $ */
/*-
* Copyright (c) 2009 Damien Bergamini <damien.bergamini@free.fr>
@@ -60,7 +60,7 @@ struct athn_cardbus_softc {
/* CardBus specific goo. */
cardbus_devfunc_t sc_ct;
- cardbustag_t sc_tag;
+ pcitag_t sc_tag;
void *sc_ih;
bus_size_t sc_mapsize;
pcireg_t sc_bar_val;
@@ -82,7 +82,7 @@ struct cfattach athn_cardbus_ca = {
athn_cardbus_detach
};
-static const struct cardbus_matchid athn_cardbus_devices[] = {
+static const struct pci_matchid athn_cardbus_devices[] = {
{ PCI_VENDOR_ATHEROS, PCI_PRODUCT_ATHEROS_AR5416 },
{ PCI_VENDOR_ATHEROS, PCI_PRODUCT_ATHEROS_AR5418 },
{ PCI_VENDOR_ATHEROS, PCI_PRODUCT_ATHEROS_AR9160 },
@@ -123,13 +123,13 @@ athn_cardbus_attach(struct device *parent, struct device *self, void *aux)
/* Map control/status registers. */
error = Cardbus_mapreg_map(ct, CARDBUS_BASE0_REG,
- CARDBUS_MAPREG_TYPE_MEM, 0, &sc->sc_st, &sc->sc_sh, &base,
+ PCI_MAPREG_TYPE_MEM, 0, &sc->sc_st, &sc->sc_sh, &base,
&csc->sc_mapsize);
if (error != 0) {
printf(": can't map mem space\n");
return;
}
- csc->sc_bar_val = base | CARDBUS_MAPREG_TYPE_MEM;
+ csc->sc_bar_val = base | PCI_MAPREG_TYPE_MEM;
/* Set up the PCI configuration registers. */
athn_cardbus_setup(csc);
@@ -146,7 +146,7 @@ athn_cardbus_detach(struct device *self, int flags)
struct athn_cardbus_softc *csc = (struct athn_cardbus_softc *)self;
struct athn_softc *sc = &csc->sc_sc;
cardbus_devfunc_t ct = csc->sc_ct;
- cardbus_chipset_tag_t cc = ct->ct_cc;
+ pci_chipset_tag_t cc = ct->ct_cc;
cardbus_function_tag_t cf = ct->ct_cf;
athn_detach(sc);
@@ -167,7 +167,7 @@ athn_cardbus_enable(struct athn_softc *sc)
{
struct athn_cardbus_softc *csc = (struct athn_cardbus_softc *)sc;
cardbus_devfunc_t ct = csc->sc_ct;
- cardbus_chipset_tag_t cc = ct->ct_cc;
+ pci_chipset_tag_t cc = ct->ct_cc;
cardbus_function_tag_t cf = ct->ct_cf;
/* Power on the socket. */
@@ -193,7 +193,7 @@ athn_cardbus_disable(struct athn_softc *sc)
{
struct athn_cardbus_softc *csc = (struct athn_cardbus_softc *)sc;
cardbus_devfunc_t ct = csc->sc_ct;
- cardbus_chipset_tag_t cc = ct->ct_cc;
+ pci_chipset_tag_t cc = ct->ct_cc;
cardbus_function_tag_t cf = ct->ct_cf;
/* Unhook the interrupt handler. */
@@ -219,9 +219,9 @@ void
athn_cardbus_setup(struct athn_cardbus_softc *csc)
{
cardbus_devfunc_t ct = csc->sc_ct;
- cardbus_chipset_tag_t cc = ct->ct_cc;
+ pci_chipset_tag_t cc = ct->ct_cc;
cardbus_function_tag_t cf = ct->ct_cf;
- cardbusreg_t reg;
+ pcireg_t reg;
/* Program the BAR. */
cardbus_conf_write(cc, cf, csc->sc_tag, CARDBUS_BASE0_REG,
@@ -233,9 +233,9 @@ athn_cardbus_setup(struct athn_cardbus_softc *csc)
/* Enable the appropriate bits in the PCI CSR. */
reg = cardbus_conf_read(cc, cf, csc->sc_tag,
- CARDBUS_COMMAND_STATUS_REG);
- reg |= CARDBUS_COMMAND_MASTER_ENABLE | CARDBUS_COMMAND_MEM_ENABLE;
- cardbus_conf_write(cc, cf, csc->sc_tag, CARDBUS_COMMAND_STATUS_REG,
+ PCI_COMMAND_STATUS_REG);
+ reg |= PCI_COMMAND_MASTER_ENABLE | PCI_COMMAND_MEM_ENABLE;
+ cardbus_conf_write(cc, cf, csc->sc_tag, PCI_COMMAND_STATUS_REG,
reg);
/*
@@ -248,8 +248,8 @@ athn_cardbus_setup(struct athn_cardbus_softc *csc)
cardbus_conf_write(cc, cf, csc->sc_tag, 0x40, reg);
/* Change latency timer; default value yields poor results. */
- reg = cardbus_conf_read(cc, cf, csc->sc_tag, CARDBUS_BHLC_REG);
- reg &= ~(CARDBUS_LATTIMER_MASK << CARDBUS_LATTIMER_SHIFT);
- reg |= 168 << CARDBUS_LATTIMER_SHIFT;
- cardbus_conf_write(cc, cf, csc->sc_tag, CARDBUS_BHLC_REG, reg);
+ reg = cardbus_conf_read(cc, cf, csc->sc_tag, PCI_BHLC_REG);
+ reg &= ~(PCI_LATTIMER_MASK << PCI_LATTIMER_SHIFT);
+ reg |= 168 << PCI_LATTIMER_SHIFT;
+ cardbus_conf_write(cc, cf, csc->sc_tag, PCI_BHLC_REG, reg);
}
diff --git a/sys/dev/cardbus/if_atw_cardbus.c b/sys/dev/cardbus/if_atw_cardbus.c
index 2c7a07b55e5..662a4df5895 100644
--- a/sys/dev/cardbus/if_atw_cardbus.c
+++ b/sys/dev/cardbus/if_atw_cardbus.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_atw_cardbus.c,v 1.15 2008/06/26 05:42:14 ray Exp $ */
+/* $OpenBSD: if_atw_cardbus.c,v 1.16 2010/03/22 22:28:27 jsg Exp $ */
/* $NetBSD: if_atw_cardbus.c,v 1.9 2004/07/23 07:07:55 dyoung Exp $ */
/*-
@@ -92,7 +92,7 @@ struct atw_cardbus_softc {
/* CardBus-specific goo. */
void *sc_ih; /* interrupt handle */
cardbus_devfunc_t sc_ct; /* our CardBus devfuncs */
- cardbustag_t sc_tag; /* our CardBus tag */
+ pcitag_t sc_tag; /* our CardBus tag */
int sc_csr; /* CSR bits */
bus_size_t sc_mapsize; /* the size of mapped bus space
region */
@@ -119,7 +119,7 @@ int atw_cardbus_enable(struct atw_softc *);
void atw_cardbus_disable(struct atw_softc *);
void atw_cardbus_power(struct atw_softc *, int);
-const struct cardbus_matchid atw_cardbus_devices[] = {
+const struct pci_matchid atw_cardbus_devices[] = {
{ PCI_VENDOR_ADMTEK, PCI_PRODUCT_ADMTEK_ADM8211 },
{ PCI_VENDOR_3COM, PCI_PRODUCT_3COM_3CRSHPW796 },
};
@@ -164,29 +164,29 @@ atw_cardbus_attach(struct device *parent, struct device *self, void *aux)
/*
* Map the device.
*/
- csc->sc_csr = CARDBUS_COMMAND_MASTER_ENABLE;
+ csc->sc_csr = PCI_COMMAND_MASTER_ENABLE;
if (Cardbus_mapreg_map(ct, ATW_PCI_MMBA,
- CARDBUS_MAPREG_TYPE_MEM, 0, &sc->sc_st, &sc->sc_sh, &adr,
+ PCI_MAPREG_TYPE_MEM, 0, &sc->sc_st, &sc->sc_sh, &adr,
&csc->sc_mapsize) == 0) {
#if 0
printf(": atw_cardbus_attach mapped %d bytes mem space\n%s",
csc->sc_mapsize, sc->sc_dev.dv_xname);
#endif
csc->sc_cben = CARDBUS_MEM_ENABLE;
- csc->sc_csr |= CARDBUS_COMMAND_MEM_ENABLE;
+ csc->sc_csr |= PCI_COMMAND_MEM_ENABLE;
csc->sc_bar_reg = ATW_PCI_MMBA;
- csc->sc_bar_val = adr | CARDBUS_MAPREG_TYPE_MEM;
+ csc->sc_bar_val = adr | PCI_MAPREG_TYPE_MEM;
} else if (Cardbus_mapreg_map(ct, ATW_PCI_IOBA,
- CARDBUS_MAPREG_TYPE_IO, 0, &sc->sc_st, &sc->sc_sh, &adr,
+ PCI_MAPREG_TYPE_IO, 0, &sc->sc_st, &sc->sc_sh, &adr,
&csc->sc_mapsize) == 0) {
#if 0
printf(": atw_cardbus_attach mapped %d bytes I/O space\n%s",
csc->sc_mapsize, sc->sc_dev.dv_xname);
#endif
csc->sc_cben = CARDBUS_IO_ENABLE;
- csc->sc_csr |= CARDBUS_COMMAND_IO_ENABLE;
+ csc->sc_csr |= PCI_COMMAND_IO_ENABLE;
csc->sc_bar_reg = ATW_PCI_IOBA;
- csc->sc_bar_val = adr | CARDBUS_MAPREG_TYPE_IO;
+ csc->sc_bar_val = adr | PCI_MAPREG_TYPE_IO;
} else {
printf(": unable to map device registers\n");
return;
@@ -263,7 +263,7 @@ atw_cardbus_enable(struct atw_softc *sc)
{
struct atw_cardbus_softc *csc = (void *) sc;
cardbus_devfunc_t ct = csc->sc_ct;
- cardbus_chipset_tag_t cc = ct->ct_cc;
+ pci_chipset_tag_t cc = ct->ct_cc;
cardbus_function_tag_t cf = ct->ct_cf;
/*
@@ -296,7 +296,7 @@ atw_cardbus_disable(struct atw_softc *sc)
{
struct atw_cardbus_softc *csc = (void *) sc;
cardbus_devfunc_t ct = csc->sc_ct;
- cardbus_chipset_tag_t cc = ct->ct_cc;
+ pci_chipset_tag_t cc = ct->ct_cc;
cardbus_function_tag_t cf = ct->ct_cf;
/* Unhook the interrupt handler. */
@@ -321,7 +321,7 @@ atw_cardbus_setup(struct atw_cardbus_softc *csc)
struct atw_softc *sc = &csc->sc_atw;
#endif
cardbus_devfunc_t ct = csc->sc_ct;
- cardbus_chipset_tag_t cc = ct->ct_cc;
+ pci_chipset_tag_t cc = ct->ct_cc;
cardbus_function_tag_t cf = ct->ct_cf;
pcireg_t reg;
@@ -340,20 +340,20 @@ atw_cardbus_setup(struct atw_cardbus_softc *csc)
/* Enable the appropriate bits in the PCI CSR. */
reg = cardbus_conf_read(cc, cf, csc->sc_tag,
- CARDBUS_COMMAND_STATUS_REG);
- reg &= ~(CARDBUS_COMMAND_IO_ENABLE|CARDBUS_COMMAND_MEM_ENABLE);
+ PCI_COMMAND_STATUS_REG);
+ reg &= ~(PCI_COMMAND_IO_ENABLE|PCI_COMMAND_MEM_ENABLE);
reg |= csc->sc_csr;
- cardbus_conf_write(cc, cf, csc->sc_tag, CARDBUS_COMMAND_STATUS_REG,
+ cardbus_conf_write(cc, cf, csc->sc_tag, PCI_COMMAND_STATUS_REG,
reg);
/*
* Make sure the latency timer is set to some reasonable
* value.
*/
- reg = cardbus_conf_read(cc, cf, csc->sc_tag, CARDBUS_BHLC_REG);
- if (CARDBUS_LATTIMER(reg) < 0x20) {
- reg &= ~(CARDBUS_LATTIMER_MASK << CARDBUS_LATTIMER_SHIFT);
- reg |= (0x20 << CARDBUS_LATTIMER_SHIFT);
- cardbus_conf_write(cc, cf, csc->sc_tag, CARDBUS_BHLC_REG, reg);
+ reg = cardbus_conf_read(cc, cf, csc->sc_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, csc->sc_tag, PCI_BHLC_REG, reg);
}
}
diff --git a/sys/dev/cardbus/if_bwi_cardbus.c b/sys/dev/cardbus/if_bwi_cardbus.c
index d5312fc2df1..e80b05af01d 100644
--- a/sys/dev/cardbus/if_bwi_cardbus.c
+++ b/sys/dev/cardbus/if_bwi_cardbus.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_bwi_cardbus.c,v 1.9 2009/03/29 21:53:52 sthen Exp $ */
+/* $OpenBSD: if_bwi_cardbus.c,v 1.10 2010/03/22 22:28:27 jsg Exp $ */
/*
* Copyright (c) 2007 Marcus Glocker <mglocker@openbsd.org>
@@ -52,7 +52,7 @@ struct bwi_cardbus_softc {
/* cardbus specific goo */
cardbus_devfunc_t csc_ct;
- cardbustag_t csc_tag;
+ pcitag_t csc_tag;
void *csc_ih;
bus_size_t csc_mapsize;
@@ -74,7 +74,7 @@ struct cfattach bwi_cardbus_ca = {
bwi_cardbus_attach, bwi_cardbus_detach
};
-static const struct cardbus_matchid bwi_cardbus_devices[] = {
+static const struct pci_matchid bwi_cardbus_devices[] = {
{ PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM4303 },
{ PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM4306 },
{ PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM4306_2 },
@@ -99,7 +99,7 @@ bwi_cardbus_attach(struct device *parent, struct device *self, void *aux)
struct cardbus_attach_args *ca = aux;
struct bwi_softc *sc = &csc->csc_bwi;
cardbus_devfunc_t ct = ca->ca_ct;
- cardbusreg_t reg;
+ pcireg_t reg;
bus_addr_t base;
int error;
@@ -115,13 +115,13 @@ bwi_cardbus_attach(struct device *parent, struct device *self, void *aux)
/* map control/status registers */
error = Cardbus_mapreg_map(ct, CARDBUS_BASE0_REG,
- CARDBUS_MAPREG_TYPE_MEM, 0, &sc->sc_mem_bt,
+ PCI_MAPREG_TYPE_MEM, 0, &sc->sc_mem_bt,
&sc->sc_mem_bh, &base, &csc->csc_mapsize);
if (error != 0) {
printf(": can't map mem space\n");
return;
}
- csc->csc_bar_val = base | CARDBUS_MAPREG_TYPE_MEM;
+ csc->csc_bar_val = base | PCI_MAPREG_TYPE_MEM;
/* set up the PCI configuration registers */
bwi_cardbus_setup(csc);
@@ -152,7 +152,7 @@ bwi_cardbus_detach(struct device *self, int flags)
struct bwi_cardbus_softc *csc = (struct bwi_cardbus_softc *)self;
struct bwi_softc *sc = &csc->csc_bwi;
cardbus_devfunc_t ct = csc->csc_ct;
- cardbus_chipset_tag_t cc = ct->ct_cc;
+ pci_chipset_tag_t cc = ct->ct_cc;
cardbus_function_tag_t cf = ct->ct_cf;
int error;
@@ -177,7 +177,7 @@ void
bwi_cardbus_setup(struct bwi_cardbus_softc *csc)
{
cardbus_devfunc_t ct = csc->csc_ct;
- cardbus_chipset_tag_t cc = ct->ct_cc;
+ pci_chipset_tag_t cc = ct->ct_cc;
cardbus_function_tag_t cf = ct->ct_cf;
pcireg_t reg;
@@ -191,9 +191,9 @@ bwi_cardbus_setup(struct bwi_cardbus_softc *csc)
/* enable the appropriate bits in the PCI CSR */
reg = cardbus_conf_read(cc, cf, csc->csc_tag,
- CARDBUS_COMMAND_STATUS_REG);
- reg |= CARDBUS_COMMAND_MASTER_ENABLE | CARDBUS_COMMAND_MEM_ENABLE;
- cardbus_conf_write(cc, cf, csc->csc_tag, CARDBUS_COMMAND_STATUS_REG,
+ PCI_COMMAND_STATUS_REG);
+ reg |= PCI_COMMAND_MASTER_ENABLE | PCI_COMMAND_MEM_ENABLE;
+ cardbus_conf_write(cc, cf, csc->csc_tag, PCI_COMMAND_STATUS_REG,
reg);
}
@@ -202,7 +202,7 @@ bwi_cardbus_enable(struct bwi_softc *sc)
{
struct bwi_cardbus_softc *csc = (struct bwi_cardbus_softc *)sc;
cardbus_devfunc_t ct = csc->csc_ct;
- cardbus_chipset_tag_t cc = ct->ct_cc;
+ pci_chipset_tag_t cc = ct->ct_cc;
cardbus_function_tag_t cf = ct->ct_cf;
/* power on the socket */
@@ -229,7 +229,7 @@ bwi_cardbus_disable(struct bwi_softc *sc)
{
struct bwi_cardbus_softc *csc = (struct bwi_cardbus_softc *)sc;
cardbus_devfunc_t ct = csc->csc_ct;
- cardbus_chipset_tag_t cc = ct->ct_cc;
+ pci_chipset_tag_t cc = ct->ct_cc;
cardbus_function_tag_t cf = ct->ct_cf;
/* unhook the interrupt handler */
@@ -245,7 +245,7 @@ bwi_cardbus_conf_write(void *self, uint32_t reg, uint32_t val)
{
struct bwi_cardbus_softc *csc = (struct bwi_cardbus_softc *)self;
cardbus_devfunc_t ct = csc->csc_ct;
- cardbus_chipset_tag_t cc = ct->ct_cc;
+ pci_chipset_tag_t cc = ct->ct_cc;
cardbus_function_tag_t cf = ct->ct_cf;
cardbus_conf_write(cc, cf, csc->csc_tag, reg, val);
@@ -256,7 +256,7 @@ bwi_cardbus_conf_read(void *self, uint32_t reg)
{
struct bwi_cardbus_softc *csc = (struct bwi_cardbus_softc *)self;
cardbus_devfunc_t ct = csc->csc_ct;
- cardbus_chipset_tag_t cc = ct->ct_cc;
+ pci_chipset_tag_t cc = ct->ct_cc;
cardbus_function_tag_t cf = ct->ct_cf;
return (cardbus_conf_read(cc, cf, csc->csc_tag, reg));
diff --git a/sys/dev/cardbus/if_dc_cardbus.c b/sys/dev/cardbus/if_dc_cardbus.c
index 616b6bb5e1e..c623f2d7985 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.30 2009/10/15 17:54:56 deraadt Exp $ */
+/* $OpenBSD: if_dc_cardbus.c,v 1.31 2010/03/22 22:28:27 jsg Exp $ */
/*
* Copyright (c) 1997, 1998, 1999
@@ -79,7 +79,7 @@ struct dc_cardbus_softc {
int sc_intrline;
cardbus_devfunc_t sc_ct;
- cardbustag_t sc_tag;
+ pcitag_t sc_tag;
bus_size_t sc_mapsize;
int sc_actype;
};
@@ -95,7 +95,7 @@ struct cfattach dc_cardbus_ca = {
dc_cardbus_detach
};
-const struct cardbus_matchid dc_cardbus_devices[] = {
+const struct pci_matchid dc_cardbus_devices[] = {
{ PCI_VENDOR_DEC, PCI_PRODUCT_DEC_21142 },
{ PCI_VENDOR_XIRCOM, PCI_PRODUCT_XIRCOM_X3201_3_21143 },
{ PCI_VENDOR_ADMTEK, PCI_PRODUCT_ADMTEK_AN985 },
@@ -125,9 +125,9 @@ dc_cardbus_attach(struct device *parent, struct device *self, void *aux)
struct dc_softc *sc = &csc->sc_dc;
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 cc = ct->ct_cc;
cardbus_function_tag_t cf = ct->ct_cf;
- cardbusreg_t reg;
+ pcireg_t reg;
bus_addr_t addr;
sc->sc_dmat = ca->ca_dmat;
@@ -259,9 +259,9 @@ void
dc_cardbus_setup(struct dc_cardbus_softc *csc)
{
cardbus_devfunc_t ct = csc->sc_ct;
- cardbus_chipset_tag_t cc = ct->ct_cc;
+ pci_chipset_tag_t cc = ct->ct_cc;
cardbus_function_tag_t cf = ct->ct_cf;
- cardbusreg_t reg;
+ pcireg_t reg;
int r;
/* wakeup the card if needed */
diff --git a/sys/dev/cardbus/if_fxp_cardbus.c b/sys/dev/cardbus/if_fxp_cardbus.c
index cb37464a238..5ca90bfd6a5 100644
--- a/sys/dev/cardbus/if_fxp_cardbus.c
+++ b/sys/dev/cardbus/if_fxp_cardbus.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_fxp_cardbus.c,v 1.24 2009/10/15 17:54:56 deraadt Exp $ */
+/* $OpenBSD: if_fxp_cardbus.c,v 1.25 2010/03/22 22:28:27 jsg Exp $ */
/* $NetBSD: if_fxp_cardbus.c,v 1.12 2000/05/08 18:23:36 thorpej Exp $ */
/*
@@ -88,7 +88,7 @@ void fxp_cardbus_setup(struct fxp_softc *);
struct fxp_cardbus_softc {
struct fxp_softc sc;
cardbus_devfunc_t ct;
- cardbustag_t ct_tag;
+ pcitag_t ct_tag;
pcireg_t base0_reg;
pcireg_t base1_reg;
bus_size_t size;
@@ -99,7 +99,7 @@ struct cfattach fxp_cardbus_ca = {
fxp_cardbus_detach
};
-const struct cardbus_matchid fxp_cardbus_devices[] = {
+const struct pci_matchid fxp_cardbus_devices[] = {
{ PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_8255x },
};
@@ -126,7 +126,7 @@ fxp_cardbus_attach(struct device *parent, struct device *self, void *aux)
struct cardbus_attach_args *ca = aux;
struct cardbus_softc *psc =
(struct cardbus_softc *)sc->sc_dev.dv_parent;
- cardbus_chipset_tag_t cc = psc->sc_cc;
+ pci_chipset_tag_t cc = psc->sc_cc;
cardbus_function_tag_t cf = psc->sc_cf;
bus_space_tag_t iot, memt;
bus_space_handle_t ioh, memh;
@@ -187,30 +187,30 @@ fxp_cardbus_setup(struct fxp_softc *sc)
struct fxp_cardbus_softc *csc = (struct fxp_cardbus_softc *) sc;
struct cardbus_softc *psc =
(struct cardbus_softc *) sc->sc_dev.dv_parent;
- cardbus_chipset_tag_t cc = psc->sc_cc;
+ pci_chipset_tag_t cc = psc->sc_cc;
cardbus_function_tag_t cf = psc->sc_cf;
pcireg_t command;
csc->ct_tag = cardbus_make_tag(cc, cf, csc->ct->ct_bus,
csc->ct->ct_dev, csc->ct->ct_func);
- command = cardbus_conf_read(cc, cf, csc->ct_tag, CARDBUS_COMMAND_STATUS_REG);
+ command = cardbus_conf_read(cc, cf, csc->ct_tag, PCI_COMMAND_STATUS_REG);
if (csc->base0_reg) {
cardbus_conf_write(cc, cf, csc->ct_tag, CARDBUS_BASE0_REG, csc->base0_reg);
(cf->cardbus_ctrl) (cc, CARDBUS_MEM_ENABLE);
- command |= CARDBUS_COMMAND_MEM_ENABLE |
- CARDBUS_COMMAND_MASTER_ENABLE;
+ command |= PCI_COMMAND_MEM_ENABLE |
+ PCI_COMMAND_MASTER_ENABLE;
} else if (csc->base1_reg) {
cardbus_conf_write(cc, cf, csc->ct_tag, CARDBUS_BASE1_REG, csc->base1_reg);
(cf->cardbus_ctrl) (cc, CARDBUS_IO_ENABLE);
- command |= (CARDBUS_COMMAND_IO_ENABLE |
- CARDBUS_COMMAND_MASTER_ENABLE);
+ command |= (PCI_COMMAND_IO_ENABLE |
+ PCI_COMMAND_MASTER_ENABLE);
}
(cf->cardbus_ctrl) (cc, CARDBUS_BM_ENABLE);
/* enable the card */
- cardbus_conf_write(cc, cf, csc->ct_tag, CARDBUS_COMMAND_STATUS_REG, command);
+ cardbus_conf_write(cc, cf, csc->ct_tag, PCI_COMMAND_STATUS_REG, command);
}
int
diff --git a/sys/dev/cardbus/if_malo_cardbus.c b/sys/dev/cardbus/if_malo_cardbus.c
index 23de2afe67c..b319565ade0 100644
--- a/sys/dev/cardbus/if_malo_cardbus.c
+++ b/sys/dev/cardbus/if_malo_cardbus.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_malo_cardbus.c,v 1.6 2009/03/29 21:53:52 sthen Exp $ */
+/* $OpenBSD: if_malo_cardbus.c,v 1.7 2010/03/22 22:28:27 jsg Exp $ */
/*
* Copyright (c) 2006 Claudio Jeker <claudio@openbsd.org>
@@ -46,7 +46,7 @@ struct malo_cardbus_softc {
/* cardbus specific goo */
cardbus_devfunc_t sc_ct;
- cardbustag_t sc_tag;
+ pcitag_t sc_tag;
void *sc_ih;
bus_size_t sc_mapsize1;
@@ -69,7 +69,7 @@ struct cfattach malo_cardbus_ca = {
malo_cardbus_attach, malo_cardbus_detach
};
-static const struct cardbus_matchid malo_cardbus_devices[] = {
+static const struct pci_matchid malo_cardbus_devices[] = {
{ PCI_VENDOR_MARVELL, PCI_PRODUCT_MARVELL_88W8310 },
{ PCI_VENDOR_MARVELL, PCI_PRODUCT_MARVELL_88W8335_1 },
{ PCI_VENDOR_MARVELL, PCI_PRODUCT_MARVELL_88W8335_2 }
@@ -106,17 +106,17 @@ malo_cardbus_attach(struct device *parent, struct device *self, void *aux)
/* map control/status registers */
error = Cardbus_mapreg_map(ct, CARDBUS_BASE0_REG,
- CARDBUS_MAPREG_TYPE_MEM, 0, &sc->sc_mem1_bt,
+ PCI_MAPREG_TYPE_MEM, 0, &sc->sc_mem1_bt,
&sc->sc_mem1_bh, &base, &csc->sc_mapsize1);
if (error != 0) {
printf(": can't map mem1 space\n");
return;
}
- csc->sc_bar1_val = base | CARDBUS_MAPREG_TYPE_MEM;
+ csc->sc_bar1_val = base | PCI_MAPREG_TYPE_MEM;
/* map control/status registers */
error = Cardbus_mapreg_map(ct, CARDBUS_BASE1_REG,
- CARDBUS_MAPREG_TYPE_MEM, 0, &sc->sc_mem2_bt,
+ PCI_MAPREG_TYPE_MEM, 0, &sc->sc_mem2_bt,
&sc->sc_mem2_bh, &base, &csc->sc_mapsize2);
if (error != 0) {
printf(": can't map mem2 space\n");
@@ -124,7 +124,7 @@ malo_cardbus_attach(struct device *parent, struct device *self, void *aux)
sc->sc_mem1_bh, csc->sc_mapsize1);
return;
}
- csc->sc_bar2_val = base | CARDBUS_MAPREG_TYPE_MEM;
+ csc->sc_bar2_val = base | PCI_MAPREG_TYPE_MEM;
/* set up the PCI configuration registers */
malo_cardbus_setup(csc);
@@ -144,7 +144,7 @@ malo_cardbus_detach(struct device *self, int flags)
struct malo_cardbus_softc *csc = (struct malo_cardbus_softc *)self;
struct malo_softc *sc = &csc->sc_malo;
cardbus_devfunc_t ct = csc->sc_ct;
- cardbus_chipset_tag_t cc = ct->ct_cc;
+ pci_chipset_tag_t cc = ct->ct_cc;
cardbus_function_tag_t cf = ct->ct_cf;
int error;
@@ -171,7 +171,7 @@ void
malo_cardbus_setup(struct malo_cardbus_softc *csc)
{
cardbus_devfunc_t ct = csc->sc_ct;
- cardbus_chipset_tag_t cc = ct->ct_cc;
+ pci_chipset_tag_t cc = ct->ct_cc;
cardbus_function_tag_t cf = ct->ct_cf;
pcireg_t reg;
@@ -187,9 +187,9 @@ malo_cardbus_setup(struct malo_cardbus_softc *csc)
/* enable the appropriate bits in the PCI CSR */
reg = cardbus_conf_read(cc, cf, csc->sc_tag,
- CARDBUS_COMMAND_STATUS_REG);
- reg |= CARDBUS_COMMAND_MASTER_ENABLE | CARDBUS_COMMAND_MEM_ENABLE;
- cardbus_conf_write(cc, cf, csc->sc_tag, CARDBUS_COMMAND_STATUS_REG,
+ PCI_COMMAND_STATUS_REG);
+ reg |= PCI_COMMAND_MASTER_ENABLE | PCI_COMMAND_MEM_ENABLE;
+ cardbus_conf_write(cc, cf, csc->sc_tag, PCI_COMMAND_STATUS_REG,
reg);
}
@@ -198,7 +198,7 @@ malo_cardbus_enable(struct malo_softc *sc)
{
struct malo_cardbus_softc *csc = (struct malo_cardbus_softc *)sc;
cardbus_devfunc_t ct = csc->sc_ct;
- cardbus_chipset_tag_t cc = ct->ct_cc;
+ pci_chipset_tag_t cc = ct->ct_cc;
cardbus_function_tag_t cf = ct->ct_cf;
/* power on the socket */
@@ -225,7 +225,7 @@ malo_cardbus_disable(struct malo_softc *sc)
{
struct malo_cardbus_softc *csc = (struct malo_cardbus_softc *)sc;
cardbus_devfunc_t ct = csc->sc_ct;
- cardbus_chipset_tag_t cc = ct->ct_cc;
+ pci_chipset_tag_t cc = ct->ct_cc;
cardbus_function_tag_t cf = ct->ct_cf;
/* unhook the interrupt handler */
diff --git a/sys/dev/cardbus/if_pgt_cardbus.c b/sys/dev/cardbus/if_pgt_cardbus.c
index 5627d35f640..52a1d9baff1 100644
--- a/sys/dev/cardbus/if_pgt_cardbus.c
+++ b/sys/dev/cardbus/if_pgt_cardbus.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_pgt_cardbus.c,v 1.8 2009/03/29 21:53:52 sthen Exp $ */
+/* $OpenBSD: if_pgt_cardbus.c,v 1.9 2010/03/22 22:28:27 jsg Exp $ */
/*
* Copyright (c) 2006 Marcus Glocker <mglocker@openbsd.org>
@@ -57,7 +57,7 @@
struct pgt_cardbus_softc {
struct pgt_softc sc_pgt;
cardbus_devfunc_t sc_ct;
- cardbustag_t sc_tag;
+ pcitag_t sc_tag;
int sc_intrline;
void *sc_ih;
@@ -78,7 +78,7 @@ struct cfattach pgt_cardbus_ca = {
pgt_cardbus_detach
};
-const struct cardbus_matchid pgt_cardbus_devices[] = {
+const struct pci_matchid pgt_cardbus_devices[] = {
{ PCI_VENDOR_INTERSIL, PCI_PRODUCT_INTERSIL_ISL3877 },
{ PCI_VENDOR_INTERSIL, PCI_PRODUCT_INTERSIL_ISL3890 },
{ PCI_VENDOR_3COM, PCI_PRODUCT_3COM_3CRWE154G72 }
@@ -113,7 +113,7 @@ pgt_cardbus_attach(struct device *parent, struct device *self, void *aux)
sc->sc_power = pgt_cardbus_power;
/* remember chipset */
- if (CARDBUS_PRODUCT(ca->ca_id) == PCI_PRODUCT_INTERSIL_ISL3877)
+ if (PCI_PRODUCT(ca->ca_id) == PCI_PRODUCT_INTERSIL_ISL3877)
sc->sc_flags |= SC_ISL3877;
/* map control / status registers */
@@ -124,7 +124,7 @@ pgt_cardbus_attach(struct device *parent, struct device *self, void *aux)
printf(": can't map mem space\n");
return;
}
- csc->sc_bar0_val = base | CARDBUS_MAPREG_TYPE_MEM;
+ csc->sc_bar0_val = base | PCI_MAPREG_TYPE_MEM;
/* disable all interrupts */
bus_space_write_4(sc->sc_iotag, sc->sc_iohandle, PGT_REG_INT_EN, 0);
@@ -148,7 +148,7 @@ pgt_cardbus_detach(struct device *self, int flags)
struct pgt_cardbus_softc *csc = (struct pgt_cardbus_softc *)self;
struct pgt_softc *sc = &csc->sc_pgt;
cardbus_devfunc_t ct = csc->sc_ct;
- cardbus_chipset_tag_t cc = ct->ct_cc;
+ pci_chipset_tag_t cc = ct->ct_cc;
cardbus_function_tag_t cf = ct->ct_cf;
int error;
@@ -174,7 +174,7 @@ pgt_cardbus_enable(struct pgt_softc *sc)
{
struct pgt_cardbus_softc *csc = (struct pgt_cardbus_softc *)sc;
cardbus_devfunc_t ct = csc->sc_ct;
- cardbus_chipset_tag_t cc = ct->ct_cc;
+ pci_chipset_tag_t cc = ct->ct_cc;
cardbus_function_tag_t cf = ct->ct_cf;
/* power on the socket */
@@ -201,7 +201,7 @@ pgt_cardbus_disable(struct pgt_softc *sc)
{
struct pgt_cardbus_softc *csc = (struct pgt_cardbus_softc *)sc;
cardbus_devfunc_t ct = csc->sc_ct;
- cardbus_chipset_tag_t cc = ct->ct_cc;
+ pci_chipset_tag_t cc = ct->ct_cc;
cardbus_function_tag_t cf = ct->ct_cf;
/* unhook the interrupt handler */
@@ -227,7 +227,7 @@ void
pgt_cardbus_setup(struct pgt_cardbus_softc *csc)
{
cardbus_devfunc_t ct = csc->sc_ct;
- cardbus_chipset_tag_t cc = ct->ct_cc;
+ pci_chipset_tag_t cc = ct->ct_cc;
cardbus_function_tag_t cf = ct->ct_cf;
pcireg_t reg;
@@ -241,8 +241,8 @@ pgt_cardbus_setup(struct pgt_cardbus_softc *csc)
/* enable the appropriate bits in the PCI CSR */
reg = cardbus_conf_read(cc, cf, csc->sc_tag,
- CARDBUS_COMMAND_STATUS_REG);
- reg |= CARDBUS_COMMAND_MASTER_ENABLE | CARDBUS_COMMAND_MEM_ENABLE;
- cardbus_conf_write(cc, cf, csc->sc_tag, CARDBUS_COMMAND_STATUS_REG,
+ PCI_COMMAND_STATUS_REG);
+ reg |= PCI_COMMAND_MASTER_ENABLE | PCI_COMMAND_MEM_ENABLE;
+ cardbus_conf_write(cc, cf, csc->sc_tag, PCI_COMMAND_STATUS_REG,
reg);
}
diff --git a/sys/dev/cardbus/if_ral_cardbus.c b/sys/dev/cardbus/if_ral_cardbus.c
index b2e6e2ec710..26a14dd4c1f 100644
--- a/sys/dev/cardbus/if_ral_cardbus.c
+++ b/sys/dev/cardbus/if_ral_cardbus.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_ral_cardbus.c,v 1.14 2009/05/12 17:43:16 damien Exp $ */
+/* $OpenBSD: if_ral_cardbus.c,v 1.15 2010/03/22 22:28:27 jsg Exp $ */
/*-
* Copyright (c) 2005-2007
@@ -89,7 +89,7 @@ struct ral_cardbus_softc {
/* cardbus specific goo */
struct ral_opns *sc_opns;
cardbus_devfunc_t sc_ct;
- cardbustag_t sc_tag;
+ pcitag_t sc_tag;
void *sc_ih;
bus_size_t sc_mapsize;
pcireg_t sc_bar_val;
@@ -105,7 +105,7 @@ struct cfattach ral_cardbus_ca = {
ral_cardbus_attach, ral_cardbus_detach
};
-static const struct cardbus_matchid ral_cardbus_devices[] = {
+static const struct pci_matchid ral_cardbus_devices[] = {
{ PCI_VENDOR_RALINK, PCI_PRODUCT_RALINK_RT2560 },
{ PCI_VENDOR_RALINK, PCI_PRODUCT_RALINK_RT2561 },
{ PCI_VENDOR_RALINK, PCI_PRODUCT_RALINK_RT2561S },
@@ -146,8 +146,8 @@ ral_cardbus_attach(struct device *parent, struct device *self, void *aux)
bus_addr_t base;
int error;
- if (CARDBUS_VENDOR(ca->ca_id) == PCI_VENDOR_RALINK) {
- switch (CARDBUS_PRODUCT(ca->ca_id)) {
+ if (PCI_VENDOR(ca->ca_id) == PCI_VENDOR_RALINK) {
+ switch (PCI_PRODUCT(ca->ca_id)) {
case PCI_PRODUCT_RALINK_RT2560:
csc->sc_opns = &ral_rt2560_opns;
break;
@@ -179,21 +179,21 @@ ral_cardbus_attach(struct device *parent, struct device *self, void *aux)
/* map control/status registers */
error = Cardbus_mapreg_map(ct, CARDBUS_BASE0_REG,
- CARDBUS_MAPREG_TYPE_MEM, 0, &sc->sc_st, &sc->sc_sh, &base,
+ PCI_MAPREG_TYPE_MEM, 0, &sc->sc_st, &sc->sc_sh, &base,
&csc->sc_mapsize);
if (error != 0) {
printf(": can't map mem space\n");
return;
}
- csc->sc_bar_val = base | CARDBUS_MAPREG_TYPE_MEM;
+ csc->sc_bar_val = base | PCI_MAPREG_TYPE_MEM;
/* set up the PCI configuration registers */
ral_cardbus_setup(csc);
printf(": irq %d", csc->sc_intrline);
- (*csc->sc_opns->attach)(sc, CARDBUS_PRODUCT(ca->ca_id));
+ (*csc->sc_opns->attach)(sc, PCI_PRODUCT(ca->ca_id));
Cardbus_function_disable(ct);
}
@@ -204,7 +204,7 @@ ral_cardbus_detach(struct device *self, int flags)
struct ral_cardbus_softc *csc = (struct ral_cardbus_softc *)self;
struct rt2560_softc *sc = &csc->sc_sc;
cardbus_devfunc_t ct = csc->sc_ct;
- cardbus_chipset_tag_t cc = ct->ct_cc;
+ pci_chipset_tag_t cc = ct->ct_cc;
cardbus_function_tag_t cf = ct->ct_cf;
int error;
@@ -230,7 +230,7 @@ ral_cardbus_enable(struct rt2560_softc *sc)
{
struct ral_cardbus_softc *csc = (struct ral_cardbus_softc *)sc;
cardbus_devfunc_t ct = csc->sc_ct;
- cardbus_chipset_tag_t cc = ct->ct_cc;
+ pci_chipset_tag_t cc = ct->ct_cc;
cardbus_function_tag_t cf = ct->ct_cf;
/* power on the socket */
@@ -257,7 +257,7 @@ ral_cardbus_disable(struct rt2560_softc *sc)
{
struct ral_cardbus_softc *csc = (struct ral_cardbus_softc *)sc;
cardbus_devfunc_t ct = csc->sc_ct;
- cardbus_chipset_tag_t cc = ct->ct_cc;
+ pci_chipset_tag_t cc = ct->ct_cc;
cardbus_function_tag_t cf = ct->ct_cf;
/* unhook the interrupt handler */
@@ -283,7 +283,7 @@ void
ral_cardbus_setup(struct ral_cardbus_softc *csc)
{
cardbus_devfunc_t ct = csc->sc_ct;
- cardbus_chipset_tag_t cc = ct->ct_cc;
+ pci_chipset_tag_t cc = ct->ct_cc;
cardbus_function_tag_t cf = ct->ct_cf;
pcireg_t reg;
@@ -297,8 +297,8 @@ ral_cardbus_setup(struct ral_cardbus_softc *csc)
/* enable the appropriate bits in the PCI CSR */
reg = cardbus_conf_read(cc, cf, csc->sc_tag,
- CARDBUS_COMMAND_STATUS_REG);
- reg |= CARDBUS_COMMAND_MASTER_ENABLE | CARDBUS_COMMAND_MEM_ENABLE;
- cardbus_conf_write(cc, cf, csc->sc_tag, CARDBUS_COMMAND_STATUS_REG,
+ PCI_COMMAND_STATUS_REG);
+ reg |= PCI_COMMAND_MASTER_ENABLE | PCI_COMMAND_MEM_ENABLE;
+ cardbus_conf_write(cc, cf, csc->sc_tag, PCI_COMMAND_STATUS_REG,
reg);
}
diff --git a/sys/dev/cardbus/if_re_cardbus.c b/sys/dev/cardbus/if_re_cardbus.c
index 1e107aeec17..be842b33aa1 100644
--- a/sys/dev/cardbus/if_re_cardbus.c
+++ b/sys/dev/cardbus/if_re_cardbus.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_re_cardbus.c,v 1.16 2009/08/20 18:47:03 martynas Exp $ */
+/* $OpenBSD: if_re_cardbus.c,v 1.17 2010/03/22 22:28:27 jsg Exp $ */
/*
* Copyright (c) 2005 Peter Valchev <pvalchev@openbsd.org>
@@ -60,7 +60,7 @@ struct re_cardbus_softc {
/* Cardbus-specific data */
void *sc_ih;
cardbus_devfunc_t ct;
- cardbustag_t sc_tag;
+ pcitag_t sc_tag;
int sc_csr;
int sc_cben;
int sc_bar_reg;
@@ -87,7 +87,7 @@ struct cfattach re_cardbus_ca = {
re_cardbus_detach
};
-const struct cardbus_matchid re_cardbus_devices[] = {
+const struct pci_matchid re_cardbus_devices[] = {
{ PCI_VENDOR_REALTEK, PCI_PRODUCT_REALTEK_RT8169 },
};
@@ -115,7 +115,7 @@ re_cardbus_attach(struct device *parent, struct device *self, void *aux)
struct cardbus_attach_args *ca = aux;
struct cardbus_softc *psc =
(struct cardbus_softc *)sc->sc_dev.dv_parent;
- cardbus_chipset_tag_t cc = psc->sc_cc;
+ pci_chipset_tag_t cc = psc->sc_cc;
cardbus_function_tag_t cf = psc->sc_cf;
cardbus_devfunc_t ct = ca->ca_ct;
bus_addr_t adr;
@@ -129,12 +129,12 @@ re_cardbus_attach(struct device *parent, struct device *self, void *aux)
/*
* Map control/status registers.
*/
- if (Cardbus_mapreg_map(ct, RL_PCI_LOMEM, CARDBUS_MAPREG_TYPE_MEM, 0,
+ if (Cardbus_mapreg_map(ct, RL_PCI_LOMEM, PCI_MAPREG_TYPE_MEM, 0,
&sc->rl_btag, &sc->rl_bhandle, &adr, &csc->sc_mapsize) == 0) {
csc->sc_cben = CARDBUS_MEM_ENABLE;
- csc->sc_csr |= CARDBUS_COMMAND_MEM_ENABLE;
+ csc->sc_csr |= PCI_COMMAND_MEM_ENABLE;
csc->sc_bar_reg = RL_PCI_LOMEM;
- csc->sc_bar_val = adr | CARDBUS_MAPREG_TYPE_MEM;
+ csc->sc_bar_val = adr | PCI_MAPREG_TYPE_MEM;
} else {
printf(": can't map mem space\n");
return;
@@ -178,7 +178,7 @@ re_cardbus_setup(struct rl_softc *sc)
{
struct re_cardbus_softc *csc = (struct re_cardbus_softc *)sc;
cardbus_devfunc_t ct = csc->ct;
- cardbus_chipset_tag_t cc = ct->ct_cc;
+ pci_chipset_tag_t cc = ct->ct_cc;
cardbus_function_tag_t cf = ct->ct_cf;
pcireg_t reg, command;
int pmreg;
@@ -220,17 +220,17 @@ re_cardbus_setup(struct rl_softc *sc)
cardbus_conf_write(cc, cf, csc->sc_tag, csc->sc_bar_reg, csc->sc_bar_val);
/* Enable proper bits in CARDBUS CSR */
- reg = cardbus_conf_read(cc, cf, csc->sc_tag, CARDBUS_COMMAND_STATUS_REG);
- reg &= ~(CARDBUS_COMMAND_IO_ENABLE|CARDBUS_COMMAND_MEM_ENABLE);
+ reg = cardbus_conf_read(cc, cf, csc->sc_tag, PCI_COMMAND_STATUS_REG);
+ reg &= ~(PCI_COMMAND_IO_ENABLE|PCI_COMMAND_MEM_ENABLE);
reg |= csc->sc_csr;
- cardbus_conf_write(cc, cf, csc->sc_tag, CARDBUS_COMMAND_STATUS_REG, reg);
+ cardbus_conf_write(cc, cf, csc->sc_tag, PCI_COMMAND_STATUS_REG, reg);
/* Make sure the latency timer is set to some reasonable value */
- reg = cardbus_conf_read(cc, cf, csc->sc_tag, CARDBUS_BHLC_REG);
- if (CARDBUS_LATTIMER(reg) < 0x20) {
- reg &= ~(CARDBUS_LATTIMER_MASK << CARDBUS_LATTIMER_SHIFT);
- reg |= (0x20 << CARDBUS_LATTIMER_SHIFT);
- cardbus_conf_write(cc, cf, csc->sc_tag, CARDBUS_BHLC_REG, reg);
+ reg = cardbus_conf_read(cc, cf, csc->sc_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, csc->sc_tag, PCI_BHLC_REG, reg);
}
}
diff --git a/sys/dev/cardbus/if_rl_cardbus.c b/sys/dev/cardbus/if_rl_cardbus.c
index fe9c673a6c4..c126c6001bd 100644
--- a/sys/dev/cardbus/if_rl_cardbus.c
+++ b/sys/dev/cardbus/if_rl_cardbus.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_rl_cardbus.c,v 1.18 2009/12/21 18:14:51 naddy Exp $ */
+/* $OpenBSD: if_rl_cardbus.c,v 1.19 2010/03/22 22:28:27 jsg Exp $ */
/* $NetBSD: if_rl_cardbus.c,v 1.3.8.3 2001/11/14 19:14:02 nathanw Exp $ */
/*
@@ -94,7 +94,7 @@
/*
* Various supported device vendors/types and their names.
*/
-const struct cardbus_matchid rl_cardbus_devices[] = {
+const struct pci_matchid rl_cardbus_devices[] = {
{ PCI_VENDOR_ACCTON, PCI_PRODUCT_ACCTON_5030 },
{ PCI_VENDOR_ABOCOM, PCI_PRODUCT_ABOCOM_FE2000VX },
{ PCI_VENDOR_REALTEK, PCI_PRODUCT_REALTEK_RT8138 },
@@ -112,7 +112,7 @@ struct rl_cardbus_softc {
/* CardBus-specific goo. */
void *sc_ih;
cardbus_devfunc_t sc_ct;
- cardbustag_t sc_tag;
+ pcitag_t sc_tag;
int sc_csr;
int sc_cben;
int sc_bar_reg;
@@ -149,7 +149,7 @@ rl_cardbus_attach(struct device *parent, struct device *self, void *aux)
struct cardbus_attach_args *ca = aux;
struct cardbus_softc *psc =
(struct cardbus_softc *)sc->sc_dev.dv_parent;
- cardbus_chipset_tag_t cc = psc->sc_cc;
+ pci_chipset_tag_t cc = psc->sc_cc;
cardbus_function_tag_t cf = psc->sc_cf;
cardbus_devfunc_t ct = ca->ca_ct;
bus_addr_t adr;
@@ -162,22 +162,22 @@ rl_cardbus_attach(struct device *parent, struct device *self, void *aux)
/*
* Map control/status registers.
*/
- csc->sc_csr = CARDBUS_COMMAND_MASTER_ENABLE;
+ csc->sc_csr = PCI_COMMAND_MASTER_ENABLE;
#ifdef RL_USEIOSPACE
- if (Cardbus_mapreg_map(ct, RL_PCI_LOIO, CARDBUS_MAPREG_TYPE_IO, 0,
+ if (Cardbus_mapreg_map(ct, RL_PCI_LOIO, PCI_MAPREG_TYPE_IO, 0,
&sc->rl_btag, &sc->rl_bhandle, &adr, &csc->sc_mapsize) == 0) {
csc->sc_cben = CARDBUS_IO_ENABLE;
- csc->sc_csr |= CARDBUS_COMMAND_IO_ENABLE;
+ csc->sc_csr |= PCI_COMMAND_IO_ENABLE;
csc->sc_bar_reg = RL_PCI_LOIO;
- csc->sc_bar_val = adr | CARDBUS_MAPREG_TYPE_IO;
+ csc->sc_bar_val = adr | PCI_MAPREG_TYPE_IO;
}
#else
- if (Cardbus_mapreg_map(ct, RL_PCI_LOMEM, CARDBUS_MAPREG_TYPE_MEM, 0,
+ if (Cardbus_mapreg_map(ct, RL_PCI_LOMEM, PCI_MAPREG_TYPE_MEM, 0,
&sc->rl_btag, &sc->rl_bhandle, &adr, &csc->sc_mapsize) == 0) {
csc->sc_cben = CARDBUS_MEM_ENABLE;
- csc->sc_csr |= CARDBUS_COMMAND_MEM_ENABLE;
+ csc->sc_csr |= PCI_COMMAND_MEM_ENABLE;
csc->sc_bar_reg = RL_PCI_LOMEM;
- csc->sc_bar_val = adr | CARDBUS_MAPREG_TYPE_MEM;
+ csc->sc_bar_val = adr | PCI_MAPREG_TYPE_MEM;
}
#endif
else {
@@ -244,7 +244,7 @@ rl_cardbus_setup(struct rl_cardbus_softc *csc)
{
struct rl_softc *sc = &csc->sc_rl;
cardbus_devfunc_t ct = csc->sc_ct;
- cardbus_chipset_tag_t cc = ct->ct_cc;
+ pci_chipset_tag_t cc = ct->ct_cc;
cardbus_function_tag_t cf = ct->ct_cf;
pcireg_t reg, command;
int pmreg;
@@ -294,21 +294,21 @@ rl_cardbus_setup(struct rl_cardbus_softc *csc)
/* Enable the appropriate bits in the CARDBUS CSR. */
reg = cardbus_conf_read(cc, cf, csc->sc_tag,
- CARDBUS_COMMAND_STATUS_REG);
- reg &= ~(CARDBUS_COMMAND_IO_ENABLE|CARDBUS_COMMAND_MEM_ENABLE);
+ PCI_COMMAND_STATUS_REG);
+ reg &= ~(PCI_COMMAND_IO_ENABLE|PCI_COMMAND_MEM_ENABLE);
reg |= csc->sc_csr;
cardbus_conf_write(cc, cf, csc->sc_tag,
- CARDBUS_COMMAND_STATUS_REG, reg);
+ PCI_COMMAND_STATUS_REG, reg);
/*
* Make sure the latency timer is set to some reasonable
* value.
*/
- reg = cardbus_conf_read(cc, cf, csc->sc_tag, CARDBUS_BHLC_REG);
- if (CARDBUS_LATTIMER(reg) < 0x20) {
- reg &= ~(CARDBUS_LATTIMER_MASK << CARDBUS_LATTIMER_SHIFT);
- reg |= (0x20 << CARDBUS_LATTIMER_SHIFT);
- cardbus_conf_write(cc, cf, csc->sc_tag, CARDBUS_BHLC_REG, reg);
+ reg = cardbus_conf_read(cc, cf, csc->sc_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, csc->sc_tag, PCI_BHLC_REG, reg);
}
}
diff --git a/sys/dev/cardbus/if_rtw_cardbus.c b/sys/dev/cardbus/if_rtw_cardbus.c
index 606b1c21e86..17d645ee80a 100644
--- a/sys/dev/cardbus/if_rtw_cardbus.c
+++ b/sys/dev/cardbus/if_rtw_cardbus.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_rtw_cardbus.c,v 1.15 2008/07/18 12:00:20 reyk Exp $ */
+/* $OpenBSD: if_rtw_cardbus.c,v 1.16 2010/03/22 22:28:27 jsg Exp $ */
/* $NetBSD: if_rtw_cardbus.c,v 1.4 2004/12/20 21:05:34 dyoung Exp $ */
/*-
@@ -123,7 +123,7 @@ struct rtw_cardbus_softc {
/* CardBus-specific goo. */
void *sc_ih; /* interrupt handle */
cardbus_devfunc_t sc_ct; /* our CardBus devfuncs */
- cardbustag_t sc_tag; /* our CardBus tag */
+ pcitag_t sc_tag; /* our CardBus tag */
int sc_csr; /* CSR bits */
bus_size_t sc_mapsize; /* size of the mapped bus space
* region
@@ -153,7 +153,7 @@ int rtw_cardbus_enable(struct rtw_softc *);
void rtw_cardbus_disable(struct rtw_softc *);
void rtw_cardbus_power(struct rtw_softc *, int);
-const struct cardbus_matchid rtw_cardbus_devices[] = {
+const struct pci_matchid rtw_cardbus_devices[] = {
{ PCI_VENDOR_REALTEK, PCI_PRODUCT_REALTEK_RT8180 },
#ifdef RTW_DEBUG
{ PCI_VENDOR_REALTEK, PCI_PRODUCT_REALTEK_RT8185 },
@@ -226,27 +226,27 @@ rtw_cardbus_attach(struct device *parent, struct device *self, void *aux)
/*
* Map the device.
*/
- csc->sc_csr = CARDBUS_COMMAND_MASTER_ENABLE;
+ csc->sc_csr = PCI_COMMAND_MASTER_ENABLE;
if (Cardbus_mapreg_map(ct, RTW_PCI_MMBA,
- CARDBUS_MAPREG_TYPE_MEM, 0, &regs->r_bt, &regs->r_bh, &adr,
+ PCI_MAPREG_TYPE_MEM, 0, &regs->r_bt, &regs->r_bh, &adr,
&csc->sc_mapsize) == 0) {
RTW_DPRINTF(RTW_DEBUG_ATTACH,
("%s: %s mapped %lu bytes mem space\n",
sc->sc_dev.dv_xname, __func__, (long)csc->sc_mapsize));
csc->sc_cben = CARDBUS_MEM_ENABLE;
- csc->sc_csr |= CARDBUS_COMMAND_MEM_ENABLE;
+ csc->sc_csr |= PCI_COMMAND_MEM_ENABLE;
csc->sc_bar_reg = RTW_PCI_MMBA;
- csc->sc_bar_val = adr | CARDBUS_MAPREG_TYPE_MEM;
+ csc->sc_bar_val = adr | PCI_MAPREG_TYPE_MEM;
} else if (Cardbus_mapreg_map(ct, RTW_PCI_IOBA,
- CARDBUS_MAPREG_TYPE_IO, 0, &regs->r_bt, &regs->r_bh, &adr,
+ PCI_MAPREG_TYPE_IO, 0, &regs->r_bt, &regs->r_bh, &adr,
&csc->sc_mapsize) == 0) {
RTW_DPRINTF(RTW_DEBUG_ATTACH,
("%s: %s mapped %lu bytes I/O space\n",
sc->sc_dev.dv_xname, __func__, (long)csc->sc_mapsize));
csc->sc_cben = CARDBUS_IO_ENABLE;
- csc->sc_csr |= CARDBUS_COMMAND_IO_ENABLE;
+ csc->sc_csr |= PCI_COMMAND_IO_ENABLE;
csc->sc_bar_reg = RTW_PCI_IOBA;
- csc->sc_bar_val = adr | CARDBUS_MAPREG_TYPE_IO;
+ csc->sc_bar_val = adr | PCI_MAPREG_TYPE_IO;
} else {
printf("%s: unable to map device registers\n",
sc->sc_dev.dv_xname);
@@ -321,7 +321,7 @@ rtw_cardbus_enable(struct rtw_softc *sc)
{
struct rtw_cardbus_softc *csc = (void *) sc;
cardbus_devfunc_t ct = csc->sc_ct;
- cardbus_chipset_tag_t cc = ct->ct_cc;
+ pci_chipset_tag_t cc = ct->ct_cc;
cardbus_function_tag_t cf = ct->ct_cf;
/*
@@ -359,7 +359,7 @@ rtw_cardbus_disable(struct rtw_softc *sc)
{
struct rtw_cardbus_softc *csc = (void *) sc;
cardbus_devfunc_t ct = csc->sc_ct;
- cardbus_chipset_tag_t cc = ct->ct_cc;
+ pci_chipset_tag_t cc = ct->ct_cc;
cardbus_function_tag_t cf = ct->ct_cf;
RTW_WRITE(&sc->sc_regs, RTW_FEMR,
@@ -390,7 +390,7 @@ rtw_cardbus_setup(struct rtw_cardbus_softc *csc)
{
struct rtw_softc *sc = &csc->sc_rtw;
cardbus_devfunc_t ct = csc->sc_ct;
- cardbus_chipset_tag_t cc = ct->ct_cc;
+ pci_chipset_tag_t cc = ct->ct_cc;
cardbus_function_tag_t cf = ct->ct_cf;
pcireg_t reg;
int pmreg;
@@ -427,20 +427,20 @@ rtw_cardbus_setup(struct rtw_cardbus_softc *csc)
/* Enable the appropriate bits in the PCI CSR. */
reg = cardbus_conf_read(cc, cf, csc->sc_tag,
- CARDBUS_COMMAND_STATUS_REG);
- reg &= ~(CARDBUS_COMMAND_IO_ENABLE|CARDBUS_COMMAND_MEM_ENABLE);
+ PCI_COMMAND_STATUS_REG);
+ reg &= ~(PCI_COMMAND_IO_ENABLE|PCI_COMMAND_MEM_ENABLE);
reg |= csc->sc_csr;
- cardbus_conf_write(cc, cf, csc->sc_tag, CARDBUS_COMMAND_STATUS_REG,
+ cardbus_conf_write(cc, cf, csc->sc_tag, PCI_COMMAND_STATUS_REG,
reg);
/*
* Make sure the latency timer is set to some reasonable
* value.
*/
- reg = cardbus_conf_read(cc, cf, csc->sc_tag, CARDBUS_BHLC_REG);
- if (CARDBUS_LATTIMER(reg) < 0x20) {
- reg &= ~(CARDBUS_LATTIMER_MASK << CARDBUS_LATTIMER_SHIFT);
- reg |= (0x20 << CARDBUS_LATTIMER_SHIFT);
- cardbus_conf_write(cc, cf, csc->sc_tag, CARDBUS_BHLC_REG, reg);
+ reg = cardbus_conf_read(cc, cf, csc->sc_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, csc->sc_tag, PCI_BHLC_REG, reg);
}
}
diff --git a/sys/dev/cardbus/if_xl_cardbus.c b/sys/dev/cardbus/if_xl_cardbus.c
index ed9a30c6ebe..7afef8dfaa1 100644
--- a/sys/dev/cardbus/if_xl_cardbus.c
+++ b/sys/dev/cardbus/if_xl_cardbus.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_xl_cardbus.c,v 1.24 2010/01/13 09:10:33 jsg Exp $ */
+/* $OpenBSD: if_xl_cardbus.c,v 1.25 2010/03/22 22:28:27 jsg Exp $ */
/* $NetBSD: if_xl_cardbus.c,v 1.13 2000/03/07 00:32:52 mycroft Exp $ */
/*
@@ -116,42 +116,42 @@ const struct xl_cardbus_product {
} xl_cardbus_products[] = {
{ PCI_PRODUCT_3COM_3C575,
XL_FLAG_PHYOK | XL_FLAG_EEPROM_OFFSET_30 | XL_FLAG_8BITROM,
- CARDBUS_COMMAND_IO_ENABLE | CARDBUS_COMMAND_MASTER_ENABLE,
+ PCI_COMMAND_IO_ENABLE | PCI_COMMAND_MASTER_ENABLE,
XL_CARDBUS_BOOMERANG },
{ PCI_PRODUCT_3COM_3CCFE575BT,
XL_FLAG_PHYOK | XL_FLAG_EEPROM_OFFSET_30 | XL_FLAG_8BITROM |
XL_FLAG_INVERT_LED_PWR,
- CARDBUS_COMMAND_IO_ENABLE | CARDBUS_COMMAND_MEM_ENABLE |
- CARDBUS_COMMAND_MASTER_ENABLE,
+ PCI_COMMAND_IO_ENABLE | PCI_COMMAND_MEM_ENABLE |
+ PCI_COMMAND_MASTER_ENABLE,
XL_CARDBUS_CYCLONE },
{ PCI_PRODUCT_3COM_3CCFE575CT,
XL_FLAG_PHYOK | XL_FLAG_EEPROM_OFFSET_30 | XL_FLAG_8BITROM |
XL_FLAG_INVERT_MII_PWR,
- CARDBUS_COMMAND_IO_ENABLE | CARDBUS_COMMAND_MEM_ENABLE |
- CARDBUS_COMMAND_MASTER_ENABLE,
+ PCI_COMMAND_IO_ENABLE | PCI_COMMAND_MEM_ENABLE |
+ PCI_COMMAND_MASTER_ENABLE,
XL_CARDBUS_CYCLONE },
{ PCI_PRODUCT_3COM_3CCFEM656,
XL_FLAG_PHYOK | XL_FLAG_EEPROM_OFFSET_30 | XL_FLAG_8BITROM |
XL_FLAG_INVERT_LED_PWR | XL_FLAG_INVERT_MII_PWR,
- CARDBUS_COMMAND_IO_ENABLE | CARDBUS_COMMAND_MEM_ENABLE |
- CARDBUS_COMMAND_MASTER_ENABLE,
+ PCI_COMMAND_IO_ENABLE | PCI_COMMAND_MEM_ENABLE |
+ PCI_COMMAND_MASTER_ENABLE,
XL_CARDBUS_CYCLONE },
{ PCI_PRODUCT_3COM_3CCFEM656B,
XL_FLAG_PHYOK | XL_FLAG_EEPROM_OFFSET_30 | XL_FLAG_8BITROM |
XL_FLAG_INVERT_LED_PWR | XL_FLAG_INVERT_MII_PWR,
- CARDBUS_COMMAND_IO_ENABLE | CARDBUS_COMMAND_MEM_ENABLE |
- CARDBUS_COMMAND_MASTER_ENABLE,
+ PCI_COMMAND_IO_ENABLE | PCI_COMMAND_MEM_ENABLE |
+ PCI_COMMAND_MASTER_ENABLE,
XL_CARDBUS_CYCLONE },
{ PCI_PRODUCT_3COM_3CCFEM656C,
XL_FLAG_PHYOK | XL_FLAG_EEPROM_OFFSET_30 | XL_FLAG_8BITROM |
XL_FLAG_INVERT_MII_PWR,
- CARDBUS_COMMAND_IO_ENABLE | CARDBUS_COMMAND_MEM_ENABLE |
- CARDBUS_COMMAND_MASTER_ENABLE,
+ PCI_COMMAND_IO_ENABLE | PCI_COMMAND_MEM_ENABLE |
+ PCI_COMMAND_MASTER_ENABLE,
XL_CARDBUS_CYCLONE },
{ 0,
@@ -167,11 +167,11 @@ xl_cardbus_lookup(const struct cardbus_attach_args *ca)
{
const struct xl_cardbus_product *ecp;
- if (CARDBUS_VENDOR(ca->ca_id) != PCI_VENDOR_3COM)
+ if (PCI_VENDOR(ca->ca_id) != PCI_VENDOR_3COM)
return (NULL);
for (ecp = xl_cardbus_products; ecp->ecp_prodid != 0; ecp++)
- if (CARDBUS_PRODUCT(ca->ca_id) == ecp->ecp_prodid)
+ if (PCI_PRODUCT(ca->ca_id) == ecp->ecp_prodid)
return (ecp);
return (NULL);
}
@@ -194,14 +194,14 @@ xl_cardbus_attach(struct device *parent, struct device *self, void *aux)
struct xl_softc *sc = &csc->sc_softc;
struct cardbus_attach_args *ca = aux;
cardbus_devfunc_t ct = ca->ca_ct;
- cardbus_chipset_tag_t cc = ct->ct_cc;
+ pci_chipset_tag_t cc = ct->ct_cc;
cardbus_function_tag_t cf = ct->ct_cf;
- cardbusreg_t command, bhlc;
+ pcireg_t command, bhlc;
const struct xl_cardbus_product *ecp;
bus_space_handle_t ioh;
bus_addr_t adr;
- if (Cardbus_mapreg_map(ct, CARDBUS_BASE0_REG, CARDBUS_MAPREG_TYPE_IO, 0,
+ if (Cardbus_mapreg_map(ct, CARDBUS_BASE0_REG, PCI_MAPREG_TYPE_IO, 0,
&sc->xl_btag, &ioh, &adr, &csc->sc_mapsize)) {
printf(": can't map i/o space\n");
return;
@@ -221,14 +221,14 @@ xl_cardbus_attach(struct device *parent, struct device *self, void *aux)
(ct->ct_cf->cardbus_ctrl)(cc, CARDBUS_IO_ENABLE);
command = cardbus_conf_read(cc, cf, ca->ca_tag,
- CARDBUS_COMMAND_STATUS_REG);
+ PCI_COMMAND_STATUS_REG);
command |= ecp->ecp_csr;
csc->sc_cardtype = ecp->ecp_cardtype;
if (csc->sc_cardtype == XL_CARDBUS_CYCLONE) {
/* map CardBus function status window */
if (Cardbus_mapreg_map(ct, CARDBUS_BASE2_REG,
- CARDBUS_MAPREG_TYPE_MEM, 0, &csc->sc_funct,
+ PCI_MAPREG_TYPE_MEM, 0, &csc->sc_funct,
&csc->sc_funch, 0, &csc->sc_funcsize)) {
printf("%s: unable to map function status window\n",
self->dv_xname);
@@ -244,20 +244,20 @@ xl_cardbus_attach(struct device *parent, struct device *self, void *aux)
}
(ct->ct_cf->cardbus_ctrl)(cc, CARDBUS_BM_ENABLE);
- cardbus_conf_write(cc, cf, ca->ca_tag, CARDBUS_COMMAND_STATUS_REG,
+ cardbus_conf_write(cc, cf, ca->ca_tag, PCI_COMMAND_STATUS_REG,
command);
/*
* set latency timer
*/
- bhlc = cardbus_conf_read(cc, cf, ca->ca_tag, CARDBUS_BHLC_REG);
- if (CARDBUS_LATTIMER(bhlc) < 0x20) {
+ bhlc = cardbus_conf_read(cc, cf, ca->ca_tag, PCI_BHLC_REG);
+ if (PCI_LATTIMER(bhlc) < 0x20) {
/* at least the value of latency timer should 0x20. */
DPRINTF(("if_xl_cardbus: lattimer 0x%x -> 0x20\n",
- CARDBUS_LATTIMER(bhlc)));
- bhlc &= ~(CARDBUS_LATTIMER_MASK << CARDBUS_LATTIMER_SHIFT);
- bhlc |= (0x20 << CARDBUS_LATTIMER_SHIFT);
- cardbus_conf_write(cc, cf, ca->ca_tag, CARDBUS_BHLC_REG, bhlc);
+ PCI_LATTIMER(bhlc)));
+ bhlc &= ~(PCI_LATTIMER_MASK << PCI_LATTIMER_SHIFT);
+ bhlc |= (0x20 << PCI_LATTIMER_SHIFT);
+ cardbus_conf_write(cc, cf, ca->ca_tag, PCI_BHLC_REG, bhlc);
}
csc->sc_ct = ca->ca_ct;
diff --git a/sys/dev/cardbus/ohci_cardbus.c b/sys/dev/cardbus/ohci_cardbus.c
index cd2e799bba7..e69acb1a6cd 100644
--- a/sys/dev/cardbus/ohci_cardbus.c
+++ b/sys/dev/cardbus/ohci_cardbus.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ohci_cardbus.c,v 1.12 2009/06/02 12:32:08 deraadt Exp $ */
+/* $OpenBSD: ohci_cardbus.c,v 1.13 2010/03/22 22:28:27 jsg Exp $ */
/* $NetBSD: ohci_cardbus.c,v 1.19 2004/08/02 19:14:28 mycroft Exp $ */
/*
@@ -64,7 +64,7 @@ int ohci_cardbus_detach(struct device *, int);
struct ohci_cardbus_softc {
ohci_softc_t sc;
- cardbus_chipset_tag_t sc_cc;
+ pci_chipset_tag_t sc_cc;
cardbus_function_tag_t sc_cf;
cardbus_devfunc_t sc_ct;
void *sc_ih; /* interrupt vectoring */
@@ -75,7 +75,6 @@ struct cfattach ohci_cardbus_ca = {
ohci_cardbus_attach, ohci_cardbus_detach, ohci_activate
};
-#define CARDBUS_INTERFACE_OHCI PCI_INTERFACE_OHCI
#define CARDBUS_CBMEM PCI_CBMEM
#define cardbus_findvendor pci_findvendor
@@ -84,9 +83,9 @@ ohci_cardbus_match(struct device *parent, void *match, void *aux)
{
struct cardbus_attach_args *ca = (struct cardbus_attach_args *)aux;
- if (CARDBUS_CLASS(ca->ca_class) == CARDBUS_CLASS_SERIALBUS &&
- CARDBUS_SUBCLASS(ca->ca_class) == CARDBUS_SUBCLASS_SERIALBUS_USB &&
- CARDBUS_INTERFACE(ca->ca_class) == CARDBUS_INTERFACE_OHCI)
+ if (PCI_CLASS(ca->ca_class) == PCI_CLASS_SERIALBUS &&
+ PCI_SUBCLASS(ca->ca_class) == PCI_SUBCLASS_SERIALBUS_USB &&
+ PCI_INTERFACE(ca->ca_class) == PCI_INTERFACE_OHCI)
return (1);
return (0);
@@ -98,15 +97,15 @@ ohci_cardbus_attach(struct device *parent, struct device *self, void *aux)
struct ohci_cardbus_softc *sc = (struct ohci_cardbus_softc *)self;
struct cardbus_attach_args *ca = aux;
cardbus_devfunc_t ct = ca->ca_ct;
- cardbus_chipset_tag_t cc = ct->ct_cc;
+ pci_chipset_tag_t cc = ct->ct_cc;
cardbus_function_tag_t cf = ct->ct_cf;
- cardbusreg_t csr;
+ pcireg_t csr;
usbd_status r;
const char *vendor;
const char *devname = sc->sc.sc_bus.bdev.dv_xname;
/* Map I/O registers */
- if (Cardbus_mapreg_map(ct, CARDBUS_CBMEM, CARDBUS_MAPREG_TYPE_MEM, 0,
+ if (Cardbus_mapreg_map(ct, CARDBUS_CBMEM, PCI_MAPREG_TYPE_MEM, 0,
&sc->sc.iot, &sc->sc.ioh, NULL, &sc->sc.sc_size)) {
printf(": can't map mem space\n");
return;
@@ -126,10 +125,10 @@ ohci_cardbus_attach(struct device *parent, struct device *self, void *aux)
/* Enable the device. */
csr = cardbus_conf_read(cc, cf, ca->ca_tag,
- CARDBUS_COMMAND_STATUS_REG);
- cardbus_conf_write(cc, cf, ca->ca_tag, CARDBUS_COMMAND_STATUS_REG,
- csr | CARDBUS_COMMAND_MASTER_ENABLE
- | CARDBUS_COMMAND_MEM_ENABLE);
+ PCI_COMMAND_STATUS_REG);
+ cardbus_conf_write(cc, cf, ca->ca_tag, PCI_COMMAND_STATUS_REG,
+ csr | PCI_COMMAND_MASTER_ENABLE
+ | PCI_COMMAND_MEM_ENABLE);
sc->sc_ih = cardbus_intr_establish(cc, cf, ca->ca_intrline,
IPL_USB, ohci_intr, sc, devname);
@@ -141,12 +140,12 @@ ohci_cardbus_attach(struct device *parent, struct device *self, void *aux)
/* Figure out vendor for root hub descriptor. */
vendor = cardbus_findvendor(ca->ca_id);
- sc->sc.sc_id_vendor = CARDBUS_VENDOR(ca->ca_id);
+ sc->sc.sc_id_vendor = PCI_VENDOR(ca->ca_id);
if (vendor)
strlcpy(sc->sc.sc_vendor, vendor, sizeof(sc->sc.sc_vendor));
else
snprintf(sc->sc.sc_vendor, sizeof(sc->sc.sc_vendor),
- "vendor 0x%04x", CARDBUS_VENDOR(ca->ca_id));
+ "vendor 0x%04x", PCI_VENDOR(ca->ca_id));
/* Display revision and perform legacy emulation handover. */
if (ohci_checkrev(&sc->sc) != USBD_NORMAL_COMPLETION ||
diff --git a/sys/dev/cardbus/puc_cardbus.c b/sys/dev/cardbus/puc_cardbus.c
index f6f95d76b1d..f023fdc0786 100644
--- a/sys/dev/cardbus/puc_cardbus.c
+++ b/sys/dev/cardbus/puc_cardbus.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: puc_cardbus.c,v 1.3 2007/12/04 21:49:35 kettenis Exp $ */
+/* $OpenBSD: puc_cardbus.c,v 1.4 2010/03/22 22:28:27 jsg Exp $ */
/*
* Copyright (c) 2006 Michael Shalayeff
@@ -57,11 +57,11 @@ puc_cardbus_match(struct device *parent, void *match, 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 cc = ct->ct_cc;
cardbus_function_tag_t cf = ct->ct_cf;
- cardbusreg_t bhlc, reg;
+ pcireg_t bhlc, reg;
- bhlc = cardbus_conf_read(cc, cf, ca->ca_tag, CARDBUS_BHLC_REG);
+ bhlc = cardbus_conf_read(cc, cf, ca->ca_tag, PCI_BHLC_REG);
if (PCI_HDRTYPE_TYPE(bhlc) != 0)
return(0);
@@ -85,10 +85,10 @@ puc_cardbus_attach(struct device *parent, struct device *self, void *aux)
struct puc_softc *sc = &csc->sc_psc;
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 cc = ct->ct_cc;
cardbus_function_tag_t cf = ct->ct_cf;
struct puc_attach_args paa;
- cardbusreg_t reg;
+ pcireg_t reg;
int i;
Cardbus_function_enable(ct);
@@ -103,7 +103,7 @@ puc_cardbus_attach(struct device *parent, struct device *self, void *aux)
/* the fifth one is some memory we dunno */
for (i = 0; i < PUC_NBARS; i++) {
- cardbusreg_t type;
+ pcireg_t type;
int bar;
sc->sc_bar_mappings[i].mapped = 0;
diff --git a/sys/dev/cardbus/uhci_cardbus.c b/sys/dev/cardbus/uhci_cardbus.c
index a04f131d14a..57084c5398a 100644
--- a/sys/dev/cardbus/uhci_cardbus.c
+++ b/sys/dev/cardbus/uhci_cardbus.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uhci_cardbus.c,v 1.8 2009/08/20 18:47:03 martynas Exp $ */
+/* $OpenBSD: uhci_cardbus.c,v 1.9 2010/03/22 22:28:27 jsg Exp $ */
/*
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -55,7 +55,7 @@ int uhci_cardbus_detach(struct device *, int);
struct uhci_cardbus_softc {
uhci_softc_t sc;
- cardbus_chipset_tag_t sc_cc;
+ pci_chipset_tag_t sc_cc;
cardbus_function_tag_t sc_cf;
cardbus_devfunc_t sc_ct;
void *sc_ih; /* interrupt vectoring */
@@ -66,7 +66,6 @@ struct cfattach uhci_cardbus_ca = {
uhci_cardbus_attach, uhci_cardbus_detach, uhci_activate
};
-#define CARDBUS_INTERFACE_UHCI PCI_INTERFACE_UHCI
#define cardbus_findvendor pci_findvendor
int
@@ -74,9 +73,9 @@ uhci_cardbus_match(struct device *parent, void *match, void *aux)
{
struct cardbus_attach_args *ca = (struct cardbus_attach_args *)aux;
- if (CARDBUS_CLASS(ca->ca_class) == CARDBUS_CLASS_SERIALBUS &&
- CARDBUS_SUBCLASS(ca->ca_class) == CARDBUS_SUBCLASS_SERIALBUS_USB &&
- CARDBUS_INTERFACE(ca->ca_class) == CARDBUS_INTERFACE_UHCI)
+ if (PCI_CLASS(ca->ca_class) == PCI_CLASS_SERIALBUS &&
+ PCI_SUBCLASS(ca->ca_class) == PCI_SUBCLASS_SERIALBUS_USB &&
+ PCI_INTERFACE(ca->ca_class) == PCI_INTERFACE_UHCI)
return (1);
return (0);
@@ -88,15 +87,15 @@ uhci_cardbus_attach(struct device *parent, struct device *self, void *aux)
struct uhci_cardbus_softc *sc = (struct uhci_cardbus_softc *)self;
struct cardbus_attach_args *ca = aux;
cardbus_devfunc_t ct = ca->ca_ct;
- cardbus_chipset_tag_t cc = ct->ct_cc;
+ pci_chipset_tag_t cc = ct->ct_cc;
cardbus_function_tag_t cf = ct->ct_cf;
- cardbusreg_t csr;
+ pcireg_t csr;
usbd_status r;
const char *vendor;
const char *devname = sc->sc.sc_bus.bdev.dv_xname;
/* Map I/O registers */
- if (Cardbus_mapreg_map(ct, PCI_CBIO, CARDBUS_MAPREG_TYPE_IO, 0,
+ if (Cardbus_mapreg_map(ct, PCI_CBIO, PCI_MAPREG_TYPE_IO, 0,
&sc->sc.iot, &sc->sc.ioh, NULL, &sc->sc.sc_size)) {
printf(": can't map io space\n");
return;
@@ -115,10 +114,10 @@ uhci_cardbus_attach(struct device *parent, struct device *self, void *aux)
/* Enable the device. */
csr = cardbus_conf_read(cc, cf, ca->ca_tag,
- CARDBUS_COMMAND_STATUS_REG);
- cardbus_conf_write(cc, cf, ca->ca_tag, CARDBUS_COMMAND_STATUS_REG,
- csr | CARDBUS_COMMAND_MASTER_ENABLE
- | CARDBUS_COMMAND_IO_ENABLE);
+ PCI_COMMAND_STATUS_REG);
+ cardbus_conf_write(cc, cf, ca->ca_tag, PCI_COMMAND_STATUS_REG,
+ csr | PCI_COMMAND_MASTER_ENABLE
+ | PCI_COMMAND_IO_ENABLE);
sc->sc_ih = cardbus_intr_establish(cc, cf, ca->ca_intrline,
IPL_USB, uhci_intr, sc, devname);
@@ -155,12 +154,12 @@ uhci_cardbus_attach(struct device *parent, struct device *self, void *aux)
/* Figure out vendor for root hub descriptor. */
vendor = cardbus_findvendor(ca->ca_id);
- sc->sc.sc_id_vendor = CARDBUS_VENDOR(ca->ca_id);
+ sc->sc.sc_id_vendor = PCI_VENDOR(ca->ca_id);
if (vendor)
strlcpy(sc->sc.sc_vendor, vendor, sizeof (sc->sc.sc_vendor));
else
snprintf(sc->sc.sc_vendor, sizeof(sc->sc.sc_vendor),
- "vendor 0x%04x", CARDBUS_VENDOR(ca->ca_id));
+ "vendor 0x%04x", PCI_VENDOR(ca->ca_id));
r = uhci_init(&sc->sc);
if (r != USBD_NORMAL_COMPLETION) {
diff --git a/sys/dev/pci/pccbb.c b/sys/dev/pci/pccbb.c
index 5c765fcf0ab..6e06d9ababf 100644
--- a/sys/dev/pci/pccbb.c
+++ b/sys/dev/pci/pccbb.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pccbb.c,v 1.70 2010/01/13 09:10:33 jsg Exp $ */
+/* $OpenBSD: pccbb.c,v 1.71 2010/03/22 22:28:27 jsg Exp $ */
/* $NetBSD: pccbb.c,v 1.96 2004/03/28 09:49:31 nakayama Exp $ */
/*
@@ -109,22 +109,22 @@ void pccbb_pcmcia_detach_card(struct pcic_handle *, int);
void pccbb_pcmcia_deactivate_card(struct pcic_handle *);
#endif
-int pccbb_ctrl(cardbus_chipset_tag_t, int);
-int pccbb_power(cardbus_chipset_tag_t, int);
+int pccbb_ctrl(pci_chipset_tag_t, int);
+int pccbb_power(pci_chipset_tag_t, int);
int pccbb_cardenable(struct pccbb_softc * sc, int function);
void *pccbb_intr_establish(struct pccbb_softc *, int irq, int level,
int (*ih) (void *), void *sc, const char *);
void pccbb_intr_disestablish(struct pccbb_softc *, void *ih);
-void *pccbb_cb_intr_establish(cardbus_chipset_tag_t, int irq, int level,
+void *pccbb_cb_intr_establish(pci_chipset_tag_t, int irq, int level,
int (*ih) (void *), void *sc, const char *);
-void pccbb_cb_intr_disestablish(cardbus_chipset_tag_t ct, void *ih);
+void pccbb_cb_intr_disestablish(pci_chipset_tag_t ct, void *ih);
-cardbustag_t pccbb_make_tag(cardbus_chipset_tag_t, int, int, int);
-void pccbb_free_tag(cardbus_chipset_tag_t, cardbustag_t);
-cardbusreg_t pccbb_conf_read(cardbus_chipset_tag_t, cardbustag_t, int);
-void pccbb_conf_write(cardbus_chipset_tag_t, cardbustag_t, int,
- cardbusreg_t);
+pcitag_t pccbb_make_tag(pci_chipset_tag_t, int, int, int);
+void pccbb_free_tag(pci_chipset_tag_t, pcitag_t);
+pcireg_t pccbb_conf_read(pci_chipset_tag_t, pcitag_t, int);
+void pccbb_conf_write(pci_chipset_tag_t, pcitag_t, int,
+ pcireg_t);
void pccbb_chipinit(struct pccbb_softc *);
int pccbb_pcmcia_mem_alloc(pcmcia_chipset_handle_t, bus_size_t,
@@ -155,10 +155,10 @@ void pccbb_pcmcia_do_mem_map(struct pcic_handle *, int);
void pccbb_powerhook(int, void *);
/* bus-space allocation and deallocation functions */
-int pccbb_rbus_cb_space_alloc(cardbus_chipset_tag_t, rbus_tag_t,
+int pccbb_rbus_cb_space_alloc(pci_chipset_tag_t, rbus_tag_t,
bus_addr_t addr, bus_size_t size, bus_addr_t mask, bus_size_t align,
int flags, bus_addr_t * addrp, bus_space_handle_t * bshp);
-int pccbb_rbus_cb_space_free(cardbus_chipset_tag_t, rbus_tag_t,
+int pccbb_rbus_cb_space_free(pci_chipset_tag_t, rbus_tag_t,
bus_space_handle_t, bus_size_t);
int pccbb_open_win(struct pccbb_softc *, bus_space_tag_t,
@@ -359,7 +359,7 @@ pccbb_shutdown(void *arg)
DPRINTF(("%s: shutdown\n", sc->sc_dev.dv_xname));
/* turn off power */
- pccbb_power((cardbus_chipset_tag_t)sc, CARDBUS_VCC_0V | CARDBUS_VPP_0V);
+ pccbb_power((pci_chipset_tag_t)sc, CARDBUS_VCC_0V | CARDBUS_VPP_0V);
bus_space_write_4(sc->sc_base_memt, sc->sc_base_memh, CB_SOCKET_MASK,
0);
@@ -784,7 +784,7 @@ pccbb_chipinit(struct pccbb_softc *sc)
0x800 + PCIC_INTR) & ~PCIC_INTR_RESET);
/* turn off power */
- pccbb_power((cardbus_chipset_tag_t)sc, CARDBUS_VCC_0V | CARDBUS_VPP_0V);
+ pccbb_power((pci_chipset_tag_t)sc, CARDBUS_VCC_0V | CARDBUS_VPP_0V);
}
@@ -1070,10 +1070,10 @@ pccbb_pcmcia_write(struct pcic_handle *ph, int reg, int val)
}
/*
- * int pccbb_ctrl(cardbus_chipset_tag_t, int)
+ * int pccbb_ctrl(pci_chipset_tag_t, int)
*/
int
-pccbb_ctrl(cardbus_chipset_tag_t ct, int command)
+pccbb_ctrl(pci_chipset_tag_t ct, int command)
{
struct pccbb_softc *sc = (struct pccbb_softc *)ct;
@@ -1116,12 +1116,12 @@ pccbb_ctrl(cardbus_chipset_tag_t ct, int command)
}
/*
- * int pccbb_power(cardbus_chipset_tag_t, int)
+ * int pccbb_power(pci_chipset_tag_t, int)
* This function returns true when it succeeds and returns false when
* it fails.
*/
int
-pccbb_power(cardbus_chipset_tag_t ct, int command)
+pccbb_power(pci_chipset_tag_t ct, int command)
{
struct pccbb_softc *sc = (struct pccbb_softc *)ct;
@@ -1454,7 +1454,7 @@ pccbb_cardenable(struct pccbb_softc *sc, int function)
}
/*
- * void *pccbb_cb_intr_establish(cardbus_chipset_tag_t ct,
+ * void *pccbb_cb_intr_establish(pci_chipset_tag_t ct,
* int irq,
* int level,
* int (* func)(void *),
@@ -1468,7 +1468,7 @@ pccbb_cardenable(struct pccbb_softc *sc, int function)
* The arguments irq is not used because pccbb selects intr vector.
*/
void *
-pccbb_cb_intr_establish(cardbus_chipset_tag_t ct, int irq, int level,
+pccbb_cb_intr_establish(pci_chipset_tag_t ct, int irq, int level,
int (*func)(void *), void *arg, const char *name)
{
struct pccbb_softc *sc = (struct pccbb_softc *)ct;
@@ -1478,13 +1478,13 @@ pccbb_cb_intr_establish(cardbus_chipset_tag_t ct, int irq, int level,
/*
- * void *pccbb_cb_intr_disestablish(cardbus_chipset_tag_t ct,
+ * void *pccbb_cb_intr_disestablish(pci_chipset_tag_t ct,
* void *ih)
*
* This function removes an interrupt handler pointed by ih.
*/
void
-pccbb_cb_intr_disestablish(cardbus_chipset_tag_t ct, void *ih)
+pccbb_cb_intr_disestablish(pci_chipset_tag_t ct, void *ih)
{
struct pccbb_softc *sc = (struct pccbb_softc *)ct;
@@ -1648,13 +1648,13 @@ cb_show_regs(pci_chipset_tag_t pc, pcitag_t tag, bus_space_tag_t memt,
#endif
/*
- * cardbustag_t pccbb_make_tag(cardbus_chipset_tag_t cc,
+ * pcitag_t pccbb_make_tag(pci_chipset_tag_t cc,
* int busno, int devno, 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.
*/
-cardbustag_t
-pccbb_make_tag(cardbus_chipset_tag_t cc, int busno, int devno, int function)
+pcitag_t
+pccbb_make_tag(pci_chipset_tag_t cc, int busno, int devno, int function)
{
struct pccbb_softc *sc = (struct pccbb_softc *)cc;
@@ -1662,18 +1662,18 @@ pccbb_make_tag(cardbus_chipset_tag_t cc, int busno, int devno, int function)
}
void
-pccbb_free_tag(cardbus_chipset_tag_t cc, cardbustag_t tag)
+pccbb_free_tag(pci_chipset_tag_t cc, pcitag_t tag)
{
}
/*
- * cardbusreg_t pccbb_conf_read(cardbus_chipset_tag_t cc,
- * cardbustag_t tag, int offset)
+ * pcireg_t pccbb_conf_read(pci_chipset_tag_t cc,
+ * pcitag_t tag, int offset)
* This is the function to read the config space of a CardBus Card.
* It works same as pci_conf_read.
*/
-cardbusreg_t
-pccbb_conf_read(cardbus_chipset_tag_t cc, cardbustag_t tag, int offset)
+pcireg_t
+pccbb_conf_read(pci_chipset_tag_t cc, pcitag_t tag, int offset)
{
struct pccbb_softc *sc = (struct pccbb_softc *)cc;
@@ -1681,14 +1681,14 @@ pccbb_conf_read(cardbus_chipset_tag_t cc, cardbustag_t tag, int offset)
}
/*
- * void pccbb_conf_write(cardbus_chipset_tag_t cc, cardbustag_t tag,
- * int offs, cardbusreg_t val)
+ * void pccbb_conf_write(pci_chipset_tag_t cc, pcitag_t tag,
+ * int offs, pcireg_t val)
* This is the function to write the config space of a CardBus Card.
* It works same as pci_conf_write.
*/
void
-pccbb_conf_write(cardbus_chipset_tag_t cc, cardbustag_t tag, int reg,
- cardbusreg_t val)
+pccbb_conf_write(pci_chipset_tag_t cc, pcitag_t tag, int reg,
+ pcireg_t val)
{
struct pccbb_softc *sc = (struct pccbb_softc *)cc;
@@ -2577,7 +2577,7 @@ pccbb_pcmcia_intr_string(pcmcia_chipset_handle_t pch, void *ih)
/*
* int
- * pccbb_rbus_cb_space_alloc(cardbus_chipset_tag_t ct, rbus_tag_t rb,
+ * pccbb_rbus_cb_space_alloc(pci_chipset_tag_t ct, rbus_tag_t rb,
* bus_addr_t addr, bus_size_t size,
* bus_addr_t mask, bus_size_t align,
* int flags, bus_addr_t *addrp;
@@ -2587,7 +2587,7 @@ pccbb_pcmcia_intr_string(pcmcia_chipset_handle_t pch, void *ih)
* clients. This function is called from CardBus card drivers.
*/
int
-pccbb_rbus_cb_space_alloc(cardbus_chipset_tag_t ct, rbus_tag_t rb,
+pccbb_rbus_cb_space_alloc(pci_chipset_tag_t ct, rbus_tag_t rb,
bus_addr_t addr, bus_size_t size, bus_addr_t mask, bus_size_t align,
int flags, bus_addr_t *addrp, bus_space_handle_t *bshp)
{
@@ -2624,13 +2624,13 @@ pccbb_rbus_cb_space_alloc(cardbus_chipset_tag_t ct, rbus_tag_t rb,
/*
* int
- * pccbb_rbus_cb_space_free(cardbus_chipset_tag_t *ct, rbus_tag_t rb,
+ * pccbb_rbus_cb_space_free(pci_chipset_tag_t *ct, rbus_tag_t rb,
* bus_space_handle_t *bshp, bus_size_t size);
*
* This function is called from CardBus card drivers.
*/
int
-pccbb_rbus_cb_space_free(cardbus_chipset_tag_t ct, rbus_tag_t rb,
+pccbb_rbus_cb_space_free(pci_chipset_tag_t ct, rbus_tag_t rb,
bus_space_handle_t bsh, bus_size_t size)
{
struct pccbb_softc *sc = (struct pccbb_softc *)ct;
@@ -2760,8 +2760,8 @@ pccbb_winset(bus_addr_t align, struct pccbb_softc *sc, bus_space_tag_t bst)
pcitag_t tag;
bus_addr_t mask = ~(align - 1);
struct {
- cardbusreg_t win_start;
- cardbusreg_t win_limit;
+ pcireg_t win_start;
+ pcireg_t win_limit;
int win_flags;
} win[2];
struct pccbb_win_chain *chainp;