Re: EDD disksigs for disks other than 0x80

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Jun 24, 2004 at 10:32:00AM -0400, Jeremy Katz wrote:
> On Wed, 2004-06-23 at 23:15 -0500, Matt Domsch wrote:
> Yep.  Actually, I could see it being interesting to know the extent of
> all of the BIOS mappings.  I seem to remember that the BIOS can only map
> up to 8 which doesn't seem like it would be that absurd to keep
> information about.

Six is easy, 8 less so, just because the EDD 3.0 data chunk is so
large we can only keep six of those around.

Patch below against 2.6.7-bk(current) gives mbr_signature for first
six BIOS disks.

Please give it a try, then I'll submit to Andrew Morton.

Thanks,
Matt

-- 
Matt Domsch
Sr. Software Engineer, Lead Engineer
Dell Linux Solutions linux.dell.com & www.dell.com/linux
Linux on Dell mailing lists @ http://lists.us.dell.com

===== Documentation/i386/zero-page.txt 1.7 vs edited =====
--- 1.7/Documentation/i386/zero-page.txt	2004-03-19 00:03:48 -06:00
+++ edited/Documentation/i386/zero-page.txt	2004-06-24 09:23:29 -05:00
@@ -72,7 +72,7 @@
 0x21c	unsigned long	INITRD_SIZE, size in bytes of ramdisk image
 0x220	4 bytes		(setup.S)
 0x224	unsigned short	setup.S heap end pointer
-0x2cc	4 bytes		DISK80_SIG_BUFFER (setup.S)
+0x2B8	24 bytes	DISK_SIG_BUFFER (edd.S)
 0x2d0 - 0x600		E820MAP
-0x600 - 0x7ff		EDDBUF (setup.S) for disk signature read sector
-0x600 - 0x7eb		EDDBUF (setup.S) for edd data
+0x600 - 0x7ff		EDDBUF (edd.S) for disk signature read sector
+0x600 - 0x7eb		EDDBUF (edd.S) for edd data
===== arch/i386/boot/edd.S 1.1 vs edited =====
--- 1.1/arch/i386/boot/edd.S	2004-03-19 00:04:56 -06:00
+++ edited/arch/i386/boot/edd.S	2004-06-24 11:19:00 -05:00
@@ -4,7 +4,7 @@
  * conformant to T13 Committee www.t13.org
  *   projects 1572D, 1484D, 1386D, 1226DT
  * disk signature read by Matt Domsch <Matt_Domsch@xxxxxxxx>
- *	and Andrew Wilks <Andrew_Wilks@xxxxxxxx> September 2003
+ *	and Andrew Wilks <Andrew_Wilks@xxxxxxxx> September 2003, June 2004
  * legacy CHS retreival by Patrick J. LoPresti <patl@xxxxxxxxxxxxxxxxxxxxx>
  *      March 2004
  */
@@ -12,28 +12,39 @@
 #include <linux/edd.h>
 
 #if defined(CONFIG_EDD) || defined(CONFIG_EDD_MODULE)
-# Read the first sector of device 80h and store the 4-byte signature
-	movl	$0xFFFFFFFF, %eax
-	movl	%eax, (DISK80_SIG_BUFFER)	# assume failure
-	movb	$READ_SECTORS, %ah
-	movb	$1, %al				# read 1 sector
+# Read the first sector of each BIOS disk device and store the 4-byte signature
+edd_disksig_start:
+    	movb	$0, (EDDNR)			# zero value at EDDNR
 	movb	$0x80, %dl			# from device 80
+	movw	$DISK_SIG_BUFFER, %bx		# store buffer ptr in bx
+edd_disksig_read:
+       	movl	$0xFFFFFFFF, %eax
+	movl	%eax, (%bx)			# assume failure
+	pushw	%bx
+       	movb	$READ_SECTORS, %ah
+	movb	$1, %al				# read 1 sector
 	movb	$0, %dh				# at head 0
 	movw	$1, %cx				# cylinder 0, sector 0
 	pushw	%es
 	pushw	%ds
 	popw	%es
-	movw	$EDDBUF, %bx
+    	movw	$EDDBUF, %bx
 	pushw   %dx             # work around buggy BIOSes
 	stc                     # work around buggy BIOSes
 	int     $0x13
 	sti                     # work around buggy BIOSes
 	popw    %dx
-	jc	disk_sig_done
-	movl	(EDDBUF+MBR_SIG_OFFSET), %eax
-	movl	%eax, (DISK80_SIG_BUFFER)	# store success
-disk_sig_done:
 	popw	%es
+	popw	%bx
+	jc	edd_disksig_done		# on failure, we're done.
+	movl	(EDDBUF+MBR_SIG_OFFSET), %eax
+	movl	%eax, (%bx)			# store success
+	incb	(EDDNR)				# note that we stored something
+	incb	%dl				# increment to next device
+	addw	$4, %bx				# increment sig buffer ptr
+	cmpb	$EDDMAXNR, (EDDNR) 		# Out of space?
+	jb	edd_disksig_read		# keep looping
+edd_disksig_done:
 
 # Do the BIOS Enhanced Disk Drive calls
 # This consists of two calls:
===== arch/i386/kernel/setup.c 1.122 vs edited =====
--- 1.122/arch/i386/kernel/setup.c	2004-06-20 20:23:40 -05:00
+++ edited/arch/i386/kernel/setup.c	2004-06-24 10:29:34 -05:00
@@ -631,11 +631,11 @@
 #if defined(CONFIG_EDD) || defined(CONFIG_EDD_MODULE)
 unsigned char eddnr;
 struct edd_info edd[EDDMAXNR];
-unsigned int edd_disk80_sig;
+unsigned int edd_disk_sig[EDDMAXNR];
 #ifdef CONFIG_EDD_MODULE
 EXPORT_SYMBOL(eddnr);
 EXPORT_SYMBOL(edd);
-EXPORT_SYMBOL(edd_disk80_sig);
+EXPORT_SYMBOL(edd_disk_sig);
 #endif
 /**
  * copy_edd() - Copy the BIOS EDD information
@@ -646,10 +646,12 @@
 {
      eddnr = EDD_NR;
      memcpy(edd, EDD_BUF, sizeof(edd));
-     edd_disk80_sig = DISK80_SIGNATURE;
+     memcpy(edd_disk_sig, EDD_DISK_SIGNATURE, sizeof(edd_disk_sig));
 }
 #else
-#define copy_edd() do {} while (0)
+static inline void copy_edd(void)
+{
+}
 #endif
 
 /*
===== arch/x86_64/kernel/setup.c 1.42 vs edited =====
--- 1.42/arch/x86_64/kernel/setup.c	2004-06-18 01:49:29 -05:00
+++ edited/arch/x86_64/kernel/setup.c	2004-06-24 10:31:23 -05:00
@@ -403,11 +403,11 @@
 #if defined(CONFIG_EDD) || defined(CONFIG_EDD_MODULE)
 unsigned char eddnr;
 struct edd_info edd[EDDMAXNR];
-unsigned int edd_disk80_sig;
+unsigned int edd_disk_sig[EDDMAXNR];
 #ifdef CONFIG_EDD_MODULE
 EXPORT_SYMBOL(eddnr);
 EXPORT_SYMBOL(edd);
-EXPORT_SYMBOL(edd_disk80_sig);
+EXPORT_SYMBOL(edd_disk_sig);
 #endif
 /**
  * copy_edd() - Copy the BIOS EDD information
@@ -418,10 +418,12 @@
 {
      eddnr = EDD_NR;
      memcpy(edd, EDD_BUF, sizeof(edd));
-     edd_disk80_sig = DISK80_SIGNATURE;
+     memcpy(edd_disk_sig, EDD_DISK_SIGNATURE, sizeof(edd_disk_sig));
 }
 #else
-#define copy_edd() do {} while (0)
+static inline void copy_edd(void)
+{
+}
 #endif
 
 void __init setup_arch(char **cmdline_p)
===== drivers/firmware/edd.c 1.29 vs edited =====
--- 1.29/drivers/firmware/edd.c	2004-06-03 03:46:44 -05:00
+++ edited/drivers/firmware/edd.c	2004-06-24 15:33:45 -05:00
@@ -2,7 +2,7 @@
  * linux/arch/i386/kernel/edd.c
  *  Copyright (C) 2002, 2003, 2004 Dell Inc.
  *  by Matt Domsch <Matt_Domsch@xxxxxxxx>
- *  disk80 signature by Matt Domsch, Andrew Wilks, and Sandeep K. Shandilya
+ *  disk signature by Matt Domsch, Andrew Wilks, and Sandeep K. Shandilya
  *  legacy CHS by Patrick J. LoPresti <patl@xxxxxxxxxxxxxxxxxxxxx>
  *
  * BIOS Enhanced Disk Drive Services (EDD)
@@ -43,8 +43,8 @@
 #include <linux/blkdev.h>
 #include <linux/edd.h>
 
-#define EDD_VERSION "0.15"
-#define EDD_DATE    "2004-May-17"
+#define EDD_VERSION "0.16"
+#define EDD_DATE    "2004-Jun-24"
 
 MODULE_AUTHOR("Matt Domsch <Matt_Domsch@xxxxxxxx>");
 MODULE_DESCRIPTION("sysfs interface to BIOS EDD information");
@@ -54,6 +54,7 @@
 #define left (PAGE_SIZE - (p - buf) - 1)
 
 struct edd_device {
+	unsigned int mbr_signature;
 	struct edd_info *info;
 	struct kobject kobj;
 };
@@ -84,9 +85,10 @@
 }
 
 static inline void
-edd_dev_set_info(struct edd_device *edev, struct edd_info *info)
+edd_dev_set_info(struct edd_device *edev, int i)
 {
-	edev->info = info;
+	edev->mbr_signature = edd_disk_sig[i];
+	edev->info = &edd[i];
 }
 
 #define to_edd_attr(_attr) container_of(_attr,struct edd_attribute,attr)
@@ -256,10 +258,10 @@
 }
 
 static ssize_t
-edd_show_disk80_sig(struct edd_device *edev, char *buf)
+edd_show_mbr_signature(struct edd_device *edev, char *buf)
 {
 	char *p = buf;
-	p += scnprintf(p, left, "0x%08x\n", edd_disk80_sig);
+	p += scnprintf(p, left, "0x%08x\n", edev->mbr_signature);
 	return (p - buf);
 }
 
@@ -538,23 +540,12 @@
 	return 1;
 }
 
-static int
-edd_has_disk80_sig(struct edd_device *edev)
-{
-	struct edd_info *info;
-	if (!edev)
-		return 0;
-	info = edd_dev_get_info(edev);
-	if (!info)
-		return 0;
-	return info->device == 0x80;
-}
-
 static EDD_DEVICE_ATTR(raw_data, 0444, edd_show_raw_data, NULL);
 static EDD_DEVICE_ATTR(version, 0444, edd_show_version, NULL);
 static EDD_DEVICE_ATTR(extensions, 0444, edd_show_extensions, NULL);
 static EDD_DEVICE_ATTR(info_flags, 0444, edd_show_info_flags, NULL);
 static EDD_DEVICE_ATTR(sectors, 0444, edd_show_sectors, NULL);
+static EDD_DEVICE_ATTR(mbr_signature, 0444, edd_show_mbr_signature, NULL);
 static EDD_DEVICE_ATTR(legacy_max_cylinder, 0444,
                        edd_show_legacy_max_cylinder,
 		       edd_has_legacy_max_cylinder);
@@ -572,7 +563,6 @@
 		       edd_has_default_sectors_per_track);
 static EDD_DEVICE_ATTR(interface, 0444, edd_show_interface, edd_has_edd30);
 static EDD_DEVICE_ATTR(host_bus, 0444, edd_show_host_bus, edd_has_edd30);
-static EDD_DEVICE_ATTR(mbr_signature, 0444, edd_show_disk80_sig, edd_has_disk80_sig);
 
 
 /* These are default attributes that are added for every edd
@@ -584,6 +574,7 @@
 	&edd_attr_extensions.attr,
 	&edd_attr_info_flags.attr,
 	&edd_attr_sectors.attr,
+	&edd_attr_mbr_signature.attr,
 	NULL,
 };
 
@@ -597,7 +588,6 @@
 	&edd_attr_default_sectors_per_track,
 	&edd_attr_interface,
 	&edd_attr_host_bus,
-	&edd_attr_mbr_signature,
 	NULL,
 };
 
@@ -709,7 +699,7 @@
 	if (!edev)
 		return 1;
 	memset(edev, 0, sizeof (*edev));
-	edd_dev_set_info(edev, &edd[i]);
+	edd_dev_set_info(edev, i);
 	kobject_set_name(&edev->kobj, "int13_dev%02x",
 			 edd[i].device);
 	kobj_set_kset_s(edev,edd_subsys);
===== include/asm-i386/setup.h 1.9 vs edited =====
--- 1.9/include/asm-i386/setup.h	2004-03-19 00:03:48 -06:00
+++ edited/include/asm-i386/setup.h	2004-06-24 10:27:34 -05:00
@@ -56,8 +56,8 @@
 #define INITRD_START (*(unsigned long *) (PARAM+0x218))
 #define INITRD_SIZE (*(unsigned long *) (PARAM+0x21c))
 #define EDID_INFO   (*(struct edid_info *) (PARAM+0x440))
-#define DISK80_SIGNATURE (*(unsigned int*) (PARAM+DISK80_SIG_BUFFER))
 #define EDD_NR     (*(unsigned char *) (PARAM+EDDNR))
+#define EDD_DISK_SIGNATURE ((unsigned int *) (PARAM+DISK_SIG_BUFFER))
 #define EDD_BUF     ((struct edd_info *) (PARAM+EDDBUF))
 
 #endif /* __ASSEMBLY__ */
===== include/linux/edd.h 1.10 vs edited =====
--- 1.10/include/linux/edd.h	2004-06-03 03:46:44 -05:00
+++ edited/include/linux/edd.h	2004-06-24 10:37:35 -05:00
@@ -44,7 +44,7 @@
 
 #define READ_SECTORS 0x02
 #define MBR_SIG_OFFSET 0x1B8
-#define DISK80_SIG_BUFFER 0x2cc
+#define DISK_SIG_BUFFER 0x2B8
 #ifndef __ASSEMBLY__
 
 #define EDD_EXT_FIXED_DISK_ACCESS           (1 << 0)
@@ -172,10 +172,9 @@
 	struct edd_device_params params;
 } __attribute__ ((packed));
 
+extern unsigned int edd_disk_sig[EDDMAXNR];
 extern struct edd_info edd[EDDMAXNR];
 extern unsigned char eddnr;
-extern unsigned int edd_disk80_sig;
-
 #endif				/*!__ASSEMBLY__ */
 
 #endif				/* _LINUX_EDD_H */

Attachment: pgp2pSKrhiMAv.pgp
Description: PGP signature


[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux