Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
Jaroslav Kysela | c1017a4 | 2007-10-15 09:50:19 +0200 | [diff] [blame] | 2 | * Copyright (c) by Jaroslav Kysela <perex@perex.cz> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3 | * GUS's memory allocation routines / bottom layer |
| 4 | * |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License as published by |
| 8 | * the Free Software Foundation; either version 2 of the License, or |
| 9 | * (at your option) any later version. |
| 10 | * |
| 11 | * This program is distributed in the hope that it will be useful, |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | * GNU General Public License for more details. |
| 15 | * |
| 16 | * You should have received a copy of the GNU General Public License |
| 17 | * along with this program; if not, write to the Free Software |
| 18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 19 | * |
| 20 | */ |
| 21 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 22 | #include <linux/slab.h> |
Paulo Marques | 543537b | 2005-06-23 00:09:02 -0700 | [diff] [blame] | 23 | #include <linux/string.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 24 | #include <sound/core.h> |
| 25 | #include <sound/gus.h> |
| 26 | #include <sound/info.h> |
| 27 | |
| 28 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | 5e2da20 | 2005-11-17 14:36:44 +0100 | [diff] [blame] | 29 | static void snd_gf1_mem_info_read(struct snd_info_entry *entry, |
| 30 | struct snd_info_buffer *buffer); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 31 | #endif |
| 32 | |
Takashi Iwai | 5e2da20 | 2005-11-17 14:36:44 +0100 | [diff] [blame] | 33 | void snd_gf1_mem_lock(struct snd_gf1_mem * alloc, int xup) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 34 | { |
| 35 | if (!xup) { |
Ingo Molnar | 8b7547f | 2006-01-16 16:33:08 +0100 | [diff] [blame] | 36 | mutex_lock(&alloc->memory_mutex); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 37 | } else { |
Ingo Molnar | 8b7547f | 2006-01-16 16:33:08 +0100 | [diff] [blame] | 38 | mutex_unlock(&alloc->memory_mutex); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 39 | } |
| 40 | } |
| 41 | |
Takashi Iwai | 5e2da20 | 2005-11-17 14:36:44 +0100 | [diff] [blame] | 42 | static struct snd_gf1_mem_block *snd_gf1_mem_xalloc(struct snd_gf1_mem * alloc, |
| 43 | struct snd_gf1_mem_block * block) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 44 | { |
Takashi Iwai | 5e2da20 | 2005-11-17 14:36:44 +0100 | [diff] [blame] | 45 | struct snd_gf1_mem_block *pblock, *nblock; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 46 | |
Takashi Iwai | 5e2da20 | 2005-11-17 14:36:44 +0100 | [diff] [blame] | 47 | nblock = kmalloc(sizeof(struct snd_gf1_mem_block), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 48 | if (nblock == NULL) |
| 49 | return NULL; |
| 50 | *nblock = *block; |
| 51 | pblock = alloc->first; |
| 52 | while (pblock) { |
| 53 | if (pblock->ptr > nblock->ptr) { |
| 54 | nblock->prev = pblock->prev; |
| 55 | nblock->next = pblock; |
| 56 | pblock->prev = nblock; |
| 57 | if (pblock == alloc->first) |
| 58 | alloc->first = nblock; |
| 59 | else |
| 60 | nblock->prev->next = nblock; |
Ingo Molnar | 8b7547f | 2006-01-16 16:33:08 +0100 | [diff] [blame] | 61 | mutex_unlock(&alloc->memory_mutex); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 62 | return NULL; |
| 63 | } |
| 64 | pblock = pblock->next; |
| 65 | } |
| 66 | nblock->next = NULL; |
| 67 | if (alloc->last == NULL) { |
| 68 | nblock->prev = NULL; |
| 69 | alloc->first = alloc->last = nblock; |
| 70 | } else { |
| 71 | nblock->prev = alloc->last; |
| 72 | alloc->last->next = nblock; |
| 73 | alloc->last = nblock; |
| 74 | } |
| 75 | return nblock; |
| 76 | } |
| 77 | |
Takashi Iwai | 5e2da20 | 2005-11-17 14:36:44 +0100 | [diff] [blame] | 78 | int snd_gf1_mem_xfree(struct snd_gf1_mem * alloc, struct snd_gf1_mem_block * block) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 79 | { |
| 80 | if (block->share) { /* ok.. shared block */ |
| 81 | block->share--; |
Ingo Molnar | 8b7547f | 2006-01-16 16:33:08 +0100 | [diff] [blame] | 82 | mutex_unlock(&alloc->memory_mutex); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 83 | return 0; |
| 84 | } |
| 85 | if (alloc->first == block) { |
| 86 | alloc->first = block->next; |
| 87 | if (block->next) |
| 88 | block->next->prev = NULL; |
| 89 | } else { |
| 90 | block->prev->next = block->next; |
| 91 | if (block->next) |
| 92 | block->next->prev = block->prev; |
| 93 | } |
| 94 | if (alloc->last == block) { |
| 95 | alloc->last = block->prev; |
| 96 | if (block->prev) |
| 97 | block->prev->next = NULL; |
| 98 | } else { |
| 99 | block->next->prev = block->prev; |
| 100 | if (block->prev) |
| 101 | block->prev->next = block->next; |
| 102 | } |
| 103 | kfree(block->name); |
| 104 | kfree(block); |
| 105 | return 0; |
| 106 | } |
| 107 | |
Takashi Iwai | 5e2da20 | 2005-11-17 14:36:44 +0100 | [diff] [blame] | 108 | static struct snd_gf1_mem_block *snd_gf1_mem_look(struct snd_gf1_mem * alloc, |
Adrian Bunk | 209ac85 | 2005-05-23 10:29:53 +0200 | [diff] [blame] | 109 | unsigned int address) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 110 | { |
Takashi Iwai | 5e2da20 | 2005-11-17 14:36:44 +0100 | [diff] [blame] | 111 | struct snd_gf1_mem_block *block; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 112 | |
| 113 | for (block = alloc->first; block; block = block->next) { |
| 114 | if (block->ptr == address) { |
| 115 | return block; |
| 116 | } |
| 117 | } |
| 118 | return NULL; |
| 119 | } |
| 120 | |
Takashi Iwai | 5e2da20 | 2005-11-17 14:36:44 +0100 | [diff] [blame] | 121 | static struct snd_gf1_mem_block *snd_gf1_mem_share(struct snd_gf1_mem * alloc, |
Adrian Bunk | 209ac85 | 2005-05-23 10:29:53 +0200 | [diff] [blame] | 122 | unsigned int *share_id) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 123 | { |
Takashi Iwai | 5e2da20 | 2005-11-17 14:36:44 +0100 | [diff] [blame] | 124 | struct snd_gf1_mem_block *block; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 125 | |
| 126 | if (!share_id[0] && !share_id[1] && |
| 127 | !share_id[2] && !share_id[3]) |
| 128 | return NULL; |
| 129 | for (block = alloc->first; block; block = block->next) |
| 130 | if (!memcmp(share_id, block->share_id, sizeof(share_id))) |
| 131 | return block; |
| 132 | return NULL; |
| 133 | } |
| 134 | |
Takashi Iwai | 5e2da20 | 2005-11-17 14:36:44 +0100 | [diff] [blame] | 135 | static int snd_gf1_mem_find(struct snd_gf1_mem * alloc, |
| 136 | struct snd_gf1_mem_block * block, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 137 | unsigned int size, int w_16, int align) |
| 138 | { |
Takashi Iwai | 5e2da20 | 2005-11-17 14:36:44 +0100 | [diff] [blame] | 139 | struct snd_gf1_bank_info *info = w_16 ? alloc->banks_16 : alloc->banks_8; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 140 | unsigned int idx, boundary; |
| 141 | int size1; |
Takashi Iwai | 5e2da20 | 2005-11-17 14:36:44 +0100 | [diff] [blame] | 142 | struct snd_gf1_mem_block *pblock; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 143 | unsigned int ptr1, ptr2; |
| 144 | |
Clemens Ladisch | 7ab3992 | 2006-10-09 08:13:32 +0200 | [diff] [blame] | 145 | if (w_16 && align < 2) |
| 146 | align = 2; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 147 | block->flags = w_16 ? SNDRV_GF1_MEM_BLOCK_16BIT : 0; |
| 148 | block->owner = SNDRV_GF1_MEM_OWNER_DRIVER; |
| 149 | block->share = 0; |
| 150 | block->share_id[0] = block->share_id[1] = |
| 151 | block->share_id[2] = block->share_id[3] = 0; |
| 152 | block->name = NULL; |
| 153 | block->prev = block->next = NULL; |
| 154 | for (pblock = alloc->first, idx = 0; pblock; pblock = pblock->next) { |
| 155 | while (pblock->ptr >= (boundary = info[idx].address + info[idx].size)) |
| 156 | idx++; |
| 157 | while (pblock->ptr + pblock->size >= (boundary = info[idx].address + info[idx].size)) |
| 158 | idx++; |
| 159 | ptr2 = boundary; |
| 160 | if (pblock->next) { |
| 161 | if (pblock->ptr + pblock->size == pblock->next->ptr) |
| 162 | continue; |
| 163 | if (pblock->next->ptr < boundary) |
| 164 | ptr2 = pblock->next->ptr; |
| 165 | } |
Clemens Ladisch | 7ab3992 | 2006-10-09 08:13:32 +0200 | [diff] [blame] | 166 | ptr1 = ALIGN(pblock->ptr + pblock->size, align); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 167 | if (ptr1 >= ptr2) |
| 168 | continue; |
| 169 | size1 = ptr2 - ptr1; |
| 170 | if ((int)size <= size1) { |
| 171 | block->ptr = ptr1; |
| 172 | block->size = size; |
| 173 | return 0; |
| 174 | } |
| 175 | } |
| 176 | while (++idx < 4) { |
| 177 | if (size <= info[idx].size) { |
| 178 | /* I assume that bank address is already aligned.. */ |
| 179 | block->ptr = info[idx].address; |
| 180 | block->size = size; |
| 181 | return 0; |
| 182 | } |
| 183 | } |
| 184 | return -ENOMEM; |
| 185 | } |
| 186 | |
Takashi Iwai | 5e2da20 | 2005-11-17 14:36:44 +0100 | [diff] [blame] | 187 | struct snd_gf1_mem_block *snd_gf1_mem_alloc(struct snd_gf1_mem * alloc, int owner, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 188 | char *name, int size, int w_16, int align, |
| 189 | unsigned int *share_id) |
| 190 | { |
Takashi Iwai | 5e2da20 | 2005-11-17 14:36:44 +0100 | [diff] [blame] | 191 | struct snd_gf1_mem_block block, *nblock; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 192 | |
| 193 | snd_gf1_mem_lock(alloc, 0); |
| 194 | if (share_id != NULL) { |
| 195 | nblock = snd_gf1_mem_share(alloc, share_id); |
| 196 | if (nblock != NULL) { |
| 197 | if (size != (int)nblock->size) { |
| 198 | /* TODO: remove in the future */ |
Takashi Iwai | 99b359b | 2005-10-20 18:26:44 +0200 | [diff] [blame] | 199 | snd_printk(KERN_ERR "snd_gf1_mem_alloc - share: sizes differ\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 200 | goto __std; |
| 201 | } |
| 202 | nblock->share++; |
| 203 | snd_gf1_mem_lock(alloc, 1); |
| 204 | return NULL; |
| 205 | } |
| 206 | } |
| 207 | __std: |
| 208 | if (snd_gf1_mem_find(alloc, &block, size, w_16, align) < 0) { |
| 209 | snd_gf1_mem_lock(alloc, 1); |
| 210 | return NULL; |
| 211 | } |
| 212 | if (share_id != NULL) |
| 213 | memcpy(&block.share_id, share_id, sizeof(block.share_id)); |
| 214 | block.owner = owner; |
Paulo Marques | 543537b | 2005-06-23 00:09:02 -0700 | [diff] [blame] | 215 | block.name = kstrdup(name, GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 216 | nblock = snd_gf1_mem_xalloc(alloc, &block); |
| 217 | snd_gf1_mem_lock(alloc, 1); |
| 218 | return nblock; |
| 219 | } |
| 220 | |
Takashi Iwai | 5e2da20 | 2005-11-17 14:36:44 +0100 | [diff] [blame] | 221 | int snd_gf1_mem_free(struct snd_gf1_mem * alloc, unsigned int address) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 222 | { |
| 223 | int result; |
Takashi Iwai | 5e2da20 | 2005-11-17 14:36:44 +0100 | [diff] [blame] | 224 | struct snd_gf1_mem_block *block; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 225 | |
| 226 | snd_gf1_mem_lock(alloc, 0); |
| 227 | if ((block = snd_gf1_mem_look(alloc, address)) != NULL) { |
| 228 | result = snd_gf1_mem_xfree(alloc, block); |
| 229 | snd_gf1_mem_lock(alloc, 1); |
| 230 | return result; |
| 231 | } |
| 232 | snd_gf1_mem_lock(alloc, 1); |
| 233 | return -EINVAL; |
| 234 | } |
| 235 | |
Takashi Iwai | 5e2da20 | 2005-11-17 14:36:44 +0100 | [diff] [blame] | 236 | int snd_gf1_mem_init(struct snd_gus_card * gus) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 237 | { |
Takashi Iwai | 5e2da20 | 2005-11-17 14:36:44 +0100 | [diff] [blame] | 238 | struct snd_gf1_mem *alloc; |
| 239 | struct snd_gf1_mem_block block; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 240 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | 5e2da20 | 2005-11-17 14:36:44 +0100 | [diff] [blame] | 241 | struct snd_info_entry *entry; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 242 | #endif |
| 243 | |
| 244 | alloc = &gus->gf1.mem_alloc; |
Ingo Molnar | 8b7547f | 2006-01-16 16:33:08 +0100 | [diff] [blame] | 245 | mutex_init(&alloc->memory_mutex); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 246 | alloc->first = alloc->last = NULL; |
| 247 | if (!gus->gf1.memory) |
| 248 | return 0; |
| 249 | |
| 250 | memset(&block, 0, sizeof(block)); |
| 251 | block.owner = SNDRV_GF1_MEM_OWNER_DRIVER; |
| 252 | if (gus->gf1.enh_mode) { |
| 253 | block.ptr = 0; |
| 254 | block.size = 1024; |
Paulo Marques | 543537b | 2005-06-23 00:09:02 -0700 | [diff] [blame] | 255 | block.name = kstrdup("InterWave LFOs", GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 256 | if (snd_gf1_mem_xalloc(alloc, &block) == NULL) |
| 257 | return -ENOMEM; |
| 258 | } |
| 259 | block.ptr = gus->gf1.default_voice_address; |
| 260 | block.size = 4; |
Paulo Marques | 543537b | 2005-06-23 00:09:02 -0700 | [diff] [blame] | 261 | block.name = kstrdup("Voice default (NULL's)", GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 262 | if (snd_gf1_mem_xalloc(alloc, &block) == NULL) |
| 263 | return -ENOMEM; |
| 264 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | bf85020 | 2006-04-28 15:13:41 +0200 | [diff] [blame] | 265 | if (! snd_card_proc_new(gus->card, "gusmem", &entry)) |
| 266 | snd_info_set_text_ops(entry, gus, snd_gf1_mem_info_read); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 267 | #endif |
| 268 | return 0; |
| 269 | } |
| 270 | |
Takashi Iwai | 5e2da20 | 2005-11-17 14:36:44 +0100 | [diff] [blame] | 271 | int snd_gf1_mem_done(struct snd_gus_card * gus) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 272 | { |
Takashi Iwai | 5e2da20 | 2005-11-17 14:36:44 +0100 | [diff] [blame] | 273 | struct snd_gf1_mem *alloc; |
| 274 | struct snd_gf1_mem_block *block, *nblock; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 275 | |
| 276 | alloc = &gus->gf1.mem_alloc; |
| 277 | block = alloc->first; |
| 278 | while (block) { |
| 279 | nblock = block->next; |
| 280 | snd_gf1_mem_xfree(alloc, block); |
| 281 | block = nblock; |
| 282 | } |
| 283 | return 0; |
| 284 | } |
| 285 | |
| 286 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | 5e2da20 | 2005-11-17 14:36:44 +0100 | [diff] [blame] | 287 | static void snd_gf1_mem_info_read(struct snd_info_entry *entry, |
| 288 | struct snd_info_buffer *buffer) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 289 | { |
Takashi Iwai | 5e2da20 | 2005-11-17 14:36:44 +0100 | [diff] [blame] | 290 | struct snd_gus_card *gus; |
| 291 | struct snd_gf1_mem *alloc; |
| 292 | struct snd_gf1_mem_block *block; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 293 | unsigned int total, used; |
| 294 | int i; |
| 295 | |
| 296 | gus = entry->private_data; |
| 297 | alloc = &gus->gf1.mem_alloc; |
Ingo Molnar | 8b7547f | 2006-01-16 16:33:08 +0100 | [diff] [blame] | 298 | mutex_lock(&alloc->memory_mutex); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 299 | snd_iprintf(buffer, "8-bit banks : \n "); |
| 300 | for (i = 0; i < 4; i++) |
| 301 | snd_iprintf(buffer, "0x%06x (%04ik)%s", alloc->banks_8[i].address, alloc->banks_8[i].size >> 10, i + 1 < 4 ? "," : ""); |
| 302 | snd_iprintf(buffer, "\n" |
| 303 | "16-bit banks : \n "); |
| 304 | for (i = total = 0; i < 4; i++) { |
| 305 | snd_iprintf(buffer, "0x%06x (%04ik)%s", alloc->banks_16[i].address, alloc->banks_16[i].size >> 10, i + 1 < 4 ? "," : ""); |
| 306 | total += alloc->banks_16[i].size; |
| 307 | } |
| 308 | snd_iprintf(buffer, "\n"); |
| 309 | used = 0; |
| 310 | for (block = alloc->first, i = 0; block; block = block->next, i++) { |
| 311 | used += block->size; |
| 312 | snd_iprintf(buffer, "Block %i at 0x%lx onboard 0x%x size %i (0x%x):\n", i, (long) block, block->ptr, block->size, block->size); |
| 313 | if (block->share || |
| 314 | block->share_id[0] || block->share_id[1] || |
| 315 | block->share_id[2] || block->share_id[3]) |
| 316 | snd_iprintf(buffer, " Share : %i [id0 0x%x] [id1 0x%x] [id2 0x%x] [id3 0x%x]\n", |
| 317 | block->share, |
| 318 | block->share_id[0], block->share_id[1], |
| 319 | block->share_id[2], block->share_id[3]); |
| 320 | snd_iprintf(buffer, " Flags :%s\n", |
| 321 | block->flags & SNDRV_GF1_MEM_BLOCK_16BIT ? " 16-bit" : ""); |
| 322 | snd_iprintf(buffer, " Owner : "); |
| 323 | switch (block->owner) { |
| 324 | case SNDRV_GF1_MEM_OWNER_DRIVER: |
| 325 | snd_iprintf(buffer, "driver - %s\n", block->name); |
| 326 | break; |
| 327 | case SNDRV_GF1_MEM_OWNER_WAVE_SIMPLE: |
| 328 | snd_iprintf(buffer, "SIMPLE wave\n"); |
| 329 | break; |
| 330 | case SNDRV_GF1_MEM_OWNER_WAVE_GF1: |
| 331 | snd_iprintf(buffer, "GF1 wave\n"); |
| 332 | break; |
| 333 | case SNDRV_GF1_MEM_OWNER_WAVE_IWFFFF: |
| 334 | snd_iprintf(buffer, "IWFFFF wave\n"); |
| 335 | break; |
| 336 | default: |
| 337 | snd_iprintf(buffer, "unknown\n"); |
| 338 | } |
| 339 | } |
| 340 | snd_iprintf(buffer, " Total: memory = %i, used = %i, free = %i\n", |
| 341 | total, used, total - used); |
Ingo Molnar | 8b7547f | 2006-01-16 16:33:08 +0100 | [diff] [blame] | 342 | mutex_unlock(&alloc->memory_mutex); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 343 | #if 0 |
| 344 | ultra_iprintf(buffer, " Verify: free = %i, max 8-bit block = %i, max 16-bit block = %i\n", |
| 345 | ultra_memory_free_size(card, &card->gf1.mem_alloc), |
| 346 | ultra_memory_free_block(card, &card->gf1.mem_alloc, 0), |
| 347 | ultra_memory_free_block(card, &card->gf1.mem_alloc, 1)); |
| 348 | #endif |
| 349 | } |
| 350 | #endif |