Skip to contentSkip to conversation

Workaround bogus CF cards

PATCH In review Benjamin Herrenschmidt 2 participants 3 messages May 4, 2003

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Workaround bogus CF cards

Hi !

I had a problem with an "APACER" Compact Flash card. It seems that beast is allergic to WIN_READ_NATIVE_MAX.

I hacked this workaround that appear to work fine

drivers/ide/ide-disk.c +5 -1
@@ -1160,12 +1160,16 @@
 {
 	struct hd_driveid *id = drive->id;
 	unsigned long capacity = drive->cyl * drive->head * drive->sect;
-	unsigned long set_max = idedisk_read_native_max_address(drive);
+	unsigned long set_max = 0;
 	unsigned long long capacity_2 = capacity;
 	unsigned long long set_max_ext;
 
 	drive->capacity48 = 0;
 	drive->select.b.lba = 0;
+
+	/* That stupid compact flash doesn't like the command */
+	if (strncmp(drive->id->model, "APACER_CF_", 10) != 0)
+		set_max = idedisk_read_native_max_address(drive);
 
 	(void) idedisk_supports_host_protected_area(drive);
 
#1 lore raw
Quoted 4 lines · Benjamin Herrenschmidt

Hi !

I had a problem with an "APACER" Compact Flash card. It seems that beast is allergic to WIN_READ_NATIVE_MAX.

Thats probably a drive->flash check you need looking at the docs I have I don't see where any CF supports READ_NATIVE_MAX (of course it shouldnt die either)

#2 lore raw
Quoted 9 lines · Alan Cox
Quoted 4 lines · Benjamin Herrenschmidt

Hi !

I had a problem with an "APACER" Compact Flash card. It seems that beast is allergic to WIN_READ_NATIVE_MAX.

Thats probably a drive->flash check you need looking at the docs I have I don't see where any CF supports READ_NATIVE_MAX (of course it shouldnt die either)

It doesn't really die in fact, I was wrong here, but behaves a bit strangely. I get an interrupt timeout, and a drive not ready for command on the next command, that takes several seconds but it _seems_ it recovers.

Still, it's quite bad, so a workaround is welcome.

Ben.