Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/cardbus Use PCI_ constants and macros instead of CAR...
details: https://anonhg.NetBSD.org/src/rev/9e49fab11e94
branches: trunk
changeset: 752445:9e49fab11e94
user: dyoung <dyoung%NetBSD.org@localhost>
date: Fri Feb 26 00:57:01 2010 +0000
description:
Use PCI_ constants and macros instead of CARDBUS_. Use
Cardbus_conf_{read,write}() instead of cardbus_conf_{read,write}().
Delete all of the CARDBUS_ constants and macros that replicate PCI_.
Compile-tested, only.
diffstat:
sys/dev/cardbus/adv_cardbus.c | 12 +-
sys/dev/cardbus/ahc_cardbus.c | 8 +-
sys/dev/cardbus/cardbus.c | 68 +++++++++++-----------
sys/dev/cardbus/cardbus_map.c | 28 ++++----
sys/dev/cardbus/cardbusreg.h | 115 +-------------------------------------
sys/dev/cardbus/com_cardbus.c | 52 ++++++++--------
sys/dev/cardbus/ehci_cardbus.c | 38 +++++-------
sys/dev/cardbus/fwohci_cardbus.c | 33 ++++------
sys/dev/cardbus/if_ex_cardbus.c | 69 ++++++++++------------
sys/dev/cardbus/if_fxp_cardbus.c | 32 ++++-----
sys/dev/cardbus/if_ral_cardbus.c | 29 +++-----
sys/dev/cardbus/if_re_cardbus.c | 63 +++++++++----------
sys/dev/cardbus/if_rtk_cardbus.c | 63 +++++++++----------
sys/dev/cardbus/if_tlp_cardbus.c | 38 +++++------
sys/dev/cardbus/njata_cardbus.c | 26 ++++----
sys/dev/cardbus/njs_cardbus.c | 26 ++++----
sys/dev/cardbus/ohci_cardbus.c | 39 +++++-------
sys/dev/cardbus/rbus_ppb.c | 36 +++++------
sys/dev/cardbus/siisata_cardbus.c | 38 +++++------
sys/dev/cardbus/uhci_cardbus.c | 40 +++++-------
20 files changed, 346 insertions(+), 507 deletions(-)
diffs (truncated from 2082 to 300 lines):
diff -r 87a103b41bda -r 9e49fab11e94 sys/dev/cardbus/adv_cardbus.c
--- a/sys/dev/cardbus/adv_cardbus.c Fri Feb 26 00:38:14 2010 +0000
+++ b/sys/dev/cardbus/adv_cardbus.c Fri Feb 26 00:57:01 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: adv_cardbus.c,v 1.25 2010/02/26 00:01:27 dyoung Exp $ */
+/* $NetBSD: adv_cardbus.c,v 1.26 2010/02/26 00:57:01 dyoung Exp $ */
/*-
* Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: adv_cardbus.c,v 1.25 2010/02/26 00:01:27 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: adv_cardbus.c,v 1.26 2010/02/26 00:57:01 dyoung Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -61,8 +61,8 @@
#include <dev/ic/advlib.h>
#include <dev/ic/adv.h>
-#define ADV_CARDBUS_IOBA CARDBUS_BASE0_REG
-#define ADV_CARDBUS_MMBA CARDBUS_BASE1_REG
+#define ADV_CARDBUS_IOBA PCI_BAR0
+#define ADV_CARDBUS_MMBA PCI_BAR1
#define ADV_CARDBUS_DEBUG
#define ADV_CARDBUS_ALLOW_MEMIO
@@ -94,8 +94,8 @@
{
struct cardbus_attach_args *ca = aux;
- if (CARDBUS_VENDOR(ca->ca_id) == PCI_VENDOR_ADVSYS &&
- CARDBUS_PRODUCT(ca->ca_id) == PCI_PRODUCT_ADVSYS_ULTRA)
+ if (PCI_VENDOR(ca->ca_id) == PCI_VENDOR_ADVSYS &&
+ PCI_PRODUCT(ca->ca_id) == PCI_PRODUCT_ADVSYS_ULTRA)
return (1);
return (0);
diff -r 87a103b41bda -r 9e49fab11e94 sys/dev/cardbus/ahc_cardbus.c
--- a/sys/dev/cardbus/ahc_cardbus.c Fri Feb 26 00:38:14 2010 +0000
+++ b/sys/dev/cardbus/ahc_cardbus.c Fri Feb 26 00:57:01 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ahc_cardbus.c,v 1.32 2010/02/26 00:01:27 dyoung Exp $ */
+/* $NetBSD: ahc_cardbus.c,v 1.33 2010/02/26 00:57:01 dyoung Exp $ */
/*-
* Copyright (c) 2000, 2005 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ahc_cardbus.c,v 1.32 2010/02/26 00:01:27 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ahc_cardbus.c,v 1.33 2010/02/26 00:57:01 dyoung Exp $");
#include "opt_ahc_cardbus.h"
@@ -96,8 +96,8 @@
{
struct cardbus_attach_args *ca = aux;
- if (CARDBUS_VENDOR(ca->ca_id) == PCI_VENDOR_ADP &&
- CARDBUS_PRODUCT(ca->ca_id) == PCI_PRODUCT_ADP_APA1480)
+ if (PCI_VENDOR(ca->ca_id) == PCI_VENDOR_ADP &&
+ PCI_PRODUCT(ca->ca_id) == PCI_PRODUCT_ADP_APA1480)
return (1);
return (0);
diff -r 87a103b41bda -r 9e49fab11e94 sys/dev/cardbus/cardbus.c
--- a/sys/dev/cardbus/cardbus.c Fri Feb 26 00:38:14 2010 +0000
+++ b/sys/dev/cardbus/cardbus.c Fri Feb 26 00:57:01 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cardbus.c,v 1.104 2010/02/25 21:18:35 dyoung Exp $ */
+/* $NetBSD: cardbus.c,v 1.105 2010/02/26 00:57:01 dyoung Exp $ */
/*
* Copyright (c) 1997, 1998, 1999 and 2000
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cardbus.c,v 1.104 2010/02/25 21:18:35 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cardbus.c,v 1.105 2010/02/26 00:57:01 dyoung Exp $");
#include "opt_cardbus.h"
@@ -213,7 +213,7 @@
*/
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,
+ PCI_MAPREG_TYPE_MEM | PCI_MAPREG_MEM_TYPE_32BIT,
0, &bar_tag, &bar_memh, &bar_addr, &bar_size)) {
aprint_error_dev(sc->sc_dev, "failed to map memory\n");
return (1);
@@ -233,10 +233,10 @@
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(bar_tag, bar_memh, &rom_image))
goto out;
@@ -261,10 +261,10 @@
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(bar_tag, bar_memh,
cis_ptr, tuples,
@@ -272,9 +272,9 @@
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,
@@ -479,9 +479,9 @@
}
}
- 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 -> ", device_xname(sc->sc_dev), bhlc));
- nfunction = CARDBUS_HDRTYPE_MULTIFN(bhlc) ? 8 : 1;
+ nfunction = PCI_HDRTYPE_MULTIFN(bhlc) ? 8 : 1;
for (function = 0; function < nfunction; function++) {
struct cardbus_attach_args ca;
@@ -502,33 +502,33 @@
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_ptr));
+ PCI_VENDOR(id), PCI_PRODUCT(id), cis_ptr));
enable_function(sc, cdstatus, function);
/* clean up every BAR */
- cardbus_conf_write(cc, cf, tag, CARDBUS_BASE0_REG, 0);
- cardbus_conf_write(cc, cf, tag, CARDBUS_BASE1_REG, 0);
- cardbus_conf_write(cc, cf, tag, CARDBUS_BASE2_REG, 0);
- cardbus_conf_write(cc, cf, tag, CARDBUS_BASE3_REG, 0);
- cardbus_conf_write(cc, cf, tag, CARDBUS_BASE4_REG, 0);
- cardbus_conf_write(cc, cf, tag, CARDBUS_BASE5_REG, 0);
+ cardbus_conf_write(cc, cf, tag, PCI_BAR0, 0);
+ cardbus_conf_write(cc, cf, tag, PCI_BAR1, 0);
+ cardbus_conf_write(cc, cf, tag, PCI_BAR2, 0);
+ cardbus_conf_write(cc, cf, tag, PCI_BAR3, 0);
+ cardbus_conf_write(cc, cf, tag, PCI_BAR4, 0);
+ cardbus_conf_write(cc, cf, tag, PCI_BAR5, 0);
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);
- icr = cardbus_conf_read(cc, cf, tag, CARDBUS_INTERRUPT_REG);
+ bhlc = cardbus_conf_read(cc, cf, tag, PCI_BHLC_REG);
+ icr = cardbus_conf_read(cc, cf, tag, PCI_INTERRUPT_REG);
DPRINTF(("%s func%d icr 0x%08x bhlc 0x%08x -> ",
device_xname(sc->sc_dev), function, icr, bhlc));
- bhlc &= ~(CARDBUS_CACHELINE_MASK << CARDBUS_CACHELINE_SHIFT);
- bhlc |= (sc->sc_cacheline & CARDBUS_CACHELINE_MASK) <<
- CARDBUS_CACHELINE_SHIFT;
+ bhlc &= ~(PCI_CACHELINE_MASK << PCI_CACHELINE_SHIFT);
+ bhlc |= (sc->sc_cacheline & PCI_CACHELINE_MASK) <<
+ PCI_CACHELINE_SHIFT;
/*
* Set the initial value of the Latency Timer.
*
@@ -552,8 +552,8 @@
bhlc |= (lattimer << PCI_LATTIMER_SHIFT);
}
- cardbus_conf_write(cc, cf, tag, CARDBUS_BHLC_REG, bhlc);
- bhlc = cardbus_conf_read(cc, cf, tag, CARDBUS_BHLC_REG);
+ 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));
/*
@@ -817,14 +817,14 @@
tag = cardbus_make_tag(cc, cf, sc->sc_bus, func);
- command = cardbus_conf_read(cc, cf, tag, CARDBUS_COMMAND_STATUS_REG);
- command |= (CARDBUS_COMMAND_MEM_ENABLE | CARDBUS_COMMAND_IO_ENABLE |
- 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);
if ((ct = sc->sc_funcs[func]) != NULL)
- Cardbus_conf_write(ct, tag, CARDBUS_BHLC_REG, ct->ct_bhlc);
+ Cardbus_conf_write(ct, tag, PCI_BHLC_REG, ct->ct_bhlc);
DPRINTF(("%x\n", sc->sc_poweron_func));
diff -r 87a103b41bda -r 9e49fab11e94 sys/dev/cardbus/cardbus_map.c
--- a/sys/dev/cardbus/cardbus_map.c Fri Feb 26 00:38:14 2010 +0000
+++ b/sys/dev/cardbus/cardbus_map.c Fri Feb 26 00:57:01 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cardbus_map.c,v 1.33 2010/02/25 00:47:39 dyoung Exp $ */
+/* $NetBSD: cardbus_map.c,v 1.34 2010/02/26 00:57:01 dyoung Exp $ */
/*
* Copyright (c) 1999 and 2000
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cardbus_map.c,v 1.33 2010/02/25 00:47:39 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cardbus_map.c,v 1.34 2010/02/26 00:57:01 dyoung Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -375,12 +375,12 @@
cardbus_chipset_tag_t cc = ct->ct_cc;
cardbus_function_tag_t cf = ct->ct_cf;
- ct->ct_bar[0] = cardbus_conf_read(cc, cf, tag, CARDBUS_BASE0_REG);
- ct->ct_bar[1] = cardbus_conf_read(cc, cf, tag, CARDBUS_BASE1_REG);
- ct->ct_bar[2] = cardbus_conf_read(cc, cf, tag, CARDBUS_BASE2_REG);
- ct->ct_bar[3] = cardbus_conf_read(cc, cf, tag, CARDBUS_BASE3_REG);
- ct->ct_bar[4] = cardbus_conf_read(cc, cf, tag, CARDBUS_BASE4_REG);
- ct->ct_bar[5] = cardbus_conf_read(cc, cf, tag, CARDBUS_BASE5_REG);
+ ct->ct_bar[0] = cardbus_conf_read(cc, cf, tag, PCI_BAR0);
+ ct->ct_bar[1] = cardbus_conf_read(cc, cf, tag, PCI_BAR1);
+ ct->ct_bar[2] = cardbus_conf_read(cc, cf, tag, PCI_BAR2);
+ ct->ct_bar[3] = cardbus_conf_read(cc, cf, tag, PCI_BAR3);
+ ct->ct_bar[4] = cardbus_conf_read(cc, cf, tag, PCI_BAR4);
+ ct->ct_bar[5] = cardbus_conf_read(cc, cf, tag, PCI_BAR5);
DPRINTF(("cardbus_save_bar: %x %x\n", ct->ct_bar[0], ct->ct_bar[1]));
@@ -401,12 +401,12 @@
cardbus_chipset_tag_t cc = ct->ct_cc;
cardbus_function_tag_t cf = ct->ct_cf;
- cardbus_conf_write(cc, cf, tag, CARDBUS_BASE0_REG, ct->ct_bar[0]);
- cardbus_conf_write(cc, cf, tag, CARDBUS_BASE1_REG, ct->ct_bar[1]);
- cardbus_conf_write(cc, cf, tag, CARDBUS_BASE2_REG, ct->ct_bar[2]);
- cardbus_conf_write(cc, cf, tag, CARDBUS_BASE3_REG, ct->ct_bar[3]);
- cardbus_conf_write(cc, cf, tag, CARDBUS_BASE4_REG, ct->ct_bar[4]);
- cardbus_conf_write(cc, cf, tag, CARDBUS_BASE5_REG, ct->ct_bar[5]);
+ cardbus_conf_write(cc, cf, tag, PCI_BAR0, ct->ct_bar[0]);
+ cardbus_conf_write(cc, cf, tag, PCI_BAR1, ct->ct_bar[1]);
+ cardbus_conf_write(cc, cf, tag, PCI_BAR2, ct->ct_bar[2]);
+ cardbus_conf_write(cc, cf, tag, PCI_BAR3, ct->ct_bar[3]);
+ cardbus_conf_write(cc, cf, tag, PCI_BAR4, ct->ct_bar[4]);
+ cardbus_conf_write(cc, cf, tag, PCI_BAR5, ct->ct_bar[5]);
return 0;
}
diff -r 87a103b41bda -r 9e49fab11e94 sys/dev/cardbus/cardbusreg.h
--- a/sys/dev/cardbus/cardbusreg.h Fri Feb 26 00:38:14 2010 +0000
+++ b/sys/dev/cardbus/cardbusreg.h Fri Feb 26 00:57:01 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cardbusreg.h,v 1.5 2010/02/25 21:18:35 dyoung Exp $ */
+/* $NetBSD: cardbusreg.h,v 1.6 2010/02/26 00:57:01 dyoung Exp $ */
/*
* Copyright (c) 2001
@@ -33,113 +33,7 @@
typedef int cardbus_intr_line_t;
-# define CARDBUS_VENDOR_SHIFT 0
-# define CARDBUS_VENDOR_MASK 0xffff
-# define CARDBUS_VENDOR(id) \
- (((id) >> CARDBUS_VENDOR_SHIFT) & CARDBUS_VENDOR_MASK)
Home |
Main Index |
Thread Index |
Old Index