Annotation of sys/dev/pci/nofnvar.h, Revision 1.1.1.1
1.1 nbrk 1: /* $OpenBSD: nofnvar.h,v 1.6 2003/06/02 19:08:58 jason Exp $ */
2:
3: /*
4: * Copyright (c) 2002 Jason L. Wright (jason@thought.net)
5: * All rights reserved.
6: *
7: * Redistribution and use in source and binary forms, with or without
8: * modification, are permitted provided that the following conditions
9: * are met:
10: * 1. Redistributions of source code must retain the above copyright
11: * notice, this list of conditions and the following disclaimer.
12: * 2. Redistributions in binary form must reproduce the above copyright
13: * notice, this list of conditions and the following disclaimer in the
14: * documentation and/or other materials provided with the distribution.
15: *
16: * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17: * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18: * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19: * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
20: * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21: * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22: * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23: * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
24: * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
25: * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26: * POSSIBILITY OF SUCH DAMAGE.
27: *
28: * Effort sponsored in part by the Defense Advanced Research Projects
29: * Agency (DARPA) and Air Force Research Laboratory, Air Force
30: * Materiel Command, USAF, under agreement number F30602-01-2-0537.
31: *
32: */
33:
34: struct nofn_softc {
35: struct device sc_dev;
36: void *sc_ih;
37: bus_space_handle_t sc_sh;
38: bus_space_tag_t sc_st;
39: bus_space_handle_t sc_pk_h;
40: bus_space_tag_t sc_pk_t;
41: bus_dma_tag_t sc_dmat;
42: int32_t sc_cid;
43: int sc_flags;
44: int sc_rngskip, sc_rngtick;
45: struct timeout sc_rngto;
46: u_int32_t sc_intrmask, sc_revid;
47: SIMPLEQ_HEAD(,nofn_pk_q) sc_pk_queue;
48: struct nofn_pk_q *sc_pk_current;
49: union nofn_pk_reg sc_pk_tmp, sc_pk_zero;
50: };
51:
52: struct nofn_pk_q {
53: SIMPLEQ_ENTRY(nofn_pk_q) q_next;
54: int (*q_start)(struct nofn_softc *, struct nofn_pk_q *);
55: void (*q_finish)(struct nofn_softc *, struct nofn_pk_q *);
56: struct cryptkop *q_krp;
57: };
58:
59: #define NOFN_FLAGS_RNG 0x01
60: #define NOFN_FLAGS_PK 0x02
61:
62: #define REG_WRITE_4(sc,r,v) \
63: bus_space_write_4((sc)->sc_st, (sc)->sc_sh, (r), (v))
64: #define REG_READ_4(sc,r) \
65: bus_space_read_4((sc)->sc_st, (sc)->sc_sh, (r))
66:
67: #define PK_WRITE_4(sc,r,v) \
68: bus_space_write_4((sc)->sc_pk_t, (sc)->sc_pk_h, (r), (v))
69: #define PK_READ_4(sc,r) \
70: bus_space_read_4((sc)->sc_pk_t, (sc)->sc_pk_h, (r))
71:
72: #ifndef PK_RNC_SCALER
73: #define PK_RNC_SCALER 0x00000700
74: #endif
75:
76: /* C = M ^ E mod N */
77: #define NOFN_MODEXP_PAR_M 0
78: #define NOFN_MODEXP_PAR_E 1
79: #define NOFN_MODEXP_PAR_N 2
CVSweb