Add header guards and necessary includes.diff -r1.41 -r1.42 src/sys/dev/pci/ubsec.c
(riastradh)
--- src/sys/dev/pci/ubsec.c 2014/08/10 16:44:36 1.41
+++ src/sys/dev/pci/ubsec.c 2015/04/13 15:43:43 1.42
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: ubsec.c,v 1.41 2014/08/10 16:44:36 tls Exp $ */ | 1 | /* $NetBSD: ubsec.c,v 1.42 2015/04/13 15:43:43 riastradh Exp $ */ | |
2 | /* $FreeBSD: src/sys/dev/ubsec/ubsec.c,v 1.6.2.6 2003/01/23 21:06:43 sam Exp $ */ | 2 | /* $FreeBSD: src/sys/dev/ubsec/ubsec.c,v 1.6.2.6 2003/01/23 21:06:43 sam Exp $ */ | |
3 | /* $OpenBSD: ubsec.c,v 1.143 2009/03/27 13:31:30 reyk Exp$ */ | 3 | /* $OpenBSD: ubsec.c,v 1.143 2009/03/27 13:31:30 reyk Exp$ */ | |
4 | 4 | |||
5 | /* | 5 | /* | |
6 | * Copyright (c) 2000 Jason L. Wright (jason@thought.net) | 6 | * Copyright (c) 2000 Jason L. Wright (jason@thought.net) | |
7 | * Copyright (c) 2000 Theo de Raadt (deraadt@openbsd.org) | 7 | * Copyright (c) 2000 Theo de Raadt (deraadt@openbsd.org) | |
8 | * Copyright (c) 2001 Patrik Lindergren (patrik@ipunplugged.com) | 8 | * Copyright (c) 2001 Patrik Lindergren (patrik@ipunplugged.com) | |
9 | * | 9 | * | |
10 | * Redistribution and use in source and binary forms, with or without | 10 | * Redistribution and use in source and binary forms, with or without | |
11 | * modification, are permitted provided that the following conditions | 11 | * modification, are permitted provided that the following conditions | |
12 | * are met: | 12 | * are met: | |
13 | * 1. Redistributions of source code must retain the above copyright | 13 | * 1. Redistributions of source code must retain the above copyright | |
14 | * notice, this list of conditions and the following disclaimer. | 14 | * notice, this list of conditions and the following disclaimer. | |
@@ -25,27 +25,27 @@ | @@ -25,27 +25,27 @@ | |||
25 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | 25 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
26 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | 26 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | |
27 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN | 27 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN | |
28 | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | 28 | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
29 | * POSSIBILITY OF SUCH DAMAGE. | 29 | * POSSIBILITY OF SUCH DAMAGE. | |
30 | * | 30 | * | |
31 | * Effort sponsored in part by the Defense Advanced Research Projects | 31 | * Effort sponsored in part by the Defense Advanced Research Projects | |
32 | * Agency (DARPA) and Air Force Research Laboratory, Air Force | 32 | * Agency (DARPA) and Air Force Research Laboratory, Air Force | |
33 | * Materiel Command, USAF, under agreement number F30602-01-2-0537. | 33 | * Materiel Command, USAF, under agreement number F30602-01-2-0537. | |
34 | * | 34 | * | |
35 | */ | 35 | */ | |
36 | 36 | |||
37 | #include <sys/cdefs.h> | 37 | #include <sys/cdefs.h> | |
38 | __KERNEL_RCSID(0, "$NetBSD: ubsec.c,v 1.41 2014/08/10 16:44:36 tls Exp $"); | 38 | __KERNEL_RCSID(0, "$NetBSD: ubsec.c,v 1.42 2015/04/13 15:43:43 riastradh Exp $"); | |
39 | 39 | |||
40 | #undef UBSEC_DEBUG | 40 | #undef UBSEC_DEBUG | |
41 | 41 | |||
42 | /* | 42 | /* | |
43 | * uBsec 5[56]01, 58xx hardware crypto accelerator | 43 | * uBsec 5[56]01, 58xx hardware crypto accelerator | |
44 | */ | 44 | */ | |
45 | 45 | |||
46 | #include <sys/param.h> | 46 | #include <sys/param.h> | |
47 | #include <sys/systm.h> | 47 | #include <sys/systm.h> | |
48 | #include <sys/proc.h> | 48 | #include <sys/proc.h> | |
49 | #include <sys/endian.h> | 49 | #include <sys/endian.h> | |
50 | #ifdef __NetBSD__ | 50 | #ifdef __NetBSD__ | |
51 | #define UBSEC_NO_RNG /* hangs on attach */ | 51 | #define UBSEC_NO_RNG /* hangs on attach */ | |
@@ -59,26 +59,28 @@ __KERNEL_RCSID(0, "$NetBSD: ubsec.c,v 1. | @@ -59,26 +59,28 @@ __KERNEL_RCSID(0, "$NetBSD: ubsec.c,v 1. | |||
59 | #include <sys/device.h> | 59 | #include <sys/device.h> | |
60 | #include <sys/module.h> | 60 | #include <sys/module.h> | |
61 | #include <sys/queue.h> | 61 | #include <sys/queue.h> | |
62 | #include <sys/sysctl.h> | 62 | #include <sys/sysctl.h> | |
63 | 63 | |||
64 | #include <opencrypto/cryptodev.h> | 64 | #include <opencrypto/cryptodev.h> | |
65 | #include <opencrypto/xform.h> | 65 | #include <opencrypto/xform.h> | |
66 | #ifdef __OpenBSD__ | 66 | #ifdef __OpenBSD__ | |
67 | #include <dev/rndvar.h> | 67 | #include <dev/rndvar.h> | |
68 | #include <sys/md5k.h> | 68 | #include <sys/md5k.h> | |
69 | #else | 69 | #else | |
70 | #include <sys/cprng.h> | 70 | #include <sys/cprng.h> | |
71 | #include <sys/md5.h> | 71 | #include <sys/md5.h> | |
72 | #include <sys/rndpool.h> | |||
73 | #include <sys/rndsource.h> | |||
72 | #endif | 74 | #endif | |
73 | #include <sys/sha1.h> | 75 | #include <sys/sha1.h> | |
74 | 76 | |||
75 | #include <dev/pci/pcireg.h> | 77 | #include <dev/pci/pcireg.h> | |
76 | #include <dev/pci/pcivar.h> | 78 | #include <dev/pci/pcivar.h> | |
77 | #include <dev/pci/pcidevs.h> | 79 | #include <dev/pci/pcidevs.h> | |
78 | 80 | |||
79 | #include <dev/pci/ubsecreg.h> | 81 | #include <dev/pci/ubsecreg.h> | |
80 | #include <dev/pci/ubsecvar.h> | 82 | #include <dev/pci/ubsecvar.h> | |
81 | 83 | |||
82 | /* | 84 | /* | |
83 | * Prototypes and count for the pci_device structure | 85 | * Prototypes and count for the pci_device structure | |
84 | */ | 86 | */ |
--- src/sys/dev/pci/ubsecreg.h 2014/04/19 12:29:24 1.4
+++ src/sys/dev/pci/ubsecreg.h 2015/04/13 15:43:43 1.5
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: ubsecreg.h,v 1.4 2014/04/19 12:29:24 bad Exp $ */ | 1 | /* $NetBSD: ubsecreg.h,v 1.5 2015/04/13 15:43:43 riastradh Exp $ */ | |
2 | /* $OpenBSD: ubsecreg.h,v 1.29 2009/03/25 12:17:30 reyk Exp $ */ | 2 | /* $OpenBSD: ubsecreg.h,v 1.29 2009/03/25 12:17:30 reyk Exp $ */ | |
3 | 3 | |||
4 | /* | 4 | /* | |
5 | * Copyright (c) 2000 Theo de Raadt | 5 | * Copyright (c) 2000 Theo de Raadt | |
6 | * Copyright (c) 2001 Patrik Lindergren (patrik@ipunplugged.com) | 6 | * Copyright (c) 2001 Patrik Lindergren (patrik@ipunplugged.com) | |
7 | * | 7 | * | |
8 | * Redistribution and use in source and binary forms, with or without | 8 | * Redistribution and use in source and binary forms, with or without | |
9 | * modification, are permitted provided that the following conditions | 9 | * modification, are permitted provided that the following conditions | |
10 | * are met: | 10 | * are met: | |
11 | * | 11 | * | |
12 | * 1. Redistributions of source code must retain the above copyright | 12 | * 1. Redistributions of source code must retain the above copyright | |
13 | * notice, this list of conditions and the following disclaimer. | 13 | * notice, this list of conditions and the following disclaimer. | |
14 | * 2. Redistributions in binary form must reproduce the above copyright | 14 | * 2. Redistributions in binary form must reproduce the above copyright | |
@@ -22,26 +22,29 @@ | @@ -22,26 +22,29 @@ | |||
22 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | 22 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | |
23 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 23 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
24 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 24 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
25 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 25 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
26 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 26 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | |
27 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 27 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
28 | * | 28 | * | |
29 | * Effort sponsored in part by the Defense Advanced Research Projects | 29 | * Effort sponsored in part by the Defense Advanced Research Projects | |
30 | * Agency (DARPA) and Air Force Research Laboratory, Air Force | 30 | * Agency (DARPA) and Air Force Research Laboratory, Air Force | |
31 | * Materiel Command, USAF, under agreement number F30602-01-2-0537. | 31 | * Materiel Command, USAF, under agreement number F30602-01-2-0537. | |
32 | * | 32 | * | |
33 | */ | 33 | */ | |
34 | 34 | |||
35 | #ifndef _DEV_PCI_UBSECREG_H | |||
36 | #define _DEV_PCI_UBSECREG_H | |||
37 | ||||
35 | /* | 38 | /* | |
36 | * Register definitions for 5601 BlueSteel Networks Ubiquitous Broadband | 39 | * Register definitions for 5601 BlueSteel Networks Ubiquitous Broadband | |
37 | * Security "uBSec" chip. Definitions from revision 2.8 of the product | 40 | * Security "uBSec" chip. Definitions from revision 2.8 of the product | |
38 | * datasheet. | 41 | * datasheet. | |
39 | */ | 42 | */ | |
40 | 43 | |||
41 | #define BS_BAR 0x10 /* DMA base address register */ | 44 | #define BS_BAR 0x10 /* DMA base address register */ | |
42 | #define BS_TRDY_TIMEOUT 0x40 /* TRDY timeout */ | 45 | #define BS_TRDY_TIMEOUT 0x40 /* TRDY timeout */ | |
43 | #define BS_RETRY_TIMEOUT 0x41 /* DMA retry timeout */ | 46 | #define BS_RETRY_TIMEOUT 0x41 /* DMA retry timeout */ | |
44 | 47 | |||
45 | #define UBS_PCI_RTY_SHIFT 8 | 48 | #define UBS_PCI_RTY_SHIFT 8 | |
46 | #define UBS_PCI_RTY_MASK 0xff | 49 | #define UBS_PCI_RTY_MASK 0xff | |
47 | #define UBS_PCI_RTY(misc) \ | 50 | #define UBS_PCI_RTY(misc) \ | |
@@ -241,13 +244,15 @@ struct ubsec_ctx_modexp { | @@ -241,13 +244,15 @@ struct ubsec_ctx_modexp { | |||
241 | volatile u_int16_t me_E_len; /* E (bits) */ | 244 | volatile u_int16_t me_E_len; /* E (bits) */ | |
242 | volatile u_int16_t me_N_len; /* N (bits) */ | 245 | volatile u_int16_t me_N_len; /* N (bits) */ | |
243 | u_int8_t me_N[2048/8]; /* N */ | 246 | u_int8_t me_N[2048/8]; /* N */ | |
244 | }; | 247 | }; | |
245 | 248 | |||
246 | struct ubsec_ctx_rsapriv { | 249 | struct ubsec_ctx_rsapriv { | |
247 | volatile u_int16_t rpr_len; /* command length */ | 250 | volatile u_int16_t rpr_len; /* command length */ | |
248 | volatile u_int16_t rpr_op; /* rsaprivate, 0x04 */ | 251 | volatile u_int16_t rpr_op; /* rsaprivate, 0x04 */ | |
249 | volatile u_int16_t rpr_q_len; /* q (bits) */ | 252 | volatile u_int16_t rpr_q_len; /* q (bits) */ | |
250 | volatile u_int16_t rpr_p_len; /* p (bits) */ | 253 | volatile u_int16_t rpr_p_len; /* p (bits) */ | |
251 | u_int8_t rpr_buf[5 * 1024 / 8]; /* parameters: */ | 254 | u_int8_t rpr_buf[5 * 1024 / 8]; /* parameters: */ | |
252 | /* p, q, dp, dq, pinv */ | 255 | /* p, q, dp, dq, pinv */ | |
253 | }; | 256 | }; | |
257 | ||||
258 | #endif /* _DEV_PCI_UBSECREG_H */ |
--- src/sys/dev/pci/ubsecvar.h 2014/04/19 12:29:24 1.9
+++ src/sys/dev/pci/ubsecvar.h 2015/04/13 15:43:43 1.10
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: ubsecvar.h,v 1.9 2014/04/19 12:29:24 bad Exp $ */ | 1 | /* $NetBSD: ubsecvar.h,v 1.10 2015/04/13 15:43:43 riastradh Exp $ */ | |
2 | /* $OpenBSD: ubsecvar.h,v 1.38 2009/03/27 13:31:30 reyk Exp $ */ | 2 | /* $OpenBSD: ubsecvar.h,v 1.38 2009/03/27 13:31:30 reyk Exp $ */ | |
3 | 3 | |||
4 | /* | 4 | /* | |
5 | * Copyright (c) 2000 Theo de Raadt | 5 | * Copyright (c) 2000 Theo de Raadt | |
6 | * Copyright (c) 2001 Patrik Lindergren (patrik@ipunplugged.com) | 6 | * Copyright (c) 2001 Patrik Lindergren (patrik@ipunplugged.com) | |
7 | * | 7 | * | |
8 | * Redistribution and use in source and binary forms, with or without | 8 | * Redistribution and use in source and binary forms, with or without | |
9 | * modification, are permitted provided that the following conditions | 9 | * modification, are permitted provided that the following conditions | |
10 | * are met: | 10 | * are met: | |
11 | * | 11 | * | |
12 | * 1. Redistributions of source code must retain the above copyright | 12 | * 1. Redistributions of source code must retain the above copyright | |
13 | * notice, this list of conditions and the following disclaimer. | 13 | * notice, this list of conditions and the following disclaimer. | |
14 | * 2. Redistributions in binary form must reproduce the above copyright | 14 | * 2. Redistributions in binary form must reproduce the above copyright | |
@@ -22,26 +22,32 @@ | @@ -22,26 +22,32 @@ | |||
22 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | 22 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | |
23 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 23 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
24 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 24 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
25 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 25 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
26 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 26 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | |
27 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 27 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
28 | * | 28 | * | |
29 | * Effort sponsored in part by the Defense Advanced Research Projects | 29 | * Effort sponsored in part by the Defense Advanced Research Projects | |
30 | * Agency (DARPA) and Air Force Research Laboratory, Air Force | 30 | * Agency (DARPA) and Air Force Research Laboratory, Air Force | |
31 | * Materiel Command, USAF, under agreement number F30602-01-2-0537. | 31 | * Materiel Command, USAF, under agreement number F30602-01-2-0537. | |
32 | * | 32 | * | |
33 | */ | 33 | */ | |
34 | 34 | |||
35 | #ifndef _DEV_PCI_UBSECVAR_H | |||
36 | #define _DEV_PCI_UBSECVAR_H | |||
37 | ||||
38 | #include <sys/types.h> | |||
39 | #include <sys/rndsource.h> | |||
40 | ||||
35 | /* Maximum queue length */ | 41 | /* Maximum queue length */ | |
36 | #ifndef UBS_MAX_NQUEUE | 42 | #ifndef UBS_MAX_NQUEUE | |
37 | #define UBS_MAX_NQUEUE 60 | 43 | #define UBS_MAX_NQUEUE 60 | |
38 | #endif | 44 | #endif | |
39 | 45 | |||
40 | #define UBS_MAX_SCATTER 64 /* Maximum scatter/gather depth */ | 46 | #define UBS_MAX_SCATTER 64 /* Maximum scatter/gather depth */ | |
41 | 47 | |||
42 | #ifndef UBS_MAX_AGGR | 48 | #ifndef UBS_MAX_AGGR | |
43 | #define UBS_MAX_AGGR 17 /* Maximum aggregation count */ | 49 | #define UBS_MAX_AGGR 17 /* Maximum aggregation count */ | |
44 | #endif | 50 | #endif | |
45 | 51 | |||
46 | #ifndef UBS_MIN_AGGR | 52 | #ifndef UBS_MIN_AGGR | |
47 | #define UBS_MIN_AGGR 5 /* < 5827, Maximum aggregation count */ | 53 | #define UBS_MIN_AGGR 5 /* < 5827, Maximum aggregation count */ | |
@@ -230,13 +236,15 @@ struct ubsec_stats { | @@ -230,13 +236,15 @@ struct ubsec_stats { | |||
230 | u_int32_t hst_nomap; /* bus_dmamap_create failed */ | 236 | u_int32_t hst_nomap; /* bus_dmamap_create failed */ | |
231 | u_int32_t hst_noload; /* bus_dmamap_load_* failed */ | 237 | u_int32_t hst_noload; /* bus_dmamap_load_* failed */ | |
232 | u_int32_t hst_nombuf; /* MGET* failed */ | 238 | u_int32_t hst_nombuf; /* MGET* failed */ | |
233 | u_int32_t hst_nomcl; /* MCLGET* failed */ | 239 | u_int32_t hst_nomcl; /* MCLGET* failed */ | |
234 | u_int32_t hst_totbatch; /* ops submitted w/o interrupt */ | 240 | u_int32_t hst_totbatch; /* ops submitted w/o interrupt */ | |
235 | u_int32_t hst_maxbatch; /* max ops submitted together */ | 241 | u_int32_t hst_maxbatch; /* max ops submitted together */ | |
236 | u_int32_t hst_maxqueue; /* max ops queued for submission */ | 242 | u_int32_t hst_maxqueue; /* max ops queued for submission */ | |
237 | u_int32_t hst_maxqchip; /* max mcr1 ops out for processing */ | 243 | u_int32_t hst_maxqchip; /* max mcr1 ops out for processing */ | |
238 | u_int32_t hst_mcr1full; /* MCR1 too busy to take ops */ | 244 | u_int32_t hst_mcr1full; /* MCR1 too busy to take ops */ | |
239 | u_int32_t hst_rng; /* RNG requests */ | 245 | u_int32_t hst_rng; /* RNG requests */ | |
240 | u_int32_t hst_modexp; /* MOD EXP requests */ | 246 | u_int32_t hst_modexp; /* MOD EXP requests */ | |
241 | u_int32_t hst_modexpcrt; /* MOD EXP CRT requests */ | 247 | u_int32_t hst_modexpcrt; /* MOD EXP CRT requests */ | |
242 | }; | 248 | }; | |
249 | ||||
250 | #endif /* _DEV_PCI_UBSECVAR_H */ |