xref: /openbmc/linux/drivers/crypto/cavium/zip/zip_mem.h (revision a976c2951d8f376112361830aa7762beff83a205)
1*640035a2SMahipal Challa /***********************license start************************************
2*640035a2SMahipal Challa  * Copyright (c) 2003-2017 Cavium, Inc.
3*640035a2SMahipal Challa  * All rights reserved.
4*640035a2SMahipal Challa  *
5*640035a2SMahipal Challa  * License: one of 'Cavium License' or 'GNU General Public License Version 2'
6*640035a2SMahipal Challa  *
7*640035a2SMahipal Challa  * This file is provided under the terms of the Cavium License (see below)
8*640035a2SMahipal Challa  * or under the terms of GNU General Public License, Version 2, as
9*640035a2SMahipal Challa  * published by the Free Software Foundation. When using or redistributing
10*640035a2SMahipal Challa  * this file, you may do so under either license.
11*640035a2SMahipal Challa  *
12*640035a2SMahipal Challa  * Cavium License:  Redistribution and use in source and binary forms, with
13*640035a2SMahipal Challa  * or without modification, are permitted provided that the following
14*640035a2SMahipal Challa  * conditions are met:
15*640035a2SMahipal Challa  *
16*640035a2SMahipal Challa  *  * Redistributions of source code must retain the above copyright
17*640035a2SMahipal Challa  *    notice, this list of conditions and the following disclaimer.
18*640035a2SMahipal Challa  *
19*640035a2SMahipal Challa  *  * Redistributions in binary form must reproduce the above
20*640035a2SMahipal Challa  *    copyright notice, this list of conditions and the following
21*640035a2SMahipal Challa  *    disclaimer in the documentation and/or other materials provided
22*640035a2SMahipal Challa  *    with the distribution.
23*640035a2SMahipal Challa  *
24*640035a2SMahipal Challa  *  * Neither the name of Cavium Inc. nor the names of its contributors may be
25*640035a2SMahipal Challa  *    used to endorse or promote products derived from this software without
26*640035a2SMahipal Challa  *    specific prior written permission.
27*640035a2SMahipal Challa  *
28*640035a2SMahipal Challa  * This Software, including technical data, may be subject to U.S. export
29*640035a2SMahipal Challa  * control laws, including the U.S. Export Administration Act and its
30*640035a2SMahipal Challa  * associated regulations, and may be subject to export or import
31*640035a2SMahipal Challa  * regulations in other countries.
32*640035a2SMahipal Challa  *
33*640035a2SMahipal Challa  * TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS"
34*640035a2SMahipal Challa  * AND WITH ALL FAULTS AND CAVIUM INC. MAKES NO PROMISES, REPRESENTATIONS
35*640035a2SMahipal Challa  * OR WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH
36*640035a2SMahipal Challa  * RESPECT TO THE SOFTWARE, INCLUDING ITS CONDITION, ITS CONFORMITY TO ANY
37*640035a2SMahipal Challa  * REPRESENTATION OR DESCRIPTION, OR THE EXISTENCE OF ANY LATENT OR PATENT
38*640035a2SMahipal Challa  * DEFECTS, AND CAVIUM SPECIFICALLY DISCLAIMS ALL IMPLIED (IF ANY)
39*640035a2SMahipal Challa  * WARRANTIES OF TITLE, MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A
40*640035a2SMahipal Challa  * PARTICULAR PURPOSE, LACK OF VIRUSES, ACCURACY OR COMPLETENESS, QUIET
41*640035a2SMahipal Challa  * ENJOYMENT, QUIET POSSESSION OR CORRESPONDENCE TO DESCRIPTION. THE
42*640035a2SMahipal Challa  * ENTIRE  RISK ARISING OUT OF USE OR PERFORMANCE OF THE SOFTWARE LIES
43*640035a2SMahipal Challa  * WITH YOU.
44*640035a2SMahipal Challa  ***********************license end**************************************/
45*640035a2SMahipal Challa 
46*640035a2SMahipal Challa #ifndef __ZIP_MEM_H__
47*640035a2SMahipal Challa #define __ZIP_MEM_H__
48*640035a2SMahipal Challa 
49*640035a2SMahipal Challa /**
50*640035a2SMahipal Challa  * zip_cmd_qbuf_free - Frees the cmd Queue buffer
51*640035a2SMahipal Challa  * @zip: Pointer to zip device structure
52*640035a2SMahipal Challa  * @q:   Queue nmber to free buffer of
53*640035a2SMahipal Challa  */
54*640035a2SMahipal Challa void zip_cmd_qbuf_free(struct zip_device *zip, int q);
55*640035a2SMahipal Challa 
56*640035a2SMahipal Challa /**
57*640035a2SMahipal Challa  * zip_cmd_qbuf_alloc - Allocates a Chunk/cmd buffer for ZIP Inst(cmd) Queue
58*640035a2SMahipal Challa  * @zip: Pointer to zip device structure
59*640035a2SMahipal Challa  * @q:   Queue number to allocate bufffer to
60*640035a2SMahipal Challa  * Return: 0 if successful, 1 otherwise
61*640035a2SMahipal Challa  */
62*640035a2SMahipal Challa int zip_cmd_qbuf_alloc(struct zip_device *zip, int q);
63*640035a2SMahipal Challa 
64*640035a2SMahipal Challa /**
65*640035a2SMahipal Challa  * zip_data_buf_alloc - Allocates memory for a data bufffer
66*640035a2SMahipal Challa  * @size:   Size of the buffer to allocate
67*640035a2SMahipal Challa  * Returns: Pointer to the buffer allocated
68*640035a2SMahipal Challa  */
69*640035a2SMahipal Challa u8 *zip_data_buf_alloc(u64 size);
70*640035a2SMahipal Challa 
71*640035a2SMahipal Challa /**
72*640035a2SMahipal Challa  * zip_data_buf_free - Frees the memory of a data buffer
73*640035a2SMahipal Challa  * @ptr:  Pointer to the buffer
74*640035a2SMahipal Challa  * @size: Buffer size
75*640035a2SMahipal Challa  */
76*640035a2SMahipal Challa void zip_data_buf_free(u8 *ptr, u64 size);
77*640035a2SMahipal Challa 
78*640035a2SMahipal Challa #endif
79