[lkml]   [2001]   [Aug]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Patch in this message
Subject[PATCH] one-liner fix to sddr09.c for >= 64MB SmartMedia

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: <>
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: 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
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2005-03-22 12:57    [W:0.118 / U:0.072 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site