diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2003-08-01 17:55:55 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2003-08-01 17:55:55 +0000 |
commit | fab225332dcc9283b8ff2aa924f48a18d09b2add (patch) | |
tree | 0aa68728c9957e7d056676c6d2109203f9f4aad4 /sys/dev | |
parent | 5522569a643a66b6a27087e728596e4b444d2ac9 (diff) |
ansi
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/pci/hifn7751.c | 129 | ||||
-rw-r--r-- | sys/dev/pci/ubsec.c | 117 |
2 files changed, 76 insertions, 170 deletions
diff --git a/sys/dev/pci/hifn7751.c b/sys/dev/pci/hifn7751.c index aee73ce35e3..3f4fc02cd83 100644 --- a/sys/dev/pci/hifn7751.c +++ b/sys/dev/pci/hifn7751.c @@ -1,4 +1,4 @@ -/* $OpenBSD: hifn7751.c,v 1.139 2003/03/13 20:08:06 jason Exp $ */ +/* $OpenBSD: hifn7751.c,v 1.140 2003/08/01 17:55:54 deraadt Exp $ */ /* * Invertex AEON / Hifn 7751 driver @@ -131,19 +131,14 @@ const struct pci_matchid hifn_devices[] = { }; int -hifn_probe(parent, match, aux) - struct device *parent; - void *match; - void *aux; +hifn_probe(struct device *parent, void *match, void *aux) { return (pci_matchbyid((struct pci_attach_args *)aux, hifn_devices, sizeof(hifn_devices)/sizeof(hifn_devices[0]))); } void -hifn_attach(parent, self, aux) - struct device *parent, *self; - void *aux; +hifn_attach(struct device *parent, struct device *self, void *aux) { struct hifn_softc *sc = (struct hifn_softc *)self; struct pci_attach_args *pa = aux; @@ -347,8 +342,7 @@ fail_io0: } int -hifn_init_pubrng(sc) - struct hifn_softc *sc; +hifn_init_pubrng(struct hifn_softc *sc) { u_int32_t r; int i; @@ -409,8 +403,7 @@ hifn_init_pubrng(sc) } void -hifn_rng(vsc) - void *vsc; +hifn_rng(void *vsc) { struct hifn_softc *sc = vsc; u_int32_t num1, sts, num2; @@ -453,8 +446,7 @@ hifn_rng(vsc) } void -hifn_puc_wait(sc) - struct hifn_softc *sc; +hifn_puc_wait(struct hifn_softc *sc) { int i; @@ -471,8 +463,7 @@ hifn_puc_wait(sc) * Reset the processing unit. */ void -hifn_reset_puc(sc) - struct hifn_softc *sc; +hifn_reset_puc(struct hifn_softc *sc) { /* Reset processing unit */ WRITE_REG_0(sc, HIFN_0_PUCTRL, HIFN_PUCTRL_DMAENA); @@ -480,8 +471,7 @@ hifn_reset_puc(sc) } void -hifn_set_retry(sc) - struct hifn_softc *sc; +hifn_set_retry(struct hifn_softc *sc) { u_int32_t r; @@ -495,9 +485,7 @@ hifn_set_retry(sc) * from the reset (i.e. initial values are assigned elsewhere). */ void -hifn_reset_board(sc, full) - struct hifn_softc *sc; - int full; +hifn_reset_board(struct hifn_softc *sc, int full) { u_int32_t reg; @@ -547,9 +535,7 @@ hifn_reset_board(sc, full) } u_int32_t -hifn_next_signature(a, cnt) - u_int32_t a; - u_int cnt; +hifn_next_signature(u_int32_t a, u_int cnt) { int i; u_int32_t v; @@ -614,9 +600,7 @@ struct pci2id { * as enabling crypto twice will lock the board. */ int -hifn_enable_crypto(sc, pciid) - struct hifn_softc *sc; - pcireg_t pciid; +hifn_enable_crypto(struct hifn_softc *sc, pcireg_t pciid) { u_int32_t dmacfg, ramcfg, encl, addr, i; char *offtbl = NULL; @@ -718,8 +702,7 @@ report: * section of the HIFN Software Development reference manual. */ void -hifn_init_pci_registers(sc) - struct hifn_softc *sc; +hifn_init_pci_registers(struct hifn_softc *sc) { /* write fixed values needed by the Initialization registers */ WRITE_REG_0(sc, HIFN_0_PUCTRL, HIFN_PUCTRL_DMAENA); @@ -787,8 +770,7 @@ hifn_init_pci_registers(sc) * routine is called. */ void -hifn_sessions(sc) - struct hifn_softc *sc; +hifn_sessions(struct hifn_softc *sc) { u_int32_t pucnfg; int ctxsize; @@ -815,8 +797,7 @@ hifn_sessions(sc) * state when this is called. */ int -hifn_ramtype(sc) - struct hifn_softc *sc; +hifn_ramtype(struct hifn_softc *sc) { u_int8_t data[8], dataexpect[8]; int i; @@ -851,8 +832,7 @@ hifn_ramtype(sc) #define HIFN_SRAM_GRANULARITY (HIFN_SRAM_MAX / HIFN_SRAM_STEP_SIZE) int -hifn_sramsize(sc) - struct hifn_softc *sc; +hifn_sramsize(struct hifn_softc *sc) { u_int32_t a; u_int8_t data[8]; @@ -887,8 +867,7 @@ hifn_sramsize(sc) * is already set up correctly. */ int -hifn_dramsize(sc) - struct hifn_softc *sc; +hifn_dramsize(struct hifn_softc *sc) { u_int32_t cnfg; @@ -899,9 +878,8 @@ hifn_dramsize(sc) } void -hifn_alloc_slot(sc, cmdp, srcp, dstp, resp) - struct hifn_softc *sc; - int *cmdp, *srcp, *dstp, *resp; +hifn_alloc_slot(struct hifn_softc *sc, int *cmdp, int *srcp, + int *dstp, int *resp) { struct hifn_dma *dma = sc->sc_dma; @@ -947,10 +925,7 @@ hifn_alloc_slot(sc, cmdp, srcp, dstp, resp) } int -hifn_writeramaddr(sc, addr, data) - struct hifn_softc *sc; - int addr; - u_int8_t *data; +hifn_writeramaddr(struct hifn_softc *sc, int addr, u_int8_t *data) { struct hifn_dma *dma = sc->sc_dma; struct hifn_base_command wc; @@ -1015,10 +990,7 @@ hifn_writeramaddr(sc, addr, data) } int -hifn_readramaddr(sc, addr, data) - struct hifn_softc *sc; - int addr; - u_int8_t *data; +hifn_readramaddr(struct hifn_softc *sc, int addr, u_int8_t *data) { struct hifn_dma *dma = sc->sc_dma; struct hifn_base_command rc; @@ -1086,8 +1058,7 @@ hifn_readramaddr(sc, addr, data) * Initialize the descriptor rings. */ void -hifn_init_dma(sc) - struct hifn_softc *sc; +hifn_init_dma(struct hifn_softc *sc) { struct hifn_dma *dma = sc->sc_dma; int i; @@ -1125,9 +1096,7 @@ hifn_init_dma(sc) * command buffer size. */ u_int -hifn_write_command(cmd, buf) - struct hifn_command *cmd; - u_int8_t *buf; +hifn_write_command(struct hifn_command *cmd, u_int8_t *buf) { u_int8_t *buf_pos; struct hifn_base_command *base_cmd; @@ -1241,8 +1210,7 @@ hifn_write_command(cmd, buf) } int -hifn_dmamap_aligned(map) - bus_dmamap_t map; +hifn_dmamap_aligned(bus_dmamap_t map) { int i; @@ -1257,9 +1225,7 @@ hifn_dmamap_aligned(map) } int -hifn_dmamap_load_dst(sc, cmd) - struct hifn_softc *sc; - struct hifn_command *cmd; +hifn_dmamap_load_dst(struct hifn_softc *sc, struct hifn_command *cmd) { struct hifn_dma *dma = sc->sc_dma; bus_dmamap_t map = cmd->dst_map; @@ -1331,9 +1297,7 @@ hifn_dmamap_load_dst(sc, cmd) } int -hifn_dmamap_load_src(sc, cmd) - struct hifn_softc *sc; - struct hifn_command *cmd; +hifn_dmamap_load_src(struct hifn_softc *sc, struct hifn_command *cmd) { struct hifn_dma *dma = sc->sc_dma; bus_dmamap_t map = cmd->src_map; @@ -1365,10 +1329,8 @@ hifn_dmamap_load_src(sc, cmd) } int -hifn_crypto(sc, cmd, crp) - struct hifn_softc *sc; - struct hifn_command *cmd; - struct cryptop *crp; +hifn_crypto(struct hifn_softc *sc, struct hifn_command *cmd, + struct cryptop *crp) { struct hifn_dma *dma = sc->sc_dma; u_int32_t cmdlen; @@ -1628,8 +1590,7 @@ err_srcmap1: } void -hifn_tick(vsc) - void *vsc; +hifn_tick(void *vsc) { struct hifn_softc *sc = vsc; int s; @@ -1668,8 +1629,7 @@ hifn_tick(vsc) } int -hifn_intr(arg) - void *arg; +hifn_intr(void *arg) { struct hifn_softc *sc = arg; struct hifn_dma *dma = sc->sc_dma; @@ -1800,9 +1760,7 @@ hifn_intr(arg) * id on successful allocation. */ int -hifn_newsession(sidp, cri) - u_int32_t *sidp; - struct cryptoini *cri; +hifn_newsession(u_int32_t *sidp, struct cryptoini *cri) { struct cryptoini *c; struct hifn_softc *sc = NULL; @@ -1878,8 +1836,7 @@ hifn_newsession(sidp, cri) * XXX to blow away any keys already stored there. */ int -hifn_freesession(tid) - u_int64_t tid; +hifn_freesession(u_int64_t tid) { struct hifn_softc *sc; int card, session; @@ -1899,8 +1856,7 @@ hifn_freesession(tid) } int -hifn_process(crp) - struct cryptop *crp; +hifn_process(struct cryptop *crp) { struct hifn_command *cmd = NULL; int card, session, err; @@ -2133,8 +2089,7 @@ errout: } void -hifn_abort(sc) - struct hifn_softc *sc; +hifn_abort(struct hifn_softc *sc) { struct hifn_dma *dma = sc->sc_dma; struct hifn_command *cmd; @@ -2206,10 +2161,8 @@ hifn_abort(sc) } void -hifn_callback(sc, cmd, resbuf) - struct hifn_softc *sc; - struct hifn_command *cmd; - u_int8_t *resbuf; +hifn_callback(struct hifn_softc *sc, struct hifn_command *cmd, + u_int8_t *resbuf) { struct hifn_dma *dma = sc->sc_dma; struct cryptop *crp = cmd->crp; @@ -2749,11 +2702,8 @@ hifn_mkmbuf_chain(int totlen, struct mbuf *mtemplate) } void -hifn_write_4(sc, reggrp, reg, val) - struct hifn_softc *sc; - int reggrp; - bus_size_t reg; - u_int32_t val; +hifn_write_4(struct hifn_softc *sc, int reggrp, bus_size_t reg, + u_int32_t val) { /* * 7811 PB3 rev/2 parts lock-up on burst writes to Group 0 @@ -2776,10 +2726,7 @@ hifn_write_4(sc, reggrp, reg, val) } u_int32_t -hifn_read_4(sc, reggrp, reg) - struct hifn_softc *sc; - int reggrp; - bus_size_t reg; +hifn_read_4(struct hifn_softc *sc, int reggrp, bus_size_t reg) { if (sc->sc_flags & HIFN_NO_BURSTWRITE) { sc->sc_waw_lastgroup = -1; diff --git a/sys/dev/pci/ubsec.c b/sys/dev/pci/ubsec.c index 58dc53d659d..4a0dd83f6a9 100644 --- a/sys/dev/pci/ubsec.c +++ b/sys/dev/pci/ubsec.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ubsec.c,v 1.127 2003/06/04 14:04:58 jason Exp $ */ +/* $OpenBSD: ubsec.c,v 1.128 2003/08/01 17:55:54 deraadt Exp $ */ /* * Copyright (c) 2000 Jason L. Wright (jason@thought.net) @@ -139,19 +139,14 @@ const struct pci_matchid ubsec_devices[] = { }; int -ubsec_probe(parent, match, aux) - struct device *parent; - void *match; - void *aux; +ubsec_probe(struct device *parent, void *match, void *aux) { return (pci_matchbyid((struct pci_attach_args *)aux, ubsec_devices, sizeof(ubsec_devices)/sizeof(ubsec_devices[0]))); } void -ubsec_attach(parent, self, aux) - struct device *parent, *self; - void *aux; +ubsec_attach(struct device *parent, struct device *self, void *aux) { struct ubsec_softc *sc = (struct ubsec_softc *)self; struct pci_attach_args *pa = aux; @@ -347,8 +342,7 @@ skip_rng: * UBSEC Interrupt routine */ int -ubsec_intr(arg) - void *arg; +ubsec_intr(void *arg) { struct ubsec_softc *sc = arg; volatile u_int32_t stat; @@ -457,8 +451,7 @@ ubsec_intr(arg) * It is assumed that the caller set splnet() */ void -ubsec_feed(sc) - struct ubsec_softc *sc; +ubsec_feed(struct ubsec_softc *sc) { #ifdef UBSEC_DEBUG static int max; @@ -530,7 +523,8 @@ ubsec_feed(sc) feed1: while (!SIMPLEQ_EMPTY(&sc->sc_queue)) { - if ((stat = READ_REG(sc, BS_STAT)) & (BS_STAT_MCR1_FULL | BS_STAT_DMAERR)) { + if ((stat = READ_REG(sc, BS_STAT)) & + (BS_STAT_MCR1_FULL | BS_STAT_DMAERR)) { if(stat & BS_STAT_DMAERR) { ubsec_totalreset(sc); ubsecstats.hst_dmaerr++; @@ -567,9 +561,7 @@ feed1: * id on successful allocation. */ int -ubsec_newsession(sidp, cri) - u_int32_t *sidp; - struct cryptoini *cri; +ubsec_newsession(u_int32_t *sidp, struct cryptoini *cri) { struct cryptoini *c, *encini = NULL, *macini = NULL; struct ubsec_softc *sc = NULL; @@ -715,8 +707,7 @@ ubsec_newsession(sidp, cri) * Deallocate a session. */ int -ubsec_freesession(tid) - u_int64_t tid; +ubsec_freesession(u_int64_t tid) { struct ubsec_softc *sc; int card, session; @@ -732,8 +723,7 @@ ubsec_freesession(tid) } int -ubsec_process(crp) - struct cryptop *crp; +ubsec_process(struct cryptop *crp) { struct ubsec_q *q = NULL; int card, err = 0, i, j, s, nicealign; @@ -1018,7 +1008,8 @@ ubsec_process(crp) if (enccrd == NULL && maccrd != NULL) { dmap->d_dma->d_mcr.mcr_opktbuf.pb_addr = 0; dmap->d_dma->d_mcr.mcr_opktbuf.pb_len = 0; - dmap->d_dma->d_mcr.mcr_opktbuf.pb_next = htole32(dmap->d_alloc.dma_paddr + + dmap->d_dma->d_mcr.mcr_opktbuf.pb_next = + htole32(dmap->d_alloc.dma_paddr + offsetof(struct ubsec_dmachunk, d_macbuf[0])); #ifdef UBSEC_DEBUG printf("opkt: %x %x %x\n", @@ -1237,9 +1228,7 @@ errout2: } void -ubsec_callback(sc, q) - struct ubsec_softc *sc; - struct ubsec_q *q; +ubsec_callback(struct ubsec_softc *sc, struct ubsec_q *q) { struct cryptop *crp = (struct cryptop *)q->q_crp; struct cryptodesc *crd; @@ -1304,9 +1293,7 @@ ubsec_callback(sc, q) } void -ubsec_mcopy(srcm, dstm, hoffset, toffset) - struct mbuf *srcm, *dstm; - int hoffset, toffset; +ubsec_mcopy(struct mbuf *srcm, struct mbuf *dstm, int hoffset, int toffset) { int i, j, dlen, slen; caddr_t dptr, sptr; @@ -1346,8 +1333,7 @@ ubsec_mcopy(srcm, dstm, hoffset, toffset) * feed the key generator, must be called at splnet() or higher. */ void -ubsec_feed2(sc) - struct ubsec_softc *sc; +ubsec_feed2(struct ubsec_softc *sc) { struct ubsec_q2 *q; @@ -1374,9 +1360,7 @@ ubsec_feed2(sc) * Callback for handling random numbers */ void -ubsec_callback2(sc, q) - struct ubsec_softc *sc; - struct ubsec_q2 *q; +ubsec_callback2(struct ubsec_softc *sc, struct ubsec_q2 *q) { struct cryptkop *krp; struct ubsec_ctx_keyop *ctx; @@ -1481,8 +1465,7 @@ ubsec_callback2(sc, q) #ifndef UBSEC_NO_RNG void -ubsec_rng(vsc) - void *vsc; +ubsec_rng(void *vsc) { struct ubsec_softc *sc = vsc; struct ubsec_q2_rng *rng = &sc->sc_rng; @@ -1538,11 +1521,8 @@ out: #endif /* UBSEC_NO_RNG */ int -ubsec_dma_malloc(sc, size, dma, mapflags) - struct ubsec_softc *sc; - bus_size_t size; - struct ubsec_dma_alloc *dma; - int mapflags; +ubsec_dma_malloc(struct ubsec_softc *sc, bus_size_t size, + struct ubsec_dma_alloc *dma, int mapflags) { int r; @@ -1578,9 +1558,7 @@ fail_0: } void -ubsec_dma_free(sc, dma) - struct ubsec_softc *sc; - struct ubsec_dma_alloc *dma; +ubsec_dma_free(struct ubsec_softc *sc, struct ubsec_dma_alloc *dma) { bus_dmamap_unload(sc->sc_dmat, dma->dma_map); bus_dmamem_unmap(sc->sc_dmat, dma->dma_vaddr, dma->dma_size); @@ -1593,8 +1571,7 @@ ubsec_dma_free(sc, dma) * from the reset (i.e. initial values are assigned elsewhere). */ void -ubsec_reset_board(sc) - struct ubsec_softc *sc; +ubsec_reset_board(struct ubsec_softc *sc) { volatile u_int32_t ctrl; @@ -1612,8 +1589,7 @@ ubsec_reset_board(sc) * Init Broadcom registers */ void -ubsec_init_board(sc) - struct ubsec_softc *sc; +ubsec_init_board(struct ubsec_softc *sc) { u_int32_t ctrl; @@ -1636,8 +1612,7 @@ ubsec_init_board(sc) * Init Broadcom PCI registers */ void -ubsec_init_pciregs(pa) - struct pci_attach_args *pa; +ubsec_init_pciregs(struct pci_attach_args *pa) { pci_chipset_tag_t pc = pa->pa_pc; u_int32_t misc; @@ -1655,11 +1630,10 @@ ubsec_init_pciregs(pa) /* * Clean up after a chip crash. - * It is assumed that the caller in splnet() + * It is assumed that the caller is in splnet() */ void -ubsec_cleanchip(sc) - struct ubsec_softc *sc; +ubsec_cleanchip(struct ubsec_softc *sc) { struct ubsec_q *q; @@ -1722,8 +1696,7 @@ ubsec_free_q(struct ubsec_softc *sc, struct ubsec_q *q) * It is assumed that the caller is in splnet() */ void -ubsec_totalreset(sc) - struct ubsec_softc *sc; +ubsec_totalreset(struct ubsec_softc *sc) { ubsec_reset_board(sc); ubsec_init_board(sc); @@ -1731,8 +1704,7 @@ ubsec_totalreset(sc) } int -ubsec_dmamap_aligned(map) - bus_dmamap_t map; +ubsec_dmamap_aligned(bus_dmamap_t map) { int i; @@ -1747,8 +1719,7 @@ ubsec_dmamap_aligned(map) } struct ubsec_softc * -ubsec_kfind(krp) - struct cryptkop *krp; +ubsec_kfind(struct cryptkop *krp) { struct ubsec_softc *sc; int i; @@ -1764,9 +1735,7 @@ ubsec_kfind(krp) } void -ubsec_kfree(sc, q) - struct ubsec_softc *sc; - struct ubsec_q2 *q; +ubsec_kfree(struct ubsec_softc *sc, struct ubsec_q2 *q) { switch (q->q_type) { case UBS_CTXOP_MODEXP: { @@ -1799,8 +1768,7 @@ ubsec_kfree(sc, q) } int -ubsec_kprocess(krp) - struct cryptkop *krp; +ubsec_kprocess(struct cryptkop *krp) { struct ubsec_softc *sc; int r; @@ -1842,9 +1810,7 @@ ubsec_kprocess(krp) * Start computation of cr[C] = (cr[M] ^ cr[E]) mod cr[N] (sw normalization) */ int -ubsec_kprocess_modexp_sw(sc, krp) - struct ubsec_softc *sc; - struct cryptkop *krp; +ubsec_kprocess_modexp_sw(struct ubsec_softc *sc, struct cryptkop *krp) { struct ubsec_q2_modexp *me; struct ubsec_mcr *mcr; @@ -2043,9 +2009,7 @@ errout: * Start computation of cr[C] = (cr[M] ^ cr[E]) mod cr[N] (hw normalization) */ int -ubsec_kprocess_modexp_hw(sc, krp) - struct ubsec_softc *sc; - struct cryptkop *krp; +ubsec_kprocess_modexp_hw(struct ubsec_softc *sc, struct cryptkop *krp) { struct ubsec_q2_modexp *me; struct ubsec_mcr *mcr; @@ -2241,9 +2205,7 @@ errout: } int -ubsec_kprocess_rsapriv(sc, krp) - struct ubsec_softc *sc; - struct cryptkop *krp; +ubsec_kprocess_rsapriv(struct ubsec_softc *sc, struct cryptkop *krp) { struct ubsec_q2_rsapriv *rp = NULL; struct ubsec_mcr *mcr; @@ -2488,8 +2450,7 @@ ubsec_dump_mcr(struct ubsec_mcr *mcr) * Return the number of significant bits of a big number. */ int -ubsec_ksigbits(cr) - struct crparam *cr; +ubsec_ksigbits(struct crparam *cr) { u_int plen = (cr->crp_nbits + 7) / 8; int i, sig = plen * 8; @@ -2510,9 +2471,8 @@ ubsec_ksigbits(cr) } void -ubsec_kshift_r(shiftbits, src, srcbits, dst, dstbits) - u_int shiftbits, srcbits, dstbits; - u_int8_t *src, *dst; +ubsec_kshift_r(u_int shiftbits, u_int8_t *src, u_int srcbits, + u_int8_t *dst, u_int dstbits) { u_int slen, dlen; int i, si, di, n; @@ -2545,9 +2505,8 @@ ubsec_kshift_r(shiftbits, src, srcbits, dst, dstbits) } void -ubsec_kshift_l(shiftbits, src, srcbits, dst, dstbits) - u_int shiftbits, srcbits, dstbits; - u_int8_t *src, *dst; +ubsec_kshift_l(u_int shiftbits, u_int8_t *src, u_int srcbits, + u_int8_t *dst, u_int dstbits) { int slen, dlen, i, n; |