linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] one-liner fix to sddr09.c for >= 64MB SmartMedia
@ 2001-08-21 16:20 Olivier Calle
  0 siblings, 0 replies; only message in thread
From: Olivier Calle @ 2001-08-21 16:20 UTC (permalink / raw)
  To: Robert Baruch; +Cc: Matthew Dharm, linux-kernel

Hello,

I found a problem with getting the LBA <-> PBA mapping from a 64MB
SmartMedia card in an SDDR09 card reader.  The mapping is read from the
card into 2 128k sg's.  The problem occurs when looking at the data in the
second sg.  The memory is accessed with an offset from the beginning of
all the data, regardless of which sg is being read from.  So, in the case
of the second sg, the data read is actually whatever memory is right after
the memory allocated to that sg.

Here is the one-liner fix.  It worked with my card and I believe this
should work for larger cards, althought I have none to test with.

--- sddr09.c.orig	Sat Apr 28 10:36:28 2001
+++ sddr09.c	Tue Aug 21 08:35:19 2001
@@ -693,7 +693,7 @@
 	// scatterlist block i*64/128k = i*(2^6)*(2^-17) = i*(2^-11)

 	for (i=0; i<numblocks; i++) {
-		ptr = sg[i>>11].address+(i<<6);
+		ptr = sg[i>>11].address+((i<<6)&0x1ffff);
 		if (ptr[0]!=0xFF || ptr[1]!=0xFF || ptr[2]!=0xFF ||
 		    ptr[3]!=0xFF || ptr[4]!=0xFF || ptr[5]!=0xFF) {
 			US_DEBUGP("PBA %04X has no logical mapping: reserved area = "

Hopefully this will make it into the kernel in the near future.

-- 
Olivier Calle

internet: <olivier@calle.org>
work tel: 425-446-5088    home tel: 360-658-2692     To err is human,
callsign: N7TAP, class: General                      to really foul up
job:      Fluke Networks, Sr. Software Engineer      requires the root
WWW Page URL: http://calle.org/olivier/              password...
Psalm 48:14                        SPU Electrical Engineering Graduate


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2001-08-21 16:20 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-08-21 16:20 [PATCH] one-liner fix to sddr09.c for >= 64MB SmartMedia Olivier Calle

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).