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