aboutsummaryrefslogtreecommitdiffstats
path: root/sound/isa/sb/emu8000.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/isa/sb/emu8000.c')
-rw-r--r--sound/isa/sb/emu8000.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/sound/isa/sb/emu8000.c b/sound/isa/sb/emu8000.c
index 751762f1c59a..0c40951b6523 100644
--- a/sound/isa/sb/emu8000.c
+++ b/sound/isa/sb/emu8000.c
@@ -377,12 +377,13 @@ init_arrays(struct snd_emu8000 *emu)
377static void __devinit 377static void __devinit
378size_dram(struct snd_emu8000 *emu) 378size_dram(struct snd_emu8000 *emu)
379{ 379{
380 int i, size; 380 int i, size, detected_size;
381 381
382 if (emu->dram_checked) 382 if (emu->dram_checked)
383 return; 383 return;
384 384
385 size = 0; 385 size = 0;
386 detected_size = 0;
386 387
387 /* write out a magic number */ 388 /* write out a magic number */
388 snd_emu8000_dma_chan(emu, 0, EMU8000_RAM_WRITE); 389 snd_emu8000_dma_chan(emu, 0, EMU8000_RAM_WRITE);
@@ -393,6 +394,8 @@ size_dram(struct snd_emu8000 *emu)
393 394
394 while (size < EMU8000_MAX_DRAM) { 395 while (size < EMU8000_MAX_DRAM) {
395 396
397 size += 512 * 1024; /* increment 512kbytes */
398
396 /* Write a unique data on the test address. 399 /* Write a unique data on the test address.
397 * if the address is out of range, the data is written on 400 * if the address is out of range, the data is written on
398 * 0x200000(=EMU8000_DRAM_OFFSET). Then the id word is 401 * 0x200000(=EMU8000_DRAM_OFFSET). Then the id word is
@@ -414,7 +417,7 @@ size_dram(struct snd_emu8000 *emu)
414 if (EMU8000_SMLD_READ(emu) != UNIQUE_ID2) 417 if (EMU8000_SMLD_READ(emu) != UNIQUE_ID2)
415 break; /* no memory at this address */ 418 break; /* no memory at this address */
416 419
417 size += 512 * 1024; /* increment 512kbytes */ 420 detected_size = size;
418 421
419 snd_emu8000_read_wait(emu); 422 snd_emu8000_read_wait(emu);
420 423
@@ -442,9 +445,9 @@ size_dram(struct snd_emu8000 *emu)
442 snd_emu8000_dma_chan(emu, 1, EMU8000_RAM_CLOSE); 445 snd_emu8000_dma_chan(emu, 1, EMU8000_RAM_CLOSE);
443 446
444 snd_printdd("EMU8000 [0x%lx]: %d Kb on-board memory detected\n", 447 snd_printdd("EMU8000 [0x%lx]: %d Kb on-board memory detected\n",
445 emu->port1, size/1024); 448 emu->port1, detected_size/1024);
446 449
447 emu->mem_size = size; 450 emu->mem_size = detected_size;
448 emu->dram_checked = 1; 451 emu->dram_checked = 1;
449} 452}
450 453