small GUS fix for non-standard memory config

Andrew J. Anderson (andrew@db.erau.edu)
Fri, 9 Oct 1998 23:26:07 -0400 (EDT)


Below is a small patch that changes the way that gus_wave.c performs its
last-ditch effort to detect a working memory configuration. The problem
lies in the generic memory table that was used by Gravis when building the
card, and the way that the Interwave processor can access memory.

In my case, I have a configuration of 256/256/4096/4096K for a total of
8.5M on the card. This setup does not appear in the lookup table in
iwmem.h. This patch changes the final matching routine to find the
largest entry in the table that will work with the memory installed on the
card. This in my case it uses 256/256/1024/1024K. Previously it failed
this portion and bailed out, using only 256K.

--- drivers/sound/gus_wave.c.orig Fri Oct 9 16:52:43 1998
+++ drivers/sound/gus_wave.c Fri Oct 9 23:05:32 1998
@@ -865,7 +865,7 @@

int bank, chunk, addr, total = 0;
int bank_sizes[4];
- int i, j, bits = -1, nbanks = 0;
+ int i, j, bits = -1, testbits = -1, nbanks = 0;

/*
* This routine determines what kind of RAM is installed in each of the four
@@ -976,19 +976,20 @@
}
}
/*
- * The last resort is to search for a combination where the last bank is
- * smaller than the actual SIMM. This leaves some memory in the last
- * bank unused but doesn't leave holes in the DRAM address space.
+ * The last resort is to search for a combination where the banks are
+ * smaller than the actual SIMMs. This leaves some memory in the banks
+ * unused but doesn't leave holes in the DRAM address space.
*/
if (bits == -1) /* No luck yet */
{
- for (i = 0; bits == -1 && i < 13; i++)
+ for (i = 0; i < 13; i++)
{
- bits = i;
-
- for (j = 0; bits != -1 && j < nbanks - 1; j++)
- if (mem_decode[i][j] != bank_sizes[j])
- bits = -1; /* No hit */
+ testbits = i;
+ for (j = 0; testbits != -1 && j < nbanks - 1; j++)
+ if (mem_decode[i][j] > bank_sizes[j]) {
+ testbits = -1;
+ }
+ if(testbits > bits) bits = testbits;
}
if (bits != -1)
{

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Andrew Anderson http://amelia.db.erau.edu/~andrew/
if(!(family_tree=fork())){redneck=TRUE;}

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/