1/*-
2 * Copyright (c) 2003-2012 Broadcom Corporation
3 * All Rights Reserved
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *
9 * 1. Redistributions of source code must retain the above copyright
10 *    notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 *    notice, this list of conditions and the following disclaimer in
13 *    the documentation and/or other materials provided with the
14 *    distribution.
15 *
16 * THIS SOFTWARE IS PROVIDED BY BROADCOM ``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
19 * ARE DISCLAIMED. IN NO EVENT SHALL BROADCOM OR CONTRIBUTORS BE LIABLE
20 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
23 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
24 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
25 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
26 * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
28 * $FreeBSD: releng/10.3/sys/mips/nlm/dev/sec/nlmrsalib.h 256045 2013-10-04 10:01:20Z jchandra $
29 */
30#ifndef _NLMRSALIB_H_
31#define _NLMRSALIB_H_
32
33#define	XLP_RSA_SESSION(sid)	((sid) & 0x000007ff)
34#define	XLP_RSA_SID(crd,ses)	(((crd) << 28) | ((ses) & 0x7ff))
35
36#define	RSA_ERROR(msg0)		(((msg0) >> 53) & 0x1f)
37
38struct xlp_rsa_session {
39	uint32_t sessionid;
40	int hs_used;
41};
42
43struct xlp_rsa_command {
44	uint16_t session_num;
45	struct xlp_rsa_session *ses;
46	struct cryptkop *krp;
47	uint8_t *rsasrc;
48	uint32_t rsaopsize;
49	uint32_t rsatype;
50	uint32_t rsafn;
51};
52
53/*
54 * Holds data specific to nlm security accelerators
55 */
56struct xlp_rsa_softc {
57	device_t sc_dev;	/* device backpointer */
58	uint64_t rsa_base;
59	int sc_cid;
60	struct xlp_rsa_session *sc_sessions;
61	int sc_nsessions;
62	int rsaecc_vc_start;
63	int rsaecc_vc_end;
64};
65
66void
67nlm_xlprsaecc_msgring_handler(int vc, int size, int code, int src_id,
68    struct nlm_fmn_msg *msg, void *data);
69
70#endif /* _NLMRSALIB_H_ */
71