diff options
author | Krzysztof Helt <krzysztof.h1@wp.pl> | 2010-01-04 16:23:34 -0500 |
---|---|---|
committer | Jaroslav Kysela <perex@perex.cz> | 2010-01-08 03:27:23 -0500 |
commit | edf12b4af6e1d2b7c42c75ff00e55a9c52c06d70 (patch) | |
tree | 909a9b4927da5e67ce685eb63ea7ce73e41e3618 /sound/isa | |
parent | 1cb4f624ea38361b6397966470f0a1bed5532483 (diff) |
sbawe: fix memory detection part 2
The patch "sbawe: fix memory detection" fixed detection
for memoryless SB32 cards but broke detection of memory
above 512KB. This patch fixes the regression.
The patch has been tested on the SB32 card (CT3670) with
0MB, 2MB and 8MB memory installed.
Signed-off-by: Krzysztof Helt <krzysztof.h1@wp.pl>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Diffstat (limited to 'sound/isa')
-rw-r--r-- | sound/isa/sb/emu8000.c | 11 |
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) | |||
377 | static void __devinit | 377 | static void __devinit |
378 | size_dram(struct snd_emu8000 *emu) | 378 | size_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 | ||