1178786Skmacy/**************************************************************************
2178786Skmacy
3178786SkmacyCopyright (c) 2007, 2008 Chelsio Inc.
4178786SkmacyAll rights reserved.
5178786Skmacy
6178786SkmacyRedistribution and use in source and binary forms, with or without
7178786Skmacymodification, are permitted provided that the following conditions are met:
8178786Skmacy
9178786Skmacy 1. Redistributions of source code must retain the above copyright notice,
10178786Skmacy    this list of conditions and the following disclaimer.
11178786Skmacy
12178786Skmacy 2. Neither the name of the Chelsio Corporation nor the names of its
13178786Skmacy    contributors may be used to endorse or promote products derived from
14178786Skmacy    this software without specific prior written permission.
15178786Skmacy
16178786SkmacyTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17178786SkmacyAND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18178786SkmacyIMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19178786SkmacyARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
20178786SkmacyLIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21178786SkmacyCONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22178786SkmacySUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23178786SkmacyINTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24178786SkmacyCONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25178786SkmacyARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26178786SkmacyPOSSIBILITY OF SUCH DAMAGE.
27178786Skmacy
28178786Skmacy$FreeBSD$
29178786Skmacy
30178786Skmacy***************************************************************************/
31178786Skmacy#ifndef __CXIO_RESOURCE_H__
32178786Skmacy#define __CXIO_RESOURCE_H__
33178786Skmacy
34178786Skmacyextern int cxio_hal_init_rhdl_resource(u32 nr_rhdl);
35178786Skmacyextern void cxio_hal_destroy_rhdl_resource(void);
36178786Skmacyextern int cxio_hal_init_resource(struct cxio_rdev *rdev_p,
37178786Skmacy				  u32 nr_tpt, u32 nr_pbl,
38178786Skmacy				  u32 nr_rqt, u32 nr_qpid, u32 nr_cqid,
39178786Skmacy				  u32 nr_pdid);
40178786Skmacyextern u32 cxio_hal_get_stag(struct cxio_hal_resource *rscp);
41178786Skmacyextern void cxio_hal_put_stag(struct cxio_hal_resource *rscp, u32 stag);
42178786Skmacyextern u32 cxio_hal_get_qpid(struct cxio_hal_resource *rscp);
43178786Skmacyextern void cxio_hal_put_qpid(struct cxio_hal_resource *rscp, u32 qpid);
44178786Skmacyextern u32 cxio_hal_get_cqid(struct cxio_hal_resource *rscp);
45178786Skmacyextern void cxio_hal_put_cqid(struct cxio_hal_resource *rscp, u32 cqid);
46178786Skmacyextern void cxio_hal_destroy_resource(struct cxio_hal_resource *rscp);
47178786Skmacy
48178786Skmacy#define PBL_OFF(rdev_p, a) ( (a) - (rdev_p)->rnic_info.pbl_base )
49178786Skmacyextern int cxio_hal_pblpool_create(struct cxio_rdev *rdev_p);
50178786Skmacyextern void cxio_hal_pblpool_destroy(struct cxio_rdev *rdev_p);
51178786Skmacyextern u32 cxio_hal_pblpool_alloc(struct cxio_rdev *rdev_p, int size);
52178786Skmacyextern void cxio_hal_pblpool_free(struct cxio_rdev *rdev_p, u32 addr, int size);
53178786Skmacy
54178786Skmacy#define RQT_OFF(rdev_p, a) ( (a) - (rdev_p)->rnic_info.rqt_base )
55178786Skmacyextern int cxio_hal_rqtpool_create(struct cxio_rdev *rdev_p);
56178786Skmacyextern void cxio_hal_rqtpool_destroy(struct cxio_rdev *rdev_p);
57178786Skmacyextern u32 cxio_hal_rqtpool_alloc(struct cxio_rdev *rdev_p, int size);
58178786Skmacyextern void cxio_hal_rqtpool_free(struct cxio_rdev *rdev_p, u32 addr, int size);
59178786Skmacy#endif
60