summaryrefslogtreecommitdiff
path: root/sys/dev/pci
diff options
context:
space:
mode:
authorJason Wright <jason@cvs.openbsd.org>2002-11-21 19:34:26 +0000
committerJason Wright <jason@cvs.openbsd.org>2002-11-21 19:34:26 +0000
commitdf234af540aa3148a946aaf2c7cb99d0d430622c (patch)
tree9648d1fafda02024471905aa3f82a4608b4ad4e7 /sys/dev/pci
parentcc4cd7513a1c3435029bffc00a6e730e3d3bd8ef (diff)
From Angelos:
- simplistic load balancing across multiple cards - simplified registration process - a few style nits.
Diffstat (limited to 'sys/dev/pci')
-rw-r--r--sys/dev/pci/hifn7751.c29
-rw-r--r--sys/dev/pci/lofn.c8
-rw-r--r--sys/dev/pci/nofn.c7
-rw-r--r--sys/dev/pci/ubsec.c23
4 files changed, 40 insertions, 27 deletions
diff --git a/sys/dev/pci/hifn7751.c b/sys/dev/pci/hifn7751.c
index 5be93e94619..70834edf503 100644
--- a/sys/dev/pci/hifn7751.c
+++ b/sys/dev/pci/hifn7751.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: hifn7751.c,v 1.133 2002/11/19 18:40:17 jason Exp $ */
+/* $OpenBSD: hifn7751.c,v 1.134 2002/11/21 19:34:25 jason Exp $ */
/*
* Invertex AEON / Hifn 7751 driver
@@ -150,6 +150,7 @@ hifn_attach(parent, self, aux)
u_int16_t ena;
int rseg;
caddr_t kva;
+ int algs[CRYPTO_ALGORITHM_MAX + 1];
sc->sc_pci_pc = pa->pa_pc;
sc->sc_pci_tag = pa->pa_tag;
@@ -290,26 +291,24 @@ hifn_attach(parent, self, aux)
READ_REG_0(sc, HIFN_0_PUCNFG) | HIFN_PUCNFG_CHIPID);
ena = READ_REG_0(sc, HIFN_0_PUSTAT) & HIFN_PUSTAT_CHIPENA;
+ bzero(algs, sizeof(algs));
+
switch (ena) {
case HIFN_PUSTAT_ENA_2:
- crypto_register(sc->sc_cid, CRYPTO_3DES_CBC, 0, 0,
- hifn_newsession, hifn_freesession, hifn_process);
- crypto_register(sc->sc_cid, CRYPTO_ARC4, 0, 0,
- hifn_newsession, hifn_freesession, hifn_process);
+ algs[CRYPTO_3DES_CBC] = CRYPTO_ALG_FLAG_SUPPORTED;
+ algs[CRYPTO_ARC4] = CRYPTO_ALG_FLAG_SUPPORTED;
/*FALLTHROUGH*/
case HIFN_PUSTAT_ENA_1:
- crypto_register(sc->sc_cid, CRYPTO_MD5, 0, 0,
- hifn_newsession, hifn_freesession, hifn_process);
- crypto_register(sc->sc_cid, CRYPTO_SHA1, 0, 0,
- hifn_newsession, hifn_freesession, hifn_process);
- crypto_register(sc->sc_cid, CRYPTO_MD5_HMAC, 0, 0,
- hifn_newsession, hifn_freesession, hifn_process);
- crypto_register(sc->sc_cid, CRYPTO_SHA1_HMAC, 0, 0,
- hifn_newsession, hifn_freesession, hifn_process);
- crypto_register(sc->sc_cid, CRYPTO_DES_CBC, 0, 0,
- hifn_newsession, hifn_freesession, hifn_process);
+ algs[CRYPTO_MD5] = CRYPTO_ALG_FLAG_SUPPORTED;
+ algs[CRYPTO_SHA1] = CRYPTO_ALG_FLAG_SUPPORTED;
+ algs[CRYPTO_MD5_HMAC] = CRYPTO_ALG_FLAG_SUPPORTED;
+ algs[CRYPTO_SHA1_HMAC] = CRYPTO_ALG_FLAG_SUPPORTED;
+ algs[CRYPTO_DES_CBC] = CRYPTO_ALG_FLAG_SUPPORTED;
}
+ crypto_register(sc->sc_cid, algs, hifn_newsession,
+ hifn_freesession, hifn_process);
+
bus_dmamap_sync(sc->sc_dmat, sc->sc_dmamap, 0,
sc->sc_dmamap->dm_mapsize,
BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE);
diff --git a/sys/dev/pci/lofn.c b/sys/dev/pci/lofn.c
index f9df2a53e55..0e350a1e7d3 100644
--- a/sys/dev/pci/lofn.c
+++ b/sys/dev/pci/lofn.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lofn.c,v 1.21 2002/09/24 18:33:26 jason Exp $ */
+/* $OpenBSD: lofn.c,v 1.22 2002/11/21 19:34:25 jason Exp $ */
/*
* Copyright (c) 2001-2002 Jason L. Wright (jason@thought.net)
@@ -114,6 +114,7 @@ lofn_attach(parent, self, aux)
const char *intrstr = NULL;
bus_size_t iosize;
u_int32_t cmd;
+ int algs[CRK_ALGORITHM_MAX + 1];
cmd = pci_conf_read(pc, pa->pa_tag, PCI_COMMAND_STATUS_REG);
cmd |= PCI_COMMAND_MEM_ENABLE;
@@ -168,7 +169,10 @@ lofn_attach(parent, self, aux)
return;
}
- crypto_kregister(sc->sc_cid, CRK_MOD_EXP, 0, lofn_kprocess);
+ bzero(algs, sizeof(algs));
+ algs[CRK_MOD_EXP] = CRYPTO_ALG_FLAG_SUPPORTED;
+
+ crypto_kregister(sc->sc_cid, algs, lofn_kprocess);
printf(": %s\n", intrstr);
diff --git a/sys/dev/pci/nofn.c b/sys/dev/pci/nofn.c
index 997d6c144c1..c7717f2c1fb 100644
--- a/sys/dev/pci/nofn.c
+++ b/sys/dev/pci/nofn.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nofn.c,v 1.6 2002/09/24 18:33:26 jason Exp $ */
+/* $OpenBSD: nofn.c,v 1.7 2002/11/21 19:34:25 jason Exp $ */
/*
* Copyright (c) 2002 Jason L. Wright (jason@thought.net)
@@ -373,6 +373,7 @@ nofn_pk_enable(sc)
struct nofn_softc *sc;
{
u_int32_t r;
+ int algs[CRK_ALGORITHM_MAX + 1];
if ((sc->sc_cid = crypto_get_driverid(0)) < 0) {
printf(": failed to register cid\n");
@@ -382,7 +383,9 @@ nofn_pk_enable(sc)
SIMPLEQ_INIT(&sc->sc_pk_queue);
sc->sc_pk_current = NULL;
- crypto_kregister(sc->sc_cid, CRK_MOD_EXP, 0, nofn_pk_process);
+ bzero(algs, sizeof(algs));
+ algs[CRK_MOD_EXP] = CRYPTO_ALG_FLAG_SUPPORTED;
+ crypto_kregister(sc->sc_cid, algs, nofn_pk_process);
/* enable ALU */
r = PK_READ_4(sc, NOFN_PK_CFG2);
diff --git a/sys/dev/pci/ubsec.c b/sys/dev/pci/ubsec.c
index 187ed180ea9..aab0a78f5e7 100644
--- a/sys/dev/pci/ubsec.c
+++ b/sys/dev/pci/ubsec.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ubsec.c,v 1.119 2002/11/19 18:40:17 jason Exp $ */
+/* $OpenBSD: ubsec.c,v 1.120 2002/11/21 19:34:25 jason Exp $ */
/*
* Copyright (c) 2000 Jason L. Wright (jason@thought.net)
@@ -167,6 +167,8 @@ ubsec_attach(parent, self, aux)
struct ubsec_dma *dmap;
bus_size_t iosize;
u_int32_t cmd, i;
+ int algs[CRYPTO_ALGORITHM_MAX + 1];
+ int kalgs[CRK_ALGORITHM_MAX + 1];
SIMPLEQ_INIT(&sc->sc_queue);
SIMPLEQ_INIT(&sc->sc_qchip);
@@ -273,11 +275,13 @@ ubsec_attach(parent, self, aux)
SIMPLEQ_INSERT_TAIL(&sc->sc_freequeue, q, q_next);
}
- crypto_register(sc->sc_cid, CRYPTO_3DES_CBC, 0, 0,
- ubsec_newsession, ubsec_freesession, ubsec_process);
- crypto_register(sc->sc_cid, CRYPTO_DES_CBC, 0, 0, NULL, NULL, NULL);
- crypto_register(sc->sc_cid, CRYPTO_MD5_HMAC, 0, 0, NULL, NULL, NULL);
- crypto_register(sc->sc_cid, CRYPTO_SHA1_HMAC, 0, 0, NULL, NULL, NULL);
+ bzero(algs, sizeof(algs));
+ algs[CRYPTO_3DES_CBC] = CRYPTO_ALG_FLAG_SUPPORTED;
+ algs[CRYPTO_DES_CBC] = CRYPTO_ALG_FLAG_SUPPORTED;
+ algs[CRYPTO_MD5_HMAC] = CRYPTO_ALG_FLAG_SUPPORTED;
+ algs[CRYPTO_SHA1_HMAC] = CRYPTO_ALG_FLAG_SUPPORTED;
+ crypto_register(sc->sc_cid, algs, ubsec_newsession,
+ ubsec_freesession, ubsec_process);
/*
* Reset Broadcom chip
@@ -332,10 +336,13 @@ skip_rng:
if (sc->sc_flags & UBS_FLAGS_KEY) {
sc->sc_statmask |= BS_STAT_MCR2_DONE;
- crypto_kregister(sc->sc_cid, CRK_MOD_EXP, 0, ubsec_kprocess);
+ bzero(kalgs, sizeof(kalgs));
+ kalgs[CRK_MOD_EXP] = CRYPTO_ALG_FLAG_SUPPORTED;
#if 0
- crypto_kregister(sc->sc_cid, CRK_MOD_EXP_CRT, 0, ubsec_kprocess);
+ kalgs[CRK_MOD_EXP_CRT] = CRYPTO_ALG_FLAG_SUPPORTED;
#endif
+
+ crypto_kregister(sc->sc_cid, kalgs, ubsec_kprocess);
}
printf("\n");