Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/pci adapt to const/volatile changes.



details:   https://anonhg.NetBSD.org/src/rev/b09e416e44fb
branches:  trunk
changeset: 582143:b09e416e44fb
user:      chs <chs%NetBSD.org@localhost>
date:      Sat Jun 18 16:10:44 2005 +0000

description:
adapt to const/volatile changes.

diffstat:

 sys/dev/pci/if_txp.c |  35 ++++++++++++++++++-----------------
 1 files changed, 18 insertions(+), 17 deletions(-)

diffs (130 lines):

diff -r b43a9fb2dfe3 -r b09e416e44fb sys/dev/pci/if_txp.c
--- a/sys/dev/pci/if_txp.c      Sat Jun 18 14:34:55 2005 +0000
+++ b/sys/dev/pci/if_txp.c      Sat Jun 18 16:10:44 2005 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_txp.c,v 1.11 2005/05/02 15:34:32 yamt Exp $ */
+/* $NetBSD: if_txp.c,v 1.12 2005/06/18 16:10:44 chs Exp $ */
 
 /*
  * Copyright (c) 2001
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_txp.c,v 1.11 2005/05/02 15:34:32 yamt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_txp.c,v 1.12 2005/06/18 16:10:44 chs Exp $");
 
 #include "bpfilter.h"
 #include "opt_inet.h"
@@ -103,7 +103,7 @@
 int txp_download_fw(struct txp_softc *);
 int txp_download_fw_wait(struct txp_softc *);
 int txp_download_fw_section(struct txp_softc *,
-    struct txp_fw_section_header *, int);
+    const struct txp_fw_section_header *, int);
 int txp_alloc_rings(struct txp_softc *);
 void txp_dma_free(struct txp_softc *, struct txp_dma_alloc *);
 int txp_dma_malloc(struct txp_softc *, bus_size_t, struct txp_dma_alloc *, int);
@@ -432,8 +432,8 @@
 txp_download_fw(sc)
        struct txp_softc *sc;
 {
-       struct txp_fw_file_header *fileheader;
-       struct txp_fw_section_header *secthead;
+       const struct txp_fw_file_header *fileheader;
+       const struct txp_fw_section_header *secthead;
        int sect;
        u_int32_t r, i, ier, imr;
 
@@ -457,7 +457,7 @@
        /* Ack the status */
        WRITE_REG(sc, TXP_ISR, TXP_INT_A2H_0);
 
-       fileheader = (struct txp_fw_file_header *)tc990image;
+       fileheader = (const struct txp_fw_file_header *)tc990image;
        if (bcmp("TYPHOON", fileheader->magicid, sizeof(fileheader->magicid))) {
                printf(": fw invalid magic\n");
                return (-1);
@@ -472,14 +472,15 @@
                return (-1);
        }
 
-       secthead = (struct txp_fw_section_header *)(((u_int8_t *)tc990image) +
-           sizeof(struct txp_fw_file_header));
+       secthead = (const struct txp_fw_section_header *)
+               (((const u_int8_t *)tc990image) +
+                sizeof(struct txp_fw_file_header));
 
        for (sect = 0; sect < le32toh(fileheader->nsections); sect++) {
                if (txp_download_fw_section(sc, secthead, sect))
                        return (-1);
-               secthead = (struct txp_fw_section_header *)
-                   (((u_int8_t *)secthead) + le32toh(secthead->nbytes) +
+               secthead = (const struct txp_fw_section_header *)
+                   (((const u_int8_t *)secthead) + le32toh(secthead->nbytes) +
                        sizeof(*secthead));
        }
 
@@ -533,7 +534,7 @@
 int
 txp_download_fw_section(sc, sect, sectnum)
        struct txp_softc *sc;
-       struct txp_fw_section_header *sect;
+       const struct txp_fw_section_header *sect;
        int sectnum;
 {
        struct txp_dma_alloc dma;
@@ -546,7 +547,7 @@
                return (0);
 
        /* Make sure we aren't past the end of the image */
-       rseg = ((u_int8_t *)sect) - ((u_int8_t *)tc990image);
+       rseg = ((const u_int8_t *)sect) - ((const u_int8_t *)tc990image);
        if (rseg >= sizeof(tc990image)) {
                printf(": fw invalid section address, section %d\n", sectnum);
                return (-1);
@@ -565,7 +566,7 @@
                return (-1);
        }
 
-       bcopy(((u_int8_t *)sect) + sizeof(*sect), dma.dma_vaddr,
+       bcopy(((const u_int8_t *)sect) + sizeof(*sect), dma.dma_vaddr,
            le32toh(sect->nbytes));
 
        /*
@@ -696,7 +697,7 @@
                }
 
                /* retrieve stashed pointer */
-               bcopy((u_long *)&rxd->rx_vaddrlo, &sd, sizeof(sd));
+               bcopy(__UNVOLATILE(&rxd->rx_vaddrlo), &sd, sizeof(sd));
 
                bus_dmamap_sync(sc->sc_dmat, sd->sd_map, 0,
                    sd->sd_map->dm_mapsize, BUS_DMASYNC_POSTREAD);
@@ -837,7 +838,7 @@
                    sizeof(struct txp_rxbuf_desc), BUS_DMASYNC_POSTWRITE);
 
                /* stash away pointer */
-               bcopy(&sd, (u_long *)&rbd->rb_vaddrlo, sizeof(sd));
+               bcopy(&sd, __UNVOLATILE(&rbd->rb_vaddrlo), sizeof(sd));
 
                rbd->rb_paddrlo = ((u_int64_t)sd->sd_map->dm_segs[0].ds_addr)
                    & 0xffffffff;
@@ -1118,7 +1119,7 @@
                    sd->sd_map->dm_mapsize, BUS_DMASYNC_PREREAD);
 
                /* stash away pointer */
-               bcopy(&sd, (u_long *)&sc->sc_rxbufs[i].rb_vaddrlo, sizeof(sd));
+               bcopy(&sd, __UNVOLATILE(&sc->sc_rxbufs[i].rb_vaddrlo), sizeof(sd));
 
                sc->sc_rxbufs[i].rb_paddrlo =
                    ((u_int64_t)sd->sd_map->dm_segs[0].ds_addr) & 0xffffffff;
@@ -1467,7 +1468,7 @@
                if (++cnt >= (TX_ENTRIES - 4))
                        goto oactive;
 
-               if ((mtag = VLAN_OUTPUT_TAG(sc->sc_ethercom, m)))
+               if ((mtag = VLAN_OUTPUT_TAG(&sc->sc_arpcom, m)))
                        txd->tx_pflags = TX_PFLAGS_VLAN |
                          (htons(VLAN_TAG_VALUE(mtag)) << TX_PFLAGS_VLANTAG_S);
 



Home | Main Index | Thread Index | Old Index