public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] EDD: Check for correct EDD 3.0 length
@ 2012-05-15 11:04 Hannes Reinecke
  2012-05-15 11:12 ` Gleb Natapov
  0 siblings, 1 reply; 27+ messages in thread
From: Hannes Reinecke @ 2012-05-15 11:04 UTC (permalink / raw)
  To: LKML; +Cc: Hannes Reinecke, Gleb Natapov, H. Peter Anvin

The device_path_info_length for EDD 3.0 is 36, not 44.
Cf http://mbldr.sourceforge.net/specsedd30.pdf.

This is a regression introduced by commit
0c61227094b3ddaca2f847ee287c4a2e3762b5a2

Signed-off-by: Hannes Reinecke <hare@suse.de>
Cc: Gleb Natapov <gleb@redhat.com>
Cc: H. Peter Anvin <hpa@linux.intel.com>

diff --git a/drivers/firmware/edd.c b/drivers/firmware/edd.c
index e229576..09a77d5 100644
--- a/drivers/firmware/edd.c
+++ b/drivers/firmware/edd.c
@@ -545,8 +545,8 @@ edd_has_edd30(struct edd_device *edev)
 	}
 
 
-	/* We support only T13 spec */
-	if (info->params.device_path_info_length != 44)
+	/* EDD 3.0 specifies this to be 36 */
+	if (info->params.device_path_info_length != 36)
 		return 0;
 
 	for (i = 30; i < info->params.device_path_info_length + 30; i++)

^ permalink raw reply related	[flat|nested] 27+ messages in thread
* [PATCH] EDD: Check for correct EDD 3.0 length
@ 2012-05-16  6:51 Hannes Reinecke
  2012-05-16  8:28 ` Gleb Natapov
  0 siblings, 1 reply; 27+ messages in thread
From: Hannes Reinecke @ 2012-05-16  6:51 UTC (permalink / raw)
  To: LKML; +Cc: Hannes Reinecke, Gleb Natapov, H. Peter Anvin, Alan Cox

There are two competing EDD 3.0 specifications,
the original one from Phoenix
<http://mbldr.sourceforge.net/specsedd30.pdf>
and the T-13 approved one
<http://www.t13.org/documents/UploadedDocuments/docs2004/d1572r3-EDD3.pdf>

They differ in the length of the device_path field, which
is one quad word for the Phoenix spec and two quad words
for the T-13 spec. So we need to test for both lengths
and blank out the second quad word when a Phoenix
version is detected.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Cc: Gleb Natapov <gleb@redhat.com>
Cc: H. Peter Anvin <hpa@linux.intel.com>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>

diff --git a/drivers/firmware/edd.c b/drivers/firmware/edd.c
index e229576..beedf4c 100644
--- a/drivers/firmware/edd.c
+++ b/drivers/firmware/edd.c
@@ -192,6 +192,13 @@ edd_show_interface(struct edd_device *edev, char *buf)
 			p += scnprintf(p, left, " ");
 		}
 	}
+	/*
+	 * Phoenix EDD 3.0 reserves only one quad word for the
+	 * device path, so blank out the second quad word.
+	 */
+	if (info->params.device_path_info_length == 36)
+		info->params.device_path.unknown.reserved2 = 0;
+
 	if (!strncmp(info->params.interface_type, "ATAPI", 5)) {
 		p += scnprintf(p, left, "\tdevice: %u  lun: %u\n",
 			     info->params.device_path.atapi.device,
@@ -545,8 +552,12 @@ edd_has_edd30(struct edd_device *edev)
 	}
 
 
-	/* We support only T13 spec */
-	if (info->params.device_path_info_length != 44)
+	/*
+	 * Phoenix EDD 3.0 specifies this to be 36,
+	 * T-13 EDD 3.0 uses 44. So check for both.
+	 */
+	if (info->params.device_path_info_length != 36 &&
+	    info->params.device_path_info_length != 44)
 		return 0;
 
 	for (i = 30; i < info->params.device_path_info_length + 30; i++)

^ permalink raw reply related	[flat|nested] 27+ messages in thread

end of thread, other threads:[~2012-05-16  8:28 UTC | newest]

Thread overview: 27+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-15 11:04 [PATCH] EDD: Check for correct EDD 3.0 length Hannes Reinecke
2012-05-15 11:12 ` Gleb Natapov
2012-05-15 11:20   ` Hannes Reinecke
2012-05-15 11:59     ` Gleb Natapov
2012-05-15 12:53       ` Gleb Natapov
2012-05-15 13:49       ` Alan Cox
2012-05-15 14:12         ` Gleb Natapov
2012-05-15 14:18           ` Alan Cox
2012-05-15 14:21             ` Gleb Natapov
2012-05-15 14:36               ` Alan Cox
2012-05-15 14:48                 ` Gleb Natapov
2012-05-15 14:54                   ` Alan Cox
2012-05-15 15:00                     ` Gleb Natapov
2012-05-15 14:00       ` Alan Cox
2012-05-15 14:36         ` Gleb Natapov
2012-05-15 14:52           ` Alan Cox
2012-05-15 14:53             ` Gleb Natapov
2012-05-15 15:22               ` Alan Cox
2012-05-15 15:29                 ` Gleb Natapov
2012-05-15 15:41                   ` Alan Cox
2012-05-15 15:53                     ` Gleb Natapov
2012-05-15 15:14           ` Alan Cox
2012-05-15 15:31             ` Alan Cox
2012-05-15 15:46             ` Gleb Natapov
2012-05-15 17:17               ` H. Peter Anvin
  -- strict thread matches above, loose matches on Subject: below --
2012-05-16  6:51 Hannes Reinecke
2012-05-16  8:28 ` Gleb Natapov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox