summaryrefslogtreecommitdiffstats
path: root/sys/dev/fxp
diff options
context:
space:
mode:
authormarius <marius@FreeBSD.org>2010-11-23 21:09:42 +0000
committermarius <marius@FreeBSD.org>2010-11-23 21:09:42 +0000
commit7a1d0959ae6435b4a3b4a9a5908a794544b90765 (patch)
treef32117fcfdf91cc1bac5d8c8915360eb535156f7 /sys/dev/fxp
parent92ac246b47398d12db51baf227b3d7368011d705 (diff)
downloadFreeBSD-src-7a1d0959ae6435b4a3b4a9a5908a794544b90765.zip
FreeBSD-src-7a1d0959ae6435b4a3b4a9a5908a794544b90765.tar.gz
- Sprinkle const on tables.
- Remove an alpha remnant. - Minor comment and style fixes.
Diffstat (limited to 'sys/dev/fxp')
-rw-r--r--sys/dev/fxp/if_fxp.c36
-rw-r--r--sys/dev/fxp/if_fxpvar.h4
2 files changed, 14 insertions, 26 deletions
diff --git a/sys/dev/fxp/if_fxp.c b/sys/dev/fxp/if_fxp.c
index 5710ca7..2d522c3 100644
--- a/sys/dev/fxp/if_fxp.c
+++ b/sys/dev/fxp/if_fxp.c
@@ -107,11 +107,11 @@ static int tx_threshold = 64;
/*
* The configuration byte map has several undefined fields which
* must be one or must be zero. Set up a template for these bits.
- * The actual configuration is performed in fxp_init.
+ * The actual configuration is performed in fxp_init_body.
*
* See struct fxp_cb_config for the bit definitions.
*/
-static u_char fxp_cb_config_template[] = {
+static const u_char const fxp_cb_config_template[] = {
0x0, 0x0, /* cb_status */
0x0, 0x0, /* cb_command */
0x0, 0x0, 0x0, 0x0, /* link_addr */
@@ -155,7 +155,7 @@ static u_char fxp_cb_config_template[] = {
* particular variants, but we don't currently differentiate between
* them.
*/
-static struct fxp_ident fxp_ident_table[] = {
+static const struct fxp_ident const fxp_ident_table[] = {
{ 0x1029, -1, 0, "Intel 82559 PCI/CardBus Pro/100" },
{ 0x1030, -1, 0, "Intel 82559 Pro/100 Ethernet" },
{ 0x1031, -1, 3, "Intel 82801CAM (ICH3) Pro/100 VE Ethernet" },
@@ -217,7 +217,7 @@ static int fxp_shutdown(device_t dev);
static int fxp_suspend(device_t dev);
static int fxp_resume(device_t dev);
-static struct fxp_ident *fxp_find_ident(device_t dev);
+static const struct fxp_ident *fxp_find_ident(device_t dev);
static void fxp_intr(void *xsc);
static void fxp_rxcsum(struct fxp_softc *sc, struct ifnet *ifp,
struct mbuf *m, uint16_t status, int pos);
@@ -366,12 +366,12 @@ fxp_dma_wait(struct fxp_softc *sc, volatile uint16_t *status,
device_printf(sc->dev, "DMA timeout\n");
}
-static struct fxp_ident *
+static const struct fxp_ident *
fxp_find_ident(device_t dev)
{
uint16_t devid;
uint8_t revid;
- struct fxp_ident *ident;
+ const struct fxp_ident *ident;
if (pci_get_vendor(dev) == FXP_VENDORID_INTEL) {
devid = pci_get_device(dev);
@@ -392,7 +392,7 @@ fxp_find_ident(device_t dev)
static int
fxp_probe(device_t dev)
{
- struct fxp_ident *ident;
+ const struct fxp_ident *ident;
ident = fxp_find_ident(dev);
if (ident != NULL) {
@@ -1614,21 +1614,7 @@ fxp_encap(struct fxp_softc *sc, struct mbuf **m_head)
/*
* Advance the end of list forward.
*/
-
-#ifdef __alpha__
- /*
- * On platforms which can't access memory in 16-bit
- * granularities, we must prevent the card from DMA'ing
- * up the status while we update the command field.
- * This could cause us to overwrite the completion status.
- * XXX This is probably bogus and we're _not_ looking
- * for atomicity here.
- */
- atomic_clear_16(&sc->fxp_desc.tx_last->tx_cb->cb_command,
- htole16(FXP_CB_COMMAND_S));
-#else
sc->fxp_desc.tx_last->tx_cb->cb_command &= htole16(~FXP_CB_COMMAND_S);
-#endif /*__alpha__*/
sc->fxp_desc.tx_last = txp;
/*
@@ -2985,13 +2971,13 @@ static uint32_t fxp_ucode_d102e[] = D102_E_RCVBUNDLE_UCODE;
#define UCODE(x) x, sizeof(x)/sizeof(uint32_t)
-struct ucode {
+static const struct ucode {
uint32_t revision;
uint32_t *ucode;
int length;
u_short int_delay_offset;
u_short bundle_max_offset;
-} ucode_table[] = {
+} const ucode_table[] = {
{ FXP_REV_82558_A4, UCODE(fxp_ucode_d101a), D101_CPUSAVER_DWORD, 0 },
{ FXP_REV_82558_B0, UCODE(fxp_ucode_d101b0), D101_CPUSAVER_DWORD, 0 },
{ FXP_REV_82559_A0, UCODE(fxp_ucode_d101ma),
@@ -3010,7 +2996,7 @@ struct ucode {
static void
fxp_load_ucode(struct fxp_softc *sc)
{
- struct ucode *uc;
+ const struct ucode *uc;
struct fxp_cb_ucode *cbp;
int i;
@@ -3177,11 +3163,13 @@ sysctl_int_range(SYSCTL_HANDLER_ARGS, int low, int high)
static int
sysctl_hw_fxp_int_delay(SYSCTL_HANDLER_ARGS)
{
+
return (sysctl_int_range(oidp, arg1, arg2, req, 300, 3000));
}
static int
sysctl_hw_fxp_bundle_max(SYSCTL_HANDLER_ARGS)
{
+
return (sysctl_int_range(oidp, arg1, arg2, req, 1, 0xffff));
}
diff --git a/sys/dev/fxp/if_fxpvar.h b/sys/dev/fxp/if_fxpvar.h
index de44636..ca7f7f5 100644
--- a/sys/dev/fxp/if_fxpvar.h
+++ b/sys/dev/fxp/if_fxpvar.h
@@ -146,7 +146,7 @@ struct fxp_ident {
uint16_t devid;
int16_t revid; /* -1 matches anything */
uint8_t ich;
- char *name;
+ const char *name;
};
struct fxp_hwstats {
@@ -182,7 +182,7 @@ struct fxp_softc {
struct resource *fxp_res[2]; /* I/O and IRQ resources */
struct resource_spec *fxp_spec; /* the resource spec we used */
void *ih; /* interrupt handler cookie */
- struct fxp_ident *ident;
+ const struct fxp_ident *ident;
struct mtx sc_mtx;
bus_dma_tag_t fxp_txmtag; /* bus DMA tag for Tx mbufs */
bus_dma_tag_t fxp_rxmtag; /* bus DMA tag for Rx mbufs */
OpenPOWER on IntegriCloud