lkml.org 
[lkml]   [2003]   [Aug]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Date
Subject[PATCH] correct - I hope - check for HPA and LBA48
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
-
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/
\
 
 \ /
  Last update: 2005-03-22 13:47    [W:0.053 / U:0.152 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site