1/**************************************************************************
2
3Copyright (c) 2007, 2008 Chelsio Inc.
4All rights reserved.
5
6Redistribution and use in source and binary forms, with or without
7modification, are permitted provided that the following conditions are met:
8
9 1. Redistributions of source code must retain the above copyright notice,
10    this list of conditions and the following disclaimer.
11
12 2. Neither the name of the Chelsio Corporation nor the names of its
13    contributors may be used to endorse or promote products derived from
14    this software without specific prior written permission.
15
16THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
20LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26POSSIBILITY OF SUCH DAMAGE.
27
28$FreeBSD: releng/10.3/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_resource.h 178786 2008-05-05 18:46:18Z kmacy $
29
30***************************************************************************/
31#ifndef __CXIO_RESOURCE_H__
32#define __CXIO_RESOURCE_H__
33
34extern int cxio_hal_init_rhdl_resource(u32 nr_rhdl);
35extern void cxio_hal_destroy_rhdl_resource(void);
36extern int cxio_hal_init_resource(struct cxio_rdev *rdev_p,
37				  u32 nr_tpt, u32 nr_pbl,
38				  u32 nr_rqt, u32 nr_qpid, u32 nr_cqid,
39				  u32 nr_pdid);
40extern u32 cxio_hal_get_stag(struct cxio_hal_resource *rscp);
41extern void cxio_hal_put_stag(struct cxio_hal_resource *rscp, u32 stag);
42extern u32 cxio_hal_get_qpid(struct cxio_hal_resource *rscp);
43extern void cxio_hal_put_qpid(struct cxio_hal_resource *rscp, u32 qpid);
44extern u32 cxio_hal_get_cqid(struct cxio_hal_resource *rscp);
45extern void cxio_hal_put_cqid(struct cxio_hal_resource *rscp, u32 cqid);
46extern void cxio_hal_destroy_resource(struct cxio_hal_resource *rscp);
47
48#define PBL_OFF(rdev_p, a) ( (a) - (rdev_p)->rnic_info.pbl_base )
49extern int cxio_hal_pblpool_create(struct cxio_rdev *rdev_p);
50extern void cxio_hal_pblpool_destroy(struct cxio_rdev *rdev_p);
51extern u32 cxio_hal_pblpool_alloc(struct cxio_rdev *rdev_p, int size);
52extern void cxio_hal_pblpool_free(struct cxio_rdev *rdev_p, u32 addr, int size);
53
54#define RQT_OFF(rdev_p, a) ( (a) - (rdev_p)->rnic_info.rqt_base )
55extern int cxio_hal_rqtpool_create(struct cxio_rdev *rdev_p);
56extern void cxio_hal_rqtpool_destroy(struct cxio_rdev *rdev_p);
57extern u32 cxio_hal_rqtpool_alloc(struct cxio_rdev *rdev_p, int size);
58extern void cxio_hal_rqtpool_free(struct cxio_rdev *rdev_p, u32 addr, int size);
59#endif
60