• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /netgear-R7800-V1.0.2.28/target/linux/generic/files/crypto/ocf/kirkwood/mvHal/common/
1/*******************************************************************************
2Copyright (C) Marvell International Ltd. and its affiliates
3
4This software file (the "File") is owned and distributed by Marvell
5International Ltd. and/or its affiliates ("Marvell") under the following
6alternative licensing terms.  Once you have made an election to distribute the
7File under one of the following license alternatives, please (i) delete this
8introductory statement regarding license alternatives, (ii) delete the two
9license alternatives that you have not elected to use and (iii) preserve the
10Marvell copyright notice above.
11
12********************************************************************************
13Marvell Commercial License Option
14
15If you received this File from Marvell and you have entered into a commercial
16license agreement (a "Commercial License") with Marvell, the File is licensed
17to you under the terms of the applicable Commercial License.
18
19********************************************************************************
20Marvell GPL License Option
21
22If you received this File from Marvell, you may opt to use, redistribute and/or
23modify this File in accordance with the terms and conditions of the General
24Public License Version 2, June 1991 (the "GPL License"), a copy of which is
25available along with the File in the license.txt file or by writing to the Free
26Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 or
27on the worldwide web at http://www.gnu.org/licenses/gpl.txt.
28
29THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE IMPLIED
30WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE ARE EXPRESSLY
31DISCLAIMED.  The GPL License provides additional details about this warranty
32disclaimer.
33********************************************************************************
34Marvell BSD License Option
35
36If you received this File from Marvell, you may opt to use, redistribute and/or
37modify this File under the following licensing terms.
38Redistribution and use in source and binary forms, with or without modification,
39are permitted provided that the following conditions are met:
40
41    *   Redistributions of source code must retain the above copyright notice,
42	    this list of conditions and the following disclaimer.
43
44    *   Redistributions in binary form must reproduce the above copyright
45        notice, this list of conditions and the following disclaimer in the
46        documentation and/or other materials provided with the distribution.
47
48    *   Neither the name of Marvell nor the names of its contributors may be
49        used to endorse or promote products derived from this software without
50        specific prior written permission.
51
52THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
53ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
54WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
55DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
56ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
57(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
58LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
59ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
60(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
61SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
62
63*******************************************************************************/
64
65
66#ifndef __INCmvTypesh
67#define __INCmvTypesh
68
69/* Defines */
70
71/* The following is a list of Marvell status    */
72#define MV_ERROR		    (-1)
73#define MV_OK			    (0x00)  /* Operation succeeded                   */
74#define MV_FAIL			    (0x01)	/* Operation failed                      */
75#define MV_BAD_VALUE        (0x02)  /* Illegal value (general)               */
76#define MV_OUT_OF_RANGE     (0x03)  /* The value is out of range             */
77#define MV_BAD_PARAM        (0x04)  /* Illegal parameter in function called  */
78#define MV_BAD_PTR          (0x05)  /* Illegal pointer value                 */
79#define MV_BAD_SIZE         (0x06)  /* Illegal size                          */
80#define MV_BAD_STATE        (0x07)  /* Illegal state of state machine        */
81#define MV_SET_ERROR        (0x08)  /* Set operation failed                  */
82#define MV_GET_ERROR        (0x09)  /* Get operation failed                  */
83#define MV_CREATE_ERROR     (0x0A)  /* Fail while creating an item           */
84#define MV_NOT_FOUND        (0x0B)  /* Item not found                        */
85#define MV_NO_MORE          (0x0C)  /* No more items found                   */
86#define MV_NO_SUCH          (0x0D)  /* No such item                          */
87#define MV_TIMEOUT          (0x0E)  /* Time Out                              */
88#define MV_NO_CHANGE        (0x0F)  /* Parameter(s) is already in this value */
89#define MV_NOT_SUPPORTED    (0x10)  /* This request is not support           */
90#define MV_NOT_IMPLEMENTED  (0x11)  /* Request supported but not implemented */
91#define MV_NOT_INITIALIZED  (0x12)  /* The item is not initialized           */
92#define MV_NO_RESOURCE      (0x13)  /* Resource not available (memory ...)   */
93#define MV_FULL             (0x14)  /* Item is full (Queue or table etc...)  */
94#define MV_EMPTY            (0x15)  /* Item is empty (Queue or table etc...) */
95#define MV_INIT_ERROR       (0x16)  /* Error occured while INIT process      */
96#define MV_HW_ERROR         (0x17)  /* Hardware error                        */
97#define MV_TX_ERROR         (0x18)  /* Transmit operation not succeeded      */
98#define MV_RX_ERROR         (0x19)  /* Recieve operation not succeeded       */
99#define MV_NOT_READY	    (0x1A)	/* The other side is not ready yet       */
100#define MV_ALREADY_EXIST    (0x1B)  /* Tried to create existing item         */
101#define MV_OUT_OF_CPU_MEM   (0x1C)  /* Cpu memory allocation failed.         */
102#define MV_NOT_STARTED      (0x1D)  /* Not started yet         */
103#define MV_BUSY             (0x1E)  /* Item is busy.                         */
104#define MV_TERMINATE        (0x1F)  /* Item terminates it's work.            */
105#define MV_NOT_ALIGNED      (0x20)  /* Wrong alignment                       */
106#define MV_NOT_ALLOWED      (0x21)  /* Operation NOT allowed                 */
107#define MV_WRITE_PROTECT    (0x22)  /* Write protected                       */
108
109
110#define MV_INVALID  (int)(-1)
111
112#define MV_FALSE	0
113#define MV_TRUE     (!(MV_FALSE))
114
115
116#ifndef NULL
117#define NULL ((void*)0)
118#endif
119
120
121#ifndef MV_ASMLANGUAGE
122/* typedefs */
123
124typedef char  MV_8;
125typedef unsigned char	MV_U8;
126
127typedef int		MV_32;
128typedef unsigned int	MV_U32;
129
130typedef short		MV_16;
131typedef unsigned short	MV_U16;
132
133#ifdef MV_PPC64
134typedef long		MV_64;
135typedef unsigned long	MV_U64;
136#else
137typedef long long		MV_64;
138typedef unsigned long long	MV_U64;
139#endif
140
141typedef long		MV_LONG;	/* 32/64 */
142typedef unsigned long	MV_ULONG;	/* 32/64 */
143
144typedef int     MV_STATUS;
145typedef int     MV_BOOL;
146typedef void    MV_VOID;
147typedef float   MV_FLOAT;
148
149typedef int 	(*MV_FUNCPTR) (void);	  /* ptr to function returning int   */
150typedef void 	(*MV_VOIDFUNCPTR) (void); /* ptr to function returning void  */
151typedef double 	(*MV_DBLFUNCPTR) (void);  /* ptr to function returning double*/
152typedef float 	(*MV_FLTFUNCPTR) (void);  /* ptr to function returning float */
153
154typedef MV_U32 MV_KHZ;
155typedef MV_U32 MV_MHZ;
156typedef MV_U32 MV_HZ;
157
158
159/* This enumerator describes the set of commands that can be applied on   	*/
160/* an engine (e.g. IDMA, XOR). Appling a comman depends on the current   	*/
161/* status (see MV_STATE enumerator)                      					*/
162/* Start can be applied only when status is IDLE                         */
163/* Stop can be applied only when status is IDLE, ACTIVE or PAUSED        */
164/* Pause can be applied only when status is ACTIVE                          */
165/* Restart can be applied only when status is PAUSED                        */
166typedef enum _mvCommand
167{
168    MV_START,              /* Start	*/
169    MV_STOP,               /* Stop     */
170    MV_PAUSE,              /* Pause    */
171    MV_RESTART             /* Restart  */
172} MV_COMMAND;
173
174/* This enumerator describes the set of state conditions.					*/
175/* Moving from one state to other is stricted.   							*/
176typedef enum _mvState
177{
178    MV_IDLE,
179    MV_ACTIVE,
180    MV_PAUSED,
181    MV_UNDEFINED_STATE
182} MV_STATE;
183
184
185/* This structure describes address space window. Window base can be        */
186/* 64 bit, window size up to 4GB                                            */
187typedef struct _mvAddrWin
188{
189    MV_U32      baseLow;    /* 32bit base low       */
190    MV_U32      baseHigh;   /* 32bit base high      */
191    MV_U32      size;       /* 32bit size           */
192}MV_ADDR_WIN;
193
194/* This binary enumerator describes protection attribute status             */
195typedef enum _mvProtRight
196{
197    ALLOWED,        /* Protection attribute allowed                         */
198    FORBIDDEN       /* Protection attribute forbidden                       */
199}MV_PROT_RIGHT;
200
201/* Unified struct for Rx and Tx packet operations. The user is required to 	*/
202/* be familier only with Tx/Rx descriptor command status.               	*/
203typedef struct _bufInfo
204{
205    MV_U32   cmdSts;        /* Tx/Rx command status                                     */
206        MV_U16   byteCnt;       /* Size of valid data in the buffer     */
207    MV_U16   bufSize;       /* Total size of the buffer             */
208    MV_U8    *pBuff;            /* Pointer to Buffer                    */
209    MV_U8    *pData;            /* Pointer to data in the Buffer        */
210    MV_U32   userInfo1;         /* Tx/Rx attached user information 1    */
211    MV_U32   userInfo2;         /* Tx/Rx attached user information 2    */
212    struct _bufInfo *pNextBufInfo;  /* Next buffer in packet            */
213} BUF_INFO;
214
215/* This structure contains information describing one of buffers
216 * (fragments) they are built Ethernet packet.
217 */
218typedef struct
219{
220     MV_U8*	    bufVirtPtr;
221     MV_ULONG	bufPhysAddr;
222     MV_U32   	bufSize;
223     MV_U32     dataSize;
224     MV_U32		memHandle;
225	 MV_32      bufAddrShift;
226} MV_BUF_INFO;
227
228/* This structure contains information describing Ethernet packet.
229 * The packet can be divided for few buffers (fragments)
230 */
231typedef struct
232{
233    MV_ULONG   	osInfo;
234    MV_BUF_INFO *pFrags;
235    MV_U32      status;
236    MV_U16      pktSize;
237    MV_U16      numFrags;
238    MV_U32      ownerId;
239    MV_U32      fragIP;
240} MV_PKT_INFO;
241
242#endif /* MV_ASMLANGUAGE */
243
244#endif /* __INCmvTypesh */
245
246