[PATCH] one-liner fix to sddr09.c for >= 64MB SmartMedia

From: Olivier Calle (olivier@calle.org)
Date: Tue Aug 21 2001 - 11:20:17 EST


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

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



This archive was generated by hypermail 2b29 : Thu Aug 23 2001 - 21:00:43 EST