From: David Flater <vger@flaterco.com>
To: Alsa Devel <alsa-devel@vger.kernel.org>,
Linux Kernel <linux-kernel@vger.kernel.org>
Subject: [PATCH] sound: fix emu8000 DRAM sized 512 KiB too small
Date: Mon, 27 Aug 2012 20:30:43 -0400 [thread overview]
Message-ID: <503C1133.7000506@flaterco.com> (raw)
[PATCH] sound: fix emu8000 DRAM sized 512 KiB too small
Applicable to 3.5.3 mainline.
In emu8000.c, size_dram determines the amount of memory on the sound card by
doing write/readback tests starting at 512 KiB and incrementing by 512 KiB.
On success, detected_size is updated to the successful address and testing
continues. On failure, the loop is immediately exited. The resulting
detected_size is 512 KiB too small except in two special cases:
1. If there is no memory, the initial 0 value of detected_size is used, which
is correct.
2. If the address space wraps around, detected_size is updated before the
bailout, so the result is correct.
The patch corrects all cases and was tested with an AWE64 Gold. Before:
EMU8000 [0x620]: 3584 Kb on-board memory detected
asfxload 4GMGSMT.SF2 (4174814 B) fails.
After:
EMU8000 [0x620]: 4096 Kb on-board memory detected
asfxload 4GMGSMT.SF2 succeeds.
C.f. Bug 46451 https://bugzilla.kernel.org/show_bug.cgi?id=46451
Signed-off-by: David Flater <dave@flaterco.com>
---
Note: I am having newbie problems with git, so I am unable to determine
easily whether this was a regression or a primordial bug.
git clone http://pub/scm/linux/kernel/git/torvalds/linux.git gitkernel
Cloning into gitkernel...
warning: remote HEAD refers to nonexistent ref, unable to checkout.
--- linux-3.5.2/sound/isa/sb/emu8000.c~ 2012-08-15 10:55:25.000000000 -0400
+++ linux-3.5.2/sound/isa/sb/emu8000.c 2012-08-25 20:22:00.482446406 -0400
@@ -417,9 +417,6 @@ size_dram(struct snd_emu8000 *emu)
EMU8000_SMLD_READ(emu); /* discard stale data */
if (EMU8000_SMLD_READ(emu) != UNIQUE_ID2)
break; /* no memory at this address */
-
- detected_size = size;
-
snd_emu8000_read_wait(emu);
/*
@@ -432,6 +429,9 @@ size_dram(struct snd_emu8000 *emu)
if (EMU8000_SMLD_READ(emu) != UNIQUE_ID1)
break; /* we must have wrapped around */
snd_emu8000_read_wait(emu);
+
+ /* Otherwise, it's valid memory. */
+ detected_size = size + 512 * 1024;
}
/* wait until FULL bit in SMAxW register is false */
next reply other threads:[~2012-08-28 0:37 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-28 0:30 David Flater [this message]
2012-08-28 2:25 ` [PATCHv2] sound: fix emu8000 DRAM sized 512 KiB too small David Flater
2012-08-28 18:01 ` Takashi Iwai
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=503C1133.7000506@flaterco.com \
--to=vger@flaterco.com \
--cc=alsa-devel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).