Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/pci No functional change:



details:   https://anonhg.NetBSD.org/src/rev/e9ce59216f91
branches:  trunk
changeset: 744934:e9ce59216f91
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Tue Feb 18 04:12:40 2020 +0000

description:
No functional change:

 - u_int*_t -> uint*_t
 - whitespace fixes.
 - KNF.

diffstat:

 sys/dev/pci/hifn7751.c |  121 +++++++++++++++++++++++-------------------------
 1 files changed, 59 insertions(+), 62 deletions(-)

diffs (truncated from 427 to 300 lines):

diff -r 02300e57784c -r e9ce59216f91 sys/dev/pci/hifn7751.c
--- a/sys/dev/pci/hifn7751.c    Tue Feb 18 04:09:31 2020 +0000
+++ b/sys/dev/pci/hifn7751.c    Tue Feb 18 04:12:40 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: hifn7751.c,v 1.63 2018/12/27 14:03:54 maxv Exp $       */
+/*     $NetBSD: hifn7751.c,v 1.64 2020/02/18 04:12:40 msaitoh Exp $    */
 /*     $FreeBSD: hifn7751.c,v 1.5.2.7 2003/10/08 23:52:00 sam Exp $ */
 /*     $OpenBSD: hifn7751.c,v 1.140 2003/08/01 17:55:54 deraadt Exp $  */
 
@@ -48,7 +48,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: hifn7751.c,v 1.63 2018/12/27 14:03:54 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hifn7751.c,v 1.64 2020/02/18 04:12:40 msaitoh Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -131,17 +131,17 @@
 static int     hifn_ramtype(struct hifn_softc *);
 static void    hifn_sessions(struct hifn_softc *);
 static int     hifn_intr(void *);
-static u_int   hifn_write_command(struct hifn_command *, u_int8_t *);
-static u_int32_t hifn_next_signature(u_int32_t a, u_int cnt);
-static int     hifn_newsession(void*, u_int32_t *, struct cryptoini *);
-static int     hifn_freesession(void*, u_int64_t);
+static u_int   hifn_write_command(struct hifn_command *, uint8_t *);
+static uint32_t hifn_next_signature(uint32_t a, u_int cnt);
+static int     hifn_newsession(void*, uint32_t *, struct cryptoini *);
+static int     hifn_freesession(void*, uint64_t);
 static int     hifn_process(void*, struct cryptop *, int);
 static void    hifn_callback(struct hifn_softc *, struct hifn_command *,
-                             u_int8_t *);
+                             uint8_t *);
 static int     hifn_crypto(struct hifn_softc *, struct hifn_command *,
                            struct cryptop*, int);
-static int     hifn_readramaddr(struct hifn_softc *, int, u_int8_t *);
-static int     hifn_writeramaddr(struct hifn_softc *, int, u_int8_t *);
+static int     hifn_readramaddr(struct hifn_softc *, int, uint8_t *);
+static int     hifn_writeramaddr(struct hifn_softc *, int, uint8_t *);
 static int     hifn_dmamap_aligned(bus_dmamap_t);
 static int     hifn_dmamap_load_src(struct hifn_softc *,
                                     struct hifn_command *);
@@ -154,15 +154,15 @@
 static void    hifn_abort(struct hifn_softc *);
 static void    hifn_alloc_slot(struct hifn_softc *, int *, int *, int *,
                                int *);
-static void    hifn_write_4(struct hifn_softc *, int, bus_size_t, u_int32_t);
-static u_int32_t hifn_read_4(struct hifn_softc *, int, bus_size_t);
+static void    hifn_write_4(struct hifn_softc *, int, bus_size_t, uint32_t);
+static uint32_t hifn_read_4(struct hifn_softc *, int, bus_size_t);
 #ifdef HAVE_CRYPTO_LZS
 static int     hifn_compression(struct hifn_softc *, struct cryptop *,
                                 struct hifn_command *);
 static struct mbuf *hifn_mkmbuf_chain(int, struct mbuf *);
 static int     hifn_compress_enter(struct hifn_softc *, struct hifn_command *);
 static void    hifn_callback_comp(struct hifn_softc *, struct hifn_command *,
-                                  u_int8_t *);
+                                  uint8_t *);
 #endif /* HAVE_CRYPTO_LZS */
 
 struct hifn_stats hifnstats;
@@ -255,8 +255,8 @@
 #else
        bus_size_t iosize0, iosize1;
 #endif
-       u_int32_t cmd;
-       u_int16_t ena;
+       uint32_t cmd;
+       uint16_t ena;
        bus_dma_segment_t seg;
        bus_dmamap_t dmamap;
        int rseg;
@@ -305,7 +305,7 @@
            &seg, 1, &rseg, BUS_DMA_NOWAIT)) {
                aprint_error_dev(sc->sc_dv, "can't alloc DMA buffer\n");
                goto fail_io1;
-        }
+       }
        if (bus_dmamem_map(sc->sc_dmat, &seg, rseg, sizeof(*sc->sc_dma), &kva,
            BUS_DMA_NOWAIT)) {
                aprint_error_dev(sc->sc_dv, "can't map DMA buffers (%lu bytes)\n",
@@ -512,7 +512,7 @@
 {
        int error = 0;
 
-       switch(cmd) {
+       switch (cmd) {
        case MODULE_CMD_INIT:
 #ifdef _MODULE
                error = config_init_component(cfdriver_ioconf_hifn,
@@ -546,7 +546,7 @@
 static int
 hifn_init_pubrng(struct hifn_softc *sc)
 {
-       u_int32_t r;
+       uint32_t r;
        int i;
 
        if ((sc->sc_flags & HIFN_IS_7811) == 0) {
@@ -683,7 +683,6 @@
                        add_true_randomness(num[0]);
                        add_true_randomness(num[1]);
 #endif
-                               
                }
        } else {
                int nwords = 0;
@@ -717,9 +716,8 @@
                 * read must require at least one PCI cycle, and
                 * RNG_Clk is at least PCI_Clk, this is safe.
                 */
-               for(i = 0 ; i < nwords * 8; i++)
-               {
-                       volatile u_int32_t regtmp;
+               for (i = 0 ; i < nwords * 8; i++) {
+                       volatile uint32_t regtmp;
                        regtmp = READ_REG_1(sc, HIFN_1_RNG_DATA);
                        num[i / 8] = regtmp;
                }
@@ -782,7 +780,7 @@
 static void
 hifn_set_retry(struct hifn_softc *sc)
 {
-       u_int32_t r;
+       uint32_t r;
 
        r = pci_conf_read(sc->sc_pci_pc, sc->sc_pci_tag, HIFN_TRDY_TIMEOUT);
        r &= 0xffff0000;
@@ -796,7 +794,7 @@
 static void
 hifn_reset_board(struct hifn_softc *sc, int full)
 {
-       u_int32_t reg;
+       uint32_t reg;
 
        /*
         * Set polling in the DMA configuration register to zero.  0x7 avoids
@@ -843,11 +841,11 @@
        }
 }
 
-static u_int32_t
-hifn_next_signature(u_int32_t a, u_int cnt)
+static uint32_t
+hifn_next_signature(uint32_t a, u_int cnt)
 {
        int i;
-       u_int32_t v;
+       uint32_t v;
 
        for (i = 0; i < cnt; i++) {
 
@@ -921,7 +919,7 @@
 static const char *
 hifn_enable_crypto(struct hifn_softc *sc, pcireg_t pciid)
 {
-       u_int32_t dmacfg, ramcfg, encl, addr, i;
+       uint32_t dmacfg, ramcfg, encl, addr, i;
        const char *offtbl = NULL;
 
        for (i = 0; i < sizeof(pci2id)/sizeof(pci2id[0]); i++) {
@@ -1098,7 +1096,7 @@
 static void
 hifn_sessions(struct hifn_softc *sc)
 {
-       u_int32_t pucnfg;
+       uint32_t pucnfg;
        int ctxsize;
 
        pucnfg = READ_REG_0(sc, HIFN_0_PUCNFG);
@@ -1116,8 +1114,7 @@
                else
                        sc->sc_maxses = 1 +
                            ((sc->sc_ramsize - 32768) / ctxsize);
-       }
-       else
+       } else
                sc->sc_maxses = sc->sc_ramsize / 16384;
 
        if (sc->sc_maxses > 2048)
@@ -1131,7 +1128,7 @@
 static int
 hifn_ramtype(struct hifn_softc *sc)
 {
-       u_int8_t data[8], dataexpect[8];
+       uint8_t data[8], dataexpect[8];
        int i;
 
        for (i = 0; i < sizeof(data); i++)
@@ -1166,9 +1163,9 @@
 static int
 hifn_sramsize(struct hifn_softc *sc)
 {
-       u_int32_t a;
-       u_int8_t data[8];
-       u_int8_t dataexpect[sizeof(data)];
+       uint32_t a;
+       uint8_t data[8];
+       uint8_t dataexpect[sizeof(data)];
        int32_t i;
 
        for (i = 0; i < sizeof(data); i++)
@@ -1201,7 +1198,7 @@
 static int
 hifn_dramsize(struct hifn_softc *sc)
 {
-       u_int32_t cnfg;
+       uint32_t cnfg;
 
        if (sc->sc_flags & HIFN_IS_7956) {
                /*
@@ -1264,11 +1261,11 @@
 }
 
 static int
-hifn_writeramaddr(struct hifn_softc *sc, int addr, u_int8_t *data)
+hifn_writeramaddr(struct hifn_softc *sc, int addr, uint8_t *data)
 {
        struct hifn_dma *dma = sc->sc_dma;
        struct hifn_base_command wc;
-       const u_int32_t masks = HIFN_D_VALID | HIFN_D_LAST | HIFN_D_MASKDONEIRQ;
+       const uint32_t masks = HIFN_D_VALID | HIFN_D_LAST | HIFN_D_MASKDONEIRQ;
        int r, cmdi, resi, srci, dsti;
 
        wc.masks = htole16(3 << 13);
@@ -1329,11 +1326,11 @@
 }
 
 static int
-hifn_readramaddr(struct hifn_softc *sc, int addr, u_int8_t *data)
+hifn_readramaddr(struct hifn_softc *sc, int addr, uint8_t *data)
 {
        struct hifn_dma *dma = sc->sc_dma;
        struct hifn_base_command rc;
-       const u_int32_t masks = HIFN_D_VALID | HIFN_D_LAST | HIFN_D_MASKDONEIRQ;
+       const uint32_t masks = HIFN_D_VALID | HIFN_D_LAST | HIFN_D_MASKDONEIRQ;
        int r, cmdi, srci, dsti, resi;
 
        rc.masks = htole16(2 << 13);
@@ -1435,15 +1432,15 @@
  * command buffer size.
  */
 static u_int
-hifn_write_command(struct hifn_command *cmd, u_int8_t *buf)
+hifn_write_command(struct hifn_command *cmd, uint8_t *buf)
 {
-       u_int8_t *buf_pos;
+       uint8_t *buf_pos;
        struct hifn_base_command *base_cmd;
        struct hifn_mac_command *mac_cmd;
        struct hifn_crypt_command *cry_cmd;
        struct hifn_comp_command *comp_cmd;
        int using_mac, using_crypt, using_comp, len, ivlen;
-       u_int32_t dlen, slen;
+       uint32_t dlen, slen;
 
        buf_pos = buf;
        using_mac = cmd->base_masks & HIFN_BASE_CMD_MAC;
@@ -1455,7 +1452,7 @@
        slen = cmd->src_map->dm_mapsize;
        if (cmd->sloplen)
                dlen = cmd->dst_map->dm_mapsize - cmd->sloplen +
-                   sizeof(u_int32_t);
+                   sizeof(uint32_t);
        else
                dlen = cmd->dst_map->dm_mapsize;
        base_cmd->total_source_count = htole16(slen & HIFN_BASE_CMD_LENMASK_LO);
@@ -1584,7 +1581,7 @@
 {
        struct hifn_dma *dma = sc->sc_dma;
        bus_dmamap_t map = cmd->dst_map;
-       u_int32_t p, l;
+       uint32_t p, l;
        int idx, used = 0, i;
 
        idx = dma->dsti;
@@ -1613,7 +1610,7 @@
                p = sc->sc_dmamap->dm_segs[0].ds_addr +
                    offsetof(struct hifn_dma, slop[cmd->slopidx]);
                l = HIFN_D_VALID | HIFN_D_MASKDONEIRQ | HIFN_D_LAST |
-                   sizeof(u_int32_t);
+                   sizeof(uint32_t);
 
                if ((map->dm_segs[i].ds_len - cmd->sloplen) != 0) {
                        dma->dstr[idx].p = htole32(map->dm_segs[i].ds_addr);
@@ -1657,7 +1654,7 @@
        struct hifn_dma *dma = sc->sc_dma;
        bus_dmamap_t map = cmd->src_map;
        int idx, i;
-       u_int32_t last = 0;
+       uint32_t last = 0;
 
        idx = dma->srci;
        for (i = 0; i < map->dm_nsegs; i++) {
@@ -1688,7 +1685,7 @@
     struct cryptop *crp, int hint)
 {
        struct  hifn_dma *dma = sc->sc_dma;
-       u_int32_t cmdlen;



Home | Main Index | Thread Index | Old Index