98 printf(
"___sym_malloc(%d) = %p\n", size, (
void *) a);
106 static void ___sym_mfree(
m_pool_p mp,
void *
ptr,
int size)
115 printf(
"___sym_mfree(%p, %d)\n", ptr, size);
126 a = (
unsigned long)ptr;
130 #ifdef SYM_MEM_FREE_UNUSED
158 static void *__sym_calloc2(
m_pool_p mp,
int size,
char *
name,
int uflags)
162 p = ___sym_malloc(mp, size);
165 printf (
"new %-10s[%4d] @%p.\n", name, size, p);
171 printf (
"__sym_calloc2: failed to allocate %s[%d]\n", name, size);
174 #define __sym_calloc(mp, s, n) __sym_calloc2(mp, s, n, SYM_MEM_WARN)
179 static void __sym_mfree(
m_pool_p mp,
void *ptr,
int size,
char *name)
182 printf (
"freeing %-10s[%4d] @%p.\n", name, size, ptr);
184 ___sym_mfree(mp, ptr, size);
193 static void *___mp0_get_mem_cluster(
m_pool_p mp)
201 #ifdef SYM_MEM_FREE_UNUSED
202 static void ___mp0_free_mem_cluster(
m_pool_p mp,
void *m)
208 #define ___mp0_free_mem_cluster NULL
213 ___mp0_get_mem_cluster,
214 ___mp0_free_mem_cluster
223 static void * ___get_dma_mem_cluster(
m_pool_p mp)
232 vaddr = sym_m_get_dma_mem_cluster(mp, vbp);
244 #ifdef SYM_MEM_FREE_UNUSED
246 static void ___free_dma_mem_cluster(
m_pool_p mp,
void *m)
251 vbpp = &mp->
vtob[hc];
252 while (*vbpp && (*vbpp)->
vaddr != m)
253 vbpp = &(*vbpp)->
next;
256 *vbpp = (*vbpp)->
next;
257 sym_m_free_dma_mem_cluster(mp, vbp);
258 __sym_mfree(&mp0, vbp,
sizeof(*vbp),
"VTOB");
281 #ifdef SYM_MEM_FREE_UNUSED
291 #ifdef SYM_MEM_FREE_UNUSED
293 static void ___del_dma_pool(
m_pool_p p)
297 while (*pp && *pp != p)
301 __sym_mfree(&mp0, p,
sizeof(*p),
"MPOOL");
319 mp = ___get_dma_pool(dev_dmat);
321 mp = ___cre_dma_pool(dev_dmat);
325 #ifdef SYM_MEM_FREE_UNUSED
331 spin_unlock_irqrestore(&sym53c8xx_lock, flags);
341 mp = ___get_dma_pool(dev_dmat);
344 __sym_mfree(mp, m, size, name);
345 #ifdef SYM_MEM_FREE_UNUSED
350 spin_unlock_irqrestore(&sym53c8xx_lock, flags);
367 mp = ___get_dma_pool(dev_dmat);
370 while (vp && vp->
vaddr != a)
374 panic(
"sym: VTOBUS FAILED!\n");
376 spin_unlock_irqrestore(&sym53c8xx_lock, flags);