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>

authored by Krzysztof Helt and committed by Jaroslav Kysela edf12b4a 1cb4f624

+7 -4
+7 -4
sound/isa/sb/emu8000.c
··· 377 377 static void __devinit 378 378 size_dram(struct snd_emu8000 *emu) 379 379 { 380 - int i, size; 380 + int i, size, detected_size; 381 381 382 382 if (emu->dram_checked) 383 383 return; 384 384 385 385 size = 0; 386 + detected_size = 0; 386 387 387 388 /* write out a magic number */ 388 389 snd_emu8000_dma_chan(emu, 0, EMU8000_RAM_WRITE); ··· 393 392 snd_emu8000_init_fm(emu); /* This must really be here and not 2 lines back even */ 394 393 395 394 while (size < EMU8000_MAX_DRAM) { 395 + 396 + size += 512 * 1024; /* increment 512kbytes */ 396 397 397 398 /* Write a unique data on the test address. 398 399 * if the address is out of range, the data is written on ··· 417 414 if (EMU8000_SMLD_READ(emu) != UNIQUE_ID2) 418 415 break; /* no memory at this address */ 419 416 420 - size += 512 * 1024; /* increment 512kbytes */ 417 + detected_size = size; 421 418 422 419 snd_emu8000_read_wait(emu); 423 420 ··· 445 442 snd_emu8000_dma_chan(emu, 1, EMU8000_RAM_CLOSE); 446 443 447 444 snd_printdd("EMU8000 [0x%lx]: %d Kb on-board memory detected\n", 448 - emu->port1, size/1024); 445 + emu->port1, detected_size/1024); 449 446 450 - emu->mem_size = size; 447 + emu->mem_size = detected_size; 451 448 emu->dram_checked = 1; 452 449 } 453 450