* [PATCH] correct - I hope - check for HPA and LBA48
@ 2003-08-07 20:17 Andries.Brouwer
0 siblings, 0 replies; only message in thread
From: Andries.Brouwer @ 2003-08-07 20:17 UTC (permalink / raw)
To: B.Zolnierkiewicz; +Cc: linux-kernel
I remember that it is necessary to check whether the words
containing the HPA and LBA48 bits are valid before looking
at these bits. This improves things for at least one disk.
But there is much buggy hardware out there - this may also
break some things. Not to be applied (yet) to stable kernels.
Andries
diff -u --recursive --new-file -X /linux/dontdiff a/drivers/ide/ide-disk.c b/drivers/ide/ide-disk.c
--- a/drivers/ide/ide-disk.c Thu Aug 7 22:08:22 2003
+++ b/drivers/ide/ide-disk.c Thu Aug 7 22:42:27 2003
@@ -1080,24 +1080,21 @@
return (id->capability & 2);
}
-/*
- * Bits 10 of command_set_1 and cfs_enable_1 must be equal,
- * so on non-buggy drives we need test only one.
- * However, we should also check whether these fields are valid.
- */
static inline int
idedisk_supports_host_protected_area(const struct hd_driveid *id)
{
- return (id->command_set_1 & 0x0400) && (id->cfs_enable_1 & 0x0400);
+ return (id->command_set_2 & 0xc000) == 0x4000 /* words 82-83 valid */
+ && (id->command_set_1 & 0x0400) /* HPA supported */
+ && (id->csf_default & 0xc000) == 0x4000 /* wds 85-87 valid */
+ && (id->cfs_enable_1 & 0x0400); /* HPA enabled */
}
-/*
- * The same here.
- */
static inline int
idedisk_supports_lba48(const struct hd_driveid *id)
{
- return (id->command_set_2 & 0x0400) && (id->cfs_enable_2 & 0x0400);
+ return (id->command_set_2 & 0xc400) == 0x4400 /* LBA48 supported */
+ && (id->csf_default & 0xc000) == 0x4000 /* wds 85-87 valid */
+ && (id->cfs_enable_2 & 0x0400); /* LBA48 enabled */
}
static inline unsigned long long
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2003-08-07 20:17 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-08-07 20:17 [PATCH] correct - I hope - check for HPA and LBA48 Andries.Brouwer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®