1 /**********************************************************************
3 * Copyright(c) 2008 Imagination Technologies Ltd. All rights reserved.
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms and conditions of the GNU General Public License,
7 * version 2, as published by the Free Software Foundation.
9 * This program is distributed in the hope it will be useful but, except
10 * as otherwise stated in writing, without any warranty; without even the
11 * implied warranty of merchantability or fitness for a particular purpose.
12 * See the GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License along with
15 * this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
18 * The full GNU General Public License is included in this distribution in
19 * the file called "COPYING".
21 * Contact Information:
22 * Imagination Technologies Ltd. <gpl-support@imgtec.com>
23 * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK
25 ******************************************************************************/
30 #include "img_types.h"
39 struct RA_STATISTICS {
41 u32 uLiveSegmentCount;
42 u32 uFreeSegmentCount;
43 u32 uTotalResourceCount;
44 u32 uFreeResourceCount;
45 u32 uCumulativeAllocs;
52 struct RA_SEGMENT_DETAILS {
54 struct IMG_CPU_PHYADDR sCpuPhyAddr;
57 struct RA_SEGMENT_DETAILS;
59 struct RA_ARENA *RA_Create(char *name, u32 base, size_t uSize,
60 struct BM_MAPPING *psMapping, size_t uQuantum,
61 IMG_BOOL(*imp_alloc)(void *_h, size_t uSize,
63 struct BM_MAPPING **ppsMapping,
64 u32 uFlags, u32 *pBase),
65 void (*imp_free)(void *, u32, struct BM_MAPPING *),
66 void (*backingstore_free)(void *, u32, u32, void *),
69 void RA_Delete(struct RA_ARENA *pArena);
71 IMG_BOOL RA_TestDelete(struct RA_ARENA *pArena);
73 IMG_BOOL RA_Add(struct RA_ARENA *pArena, u32 base, size_t uSize);
75 IMG_BOOL RA_Alloc(struct RA_ARENA *pArena, size_t uSize,
76 struct BM_MAPPING **ppsMapping, u32 uFlags, u32 uAlignment,
79 void RA_Free(struct RA_ARENA *pArena, u32 base, IMG_BOOL bFreeBackingStore);
83 #define CHECK_SPACE(total) \
86 return PVRSRV_ERROR_INVALID_PARAMS; \
89 #define UPDATE_SPACE(str, count, total) \
92 return PVRSRV_ERROR_INVALID_PARAMS; \
99 IMG_BOOL RA_GetNextLiveSegment(void *hArena,
100 struct RA_SEGMENT_DETAILS *psSegDetails);
102 enum PVRSRV_ERROR RA_GetStats(struct RA_ARENA *pArena, char **ppszStr,