* [RFC] 2.6.0 EDD enhancements
@ 2003-12-19 18:57 Matt Domsch
2003-12-19 19:01 ` Matt Domsch
` (3 more replies)
0 siblings, 4 replies; 10+ messages in thread
From: Matt Domsch @ 2003-12-19 18:57 UTC (permalink / raw)
To: linux-kernel
For review and comment, three changesets against 2.6.0 at:
bk pull http://mdomsch.bkbits.net/linux-2.5-edd
This will update the following files:
Documentation/i386/zero-page.txt | 4 -
arch/i386/boot/setup.S | 21 ++++++
arch/i386/kernel/edd.c | 128 ++++++++++++++++++++++++++++++++++-----
arch/i386/kernel/i386_ksyms.c | 6 -
arch/i386/kernel/setup.c | 7 ++
include/asm-i386/edd.h | 6 +
include/asm-i386/setup.h | 1
7 files changed, 149 insertions, 24 deletions
through these ChangeSets:
<Matt_Domsch@dell.com> (03/12/18 1.1532.1.3)
EDD: add sysfs symlinks for IDE devices
Devices reporting as type "ATA" to the EDD 3.0 BIOS calls
now get symlinks pointing from the int13_dev8x device
to the IDE disk device in sysfs.
EDD 3.0 maps all IDE devices on a single PCI device with a single
device value; there's no concept of multiple channels,
primary/secondary devices on a channel. This may not be equivalent,
but edd.c currently matches only based on ide_drive_t.lun ==
EDD device value. This should perhaps be taken up with
the T13 committee, as their spec seems incomplete in this regard.
<Matt_Domsch@dell.com> (03/12/18 1.1532.1.2)
EDD: enable symlinks to SCSI devices
Symlinks from /sys/firmware/edd/int13_dev8x/disc to the appropriate
SCSI discs were added a year ago, but disabled because the
scsi_bus list contained non-'scsi_device's at that time, which
could have lead to an improper pointer following. The SCSI
mid-layer has rectified this, so this code can be re-enabled
in edd.c once again.
<Matt_Domsch@dell.com> (03/12/18 1.1532.1.1)
EDD: read disk80 MBR signature, export through edd module
There are 4 bytes in the MSDOS master boot record, at offset 0x1b8,
which may contain a per-system-unique signature. By first writing a
unique signature to each disk in the system, then rebooting, and then
reading the MBR to get the signature for the boot disk (int13 dev
80h), userspace may use it to compare against disks it knows as named
/dev/[hs]d[a-z], and thus determine which disk is the BIOS boot disk,
thus where the /boot, / and boot loaders should be placed.
This is useful in the case where the BIOS is not EDD3.0 compliant,
thus doesn't provide the PCI bus/dev/fn and IDE/SCSI location of the
boot disk, yet you need to know which disk is the boot disk. It's
most useful in OS installers.
This patch retrieves the signature from the disk in setup.S, stores it
in a space reserved in the empty_zero_page, copies it somewhere safe
in setup.c, and exports it via
/sys/firmware/edd/int13_disk80/mbr_signature in edd.c. Code is
covered under CONFIG_EDD=[ym].
Patches will follow. Feedback welcome.
Thanks,
Matt
--
Matt Domsch
Sr. Software Engineer, Lead Engineer
Dell Linux Solutions www.dell.com/linux
Linux on Dell mailing lists @ http://lists.us.dell.com
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [RFC] 2.6.0 EDD enhancements
2003-12-19 18:57 [RFC] 2.6.0 EDD enhancements Matt Domsch
@ 2003-12-19 19:01 ` Matt Domsch
2003-12-19 19:01 ` Matt Domsch
` (2 subsequent siblings)
3 siblings, 0 replies; 10+ messages in thread
From: Matt Domsch @ 2003-12-19 19:01 UTC (permalink / raw)
To: linux-kernel
This is equivalent to the code in 2.4.23 + fix posted today. -Matt
You can import this changeset into BK by piping this whole message to
'| bk receive [path to repository]' or apply the patch as usual.
===================================================================
ChangeSet@1.1532.1.1, 2003-12-18 15:13:36-06:00, Matt_Domsch@dell.com
EDD: read disk80 MBR signature, export through edd module
There are 4 bytes in the MSDOS master boot record, at offset 0x1b8,
which may contain a per-system-unique signature. By first writing a
unique signature to each disk in the system, then rebooting, and then
reading the MBR to get the signature for the boot disk (int13 dev
80h), userspace may use it to compare against disks it knows as named
/dev/[hs]d[a-z], and thus determine which disk is the BIOS boot disk,
thus where the /boot, / and boot loaders should be placed.
This is useful in the case where the BIOS is not EDD3.0 compliant,
thus doesn't provide the PCI bus/dev/fn and IDE/SCSI location of the
boot disk, yet you need to know which disk is the boot disk. It's
most useful in OS installers.
This patch retrieves the signature from the disk in setup.S, stores it
in a space reserved in the empty_zero_page, copies it somewhere safe
in setup.c, and exports it via
/sys/firmware/edd/int13_disk80/mbr_signature in edd.c. Code is
covered under CONFIG_EDD=[ym].
Documentation/i386/zero-page.txt | 4 +++-
arch/i386/boot/setup.S | 21 +++++++++++++++++++++
arch/i386/kernel/edd.c | 22 +++++++++++++++++++++-
arch/i386/kernel/i386_ksyms.c | 6 ------
arch/i386/kernel/setup.c | 7 +++++++
include/asm-i386/edd.h | 6 +++++-
include/asm-i386/setup.h | 1 +
7 files changed, 58 insertions, 9 deletions
diff -Nru a/Documentation/i386/zero-page.txt b/Documentation/i386/zero-page.txt
--- a/Documentation/i386/zero-page.txt Fri Dec 19 12:52:44 2003
+++ b/Documentation/i386/zero-page.txt Fri Dec 19 12:52:44 2003
@@ -66,8 +66,10 @@
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)
0x2d0 - 0x600 E820MAP
-0x600 - 0x7D4 EDDBUF (setup.S)
+0x600 - 0x7ff EDDBUF (setup.S) for disk signature read sector
+0x600 - 0x7d3 EDDBUF (setup.S) for edd data
0x800 string, 2K max COMMAND_LINE, the kernel commandline as
copied using CL_OFFSET.
diff -Nru a/arch/i386/boot/setup.S b/arch/i386/boot/setup.S
--- a/arch/i386/boot/setup.S Fri Dec 19 12:52:44 2003
+++ b/arch/i386/boot/setup.S Fri Dec 19 12:52:44 2003
@@ -49,6 +49,8 @@
* by Matt Domsch <Matt_Domsch@dell.com> October 2002
* conformant to T13 Committee www.t13.org
* projects 1572D, 1484D, 1386D, 1226DT
+ * disk signature read by Matt Domsch <Matt_Domsch@dell.com>
+ * and Andrew Wilks <Andrew_Wilks@dell.com> September 2003
*/
#include <linux/config.h>
@@ -578,6 +580,25 @@
#endif
#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
+ movb $0x80, %dl # from device 80
+ movb $0, %dh # at head 0
+ movw $1, %cx # cylinder 0, sector 0
+ pushw %es
+ pushw %ds
+ popw %es
+ movw $EDDBUF, %bx
+ int $0x13
+ jc disk_sig_done
+ movl (EDDBUF+MBR_SIG_OFFSET), %eax
+ movl %eax, (DISK80_SIG_BUFFER) # store success
+disk_sig_done:
+ popw %es
+
# Do the BIOS Enhanced Disk Drive calls
# This consists of two calls:
# int 13h ah=41h "Check Extensions Present"
diff -Nru a/arch/i386/kernel/edd.c b/arch/i386/kernel/edd.c
--- a/arch/i386/kernel/edd.c Fri Dec 19 12:52:44 2003
+++ b/arch/i386/kernel/edd.c Fri Dec 19 12:52:44 2003
@@ -2,6 +2,7 @@
* linux/arch/i386/kernel/edd.c
* Copyright (C) 2002, 2003 Dell Inc.
* by Matt Domsch <Matt_Domsch@dell.com>
+ * disk80 signature by Matt Domsch, Andrew Wilks, and Sandeep K. Shandilya
*
* BIOS Enhanced Disk Drive Services (EDD)
* conformant to T13 Committee www.t13.org
@@ -59,7 +60,7 @@
MODULE_DESCRIPTION("sysfs interface to BIOS EDD information");
MODULE_LICENSE("GPL");
-#define EDD_VERSION "0.10 2003-Oct-11"
+#define EDD_VERSION "0.11 2003-Dec-17"
#define EDD_DEVICE_NAME_SIZE 16
#define REPORT_URL "http://domsch.com/linux/edd30/results.html"
@@ -260,6 +261,14 @@
}
static ssize_t
+edd_show_disk80_sig(struct edd_device *edev, char *buf)
+{
+ char *p = buf;
+ p += snprintf(p, left, "0x%08x\n", edd_disk80_sig);
+ return (p - buf);
+}
+
+static ssize_t
edd_show_extensions(struct edd_device *edev, char *buf)
{
struct edd_info *info = edd_dev_get_info(edev);
@@ -429,6 +438,15 @@
return 1;
}
+static int
+edd_has_disk80_sig(struct edd_device *edev)
+{
+ struct edd_info *info = edd_dev_get_info(edev);
+ if (!edev || !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);
@@ -443,6 +461,7 @@
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
@@ -464,6 +483,7 @@
&edd_attr_default_sectors_per_track,
&edd_attr_interface,
&edd_attr_host_bus,
+ &edd_attr_mbr_signature,
NULL,
};
diff -Nru a/arch/i386/kernel/i386_ksyms.c b/arch/i386/kernel/i386_ksyms.c
--- a/arch/i386/kernel/i386_ksyms.c Fri Dec 19 12:52:44 2003
+++ b/arch/i386/kernel/i386_ksyms.c Fri Dec 19 12:52:44 2003
@@ -32,7 +32,6 @@
#include <asm/pgalloc.h>
#include <asm/tlbflush.h>
#include <asm/nmi.h>
-#include <asm/edd.h>
#include <asm/ist.h>
extern void dump_thread(struct pt_regs *, struct user *);
@@ -201,11 +200,6 @@
EXPORT_SYMBOL(kmap_atomic);
EXPORT_SYMBOL(kunmap_atomic);
EXPORT_SYMBOL(kmap_atomic_to_page);
-#endif
-
-#ifdef CONFIG_EDD_MODULE
-EXPORT_SYMBOL(edd);
-EXPORT_SYMBOL(eddnr);
#endif
#if defined(CONFIG_X86_SPEEDSTEP_SMI) || defined(CONFIG_X86_SPEEDSTEP_SMI_MODULE)
diff -Nru a/arch/i386/kernel/setup.c b/arch/i386/kernel/setup.c
--- a/arch/i386/kernel/setup.c Fri Dec 19 12:52:44 2003
+++ b/arch/i386/kernel/setup.c Fri Dec 19 12:52:44 2003
@@ -423,6 +423,12 @@
#if defined(CONFIG_EDD) || defined(CONFIG_EDD_MODULE)
unsigned char eddnr;
struct edd_info edd[EDDMAXNR];
+unsigned int edd_disk80_sig;
+#ifdef CONFIG_EDD_MODULE
+EXPORT_SYMBOL(eddnr);
+EXPORT_SYMBOL(edd);
+EXPORT_SYMBOL(edd_disk80_sig);
+#endif
/**
* copy_edd() - Copy the BIOS EDD information
* from empty_zero_page into a safe place.
@@ -432,6 +438,7 @@
{
eddnr = EDD_NR;
memcpy(edd, EDD_BUF, sizeof(edd));
+ edd_disk80_sig = DISK80_SIGNATURE;
}
#else
#define copy_edd() do {} while (0)
diff -Nru a/include/asm-i386/edd.h b/include/asm-i386/edd.h
--- a/include/asm-i386/edd.h Fri Dec 19 12:52:44 2003
+++ b/include/asm-i386/edd.h Fri Dec 19 12:52:44 2003
@@ -1,6 +1,6 @@
/*
* linux/include/asm-i386/edd.h
- * Copyright (C) 2002 Dell Inc.
+ * Copyright (C) 2002, 2003 Dell Inc.
* by Matt Domsch <Matt_Domsch@dell.com>
*
* structures and definitions for the int 13h, ax={41,48}h
@@ -41,6 +41,9 @@
#define EDDMAGIC1 0x55AA
#define EDDMAGIC2 0xAA55
+#define READ_SECTORS 0x02
+#define MBR_SIG_OFFSET 0x1B8
+#define DISK80_SIG_BUFFER 0x2cc
#ifndef __ASSEMBLY__
#define EDD_EXT_FIXED_DISK_ACCESS (1 << 0)
@@ -167,6 +170,7 @@
extern struct edd_info edd[EDDMAXNR];
extern unsigned char eddnr;
+extern unsigned int edd_disk80_sig;
#endif /*!__ASSEMBLY__ */
#endif /* _ASM_I386_EDD_H */
diff -Nru a/include/asm-i386/setup.h b/include/asm-i386/setup.h
--- a/include/asm-i386/setup.h Fri Dec 19 12:52:44 2003
+++ b/include/asm-i386/setup.h Fri Dec 19 12:52:44 2003
@@ -39,6 +39,7 @@
#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_BUF ((struct edd_info *) (PARAM+EDDBUF))
#define COMMAND_LINE ((char *) (PARAM+2048))
===================================================================
This BitKeeper patch contains the following changesets:
1.1532.1.1
## Wrapped with gzip_uu ##
M'XL( /Q(XS\ [59^7,:.1;^F?XKWL0S.]CAD/K&&:=\@&>I'':!,[M;28H2
MW6K3<1],J[%-EOW?]TD-&# VQHD))K2.3^]]>I?$#GP2/-LO?6!YWFNFL? &
MV@[\,Q7Y?LGG453STA@;.FF*#?5!&O-Z[*MA]?Y5G?M^/0J3T6U5KUE5?-)P
M[#G+O0%<\TSLEVC-F+?DXR'?+W5:?WYZ?]31M(,#.!FPY))W>0X'!UJ>9M<L
M\L4ARP=1FM3RC"4BYCF3(DSF0R<Z(3K^LZAC$,N>4)N8SL2C/J7,I-PGNNG:
MIO:-BT-$"!/N5^,TN>+C6II=?IXM\G49T* Z=:BMVZ8QL1S;U+4FT!JU#+V&
M_P$QZE2O4Q>HM4^-?<.N$GN?$%@@[7!&%KQVH$JT8_BY^IQH'K2:S7W(.//!
M#\65B^L?=T"$EPG+1QFO +\=IED.^2!+1Y<#P.V ./5'$<>Y^+X8\(P#PS\3
M^N.<"P@3',SA0[=YUH68B9QGT,>=QD6\-/,KP')(@T#@!I%;VG<KB'(S"'$O
M8S8&+TUR)!@8#'E6%6.<'E='2?CWB-])50,X'D,09B*'FRS,P^02&,*LCD.Z
M@#-$EJK-!"LP*_)[@C))T7 ^BI7XJ@UQ)!T24^F!="#,)<^+V7/L(,U4B])-
M+5 .DYP:X/-KQ'#)8+<"(_0#,60>5\KA$X2YA,/=&DK2V"4J*XKY0O9=)>F-
M "8@83'W$:>.</7/ _'5_\RJW[_.Y!P)7 >IC=$8I_052@HEU'$;R9]+)BE6
M4V[4;LD!==E9@;J"4P.CE/DH+(A!.HJPC<,P0L']&DZ&8JL1'-^H13"*9G1Z
M3/ %7+4P#DH0$4W+J!&E:Q2R))^+X:=<)+_G,,S2Z] O)IZ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OGDEN=\R(_7\-)EQ5R[&OU[.@;M/YK'8'#'R/"Z$MK3"_H)P7]:?WA:/
MI-M$F6<?E37FQ?S00^F\/+Q6L+5^]I2S,B$NT2T#$ZNI&TZ1_*QMZS0,QO9+
MQAW<+G7<F5WYHP+]-,+SDNI %XKE]>KTM@P#37'LWW2X6R3C676;+/^;.C'!
M6F\&4X&>80%;729J[&H8'Z;"CU9^\WG\/I'H.K5TT]!QYQM8X:MC/=FV\'G9
M7W]DX=/Z]_E9YZ+7_<^'X[/W\HR,;<NEJ+R3'LO\HNY%-VW[S$R>D6%,W0);
M>[0HW@D#K+ 7;J9['\Z:G]ZWM"4U\!CJ)QF>\^ZUKFM;/AKN\,0/ WD*4)<,
M\K5"Q\%"=?_QZ.)3I_5F_7EQ>E&ZV4!_[-KV?BGTZ)7MO!AR)@AL6\\Z.KYL
M*21M<)5CB)F7I6B&Q3WSIN/B5.-GF2%=N 6Z)T9YK[QHH7N[4#X_ZAQ]>'T_
=T>W>_7[M#;AWA;7# =5UUT*%M?\#,' W/"L?
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [RFC] 2.6.0 EDD enhancements
2003-12-19 18:57 [RFC] 2.6.0 EDD enhancements Matt Domsch
2003-12-19 19:01 ` Matt Domsch
@ 2003-12-19 19:01 ` Matt Domsch
2003-12-19 20:23 ` James Bottomley
2003-12-28 20:08 ` Christoph Hellwig
2003-12-19 19:01 ` Matt Domsch
2003-12-19 19:03 ` Randy.Dunlap
3 siblings, 2 replies; 10+ messages in thread
From: Matt Domsch @ 2003-12-19 19:01 UTC (permalink / raw)
To: linux-kernel; +Cc: linux-scsi
You can import this changeset into BK by piping this whole message to
'| bk receive [path to repository]' or apply the patch as usual.
===================================================================
ChangeSet@1.1532.1.2, 2003-12-18 16:35:16-06:00, Matt_Domsch@dell.com
EDD: enable symlinks to SCSI devices
Symlinks from /sys/firmware/edd/int13_dev8x/disc to the appropriate
SCSI discs were added a year ago, but disabled because the
scsi_bus list contained non-'scsi_device's at that time, which
could have lead to an improper pointer following. The SCSI
mid-layer has rectified this, so this code can be re-enabled
in edd.c once again.
edd.c | 18 ++++--------------
1 files changed, 4 insertions, 14 deletions
diff -Nru a/arch/i386/kernel/edd.c b/arch/i386/kernel/edd.c
--- a/arch/i386/kernel/edd.c Fri Dec 19 12:53:18 2003
+++ b/arch/i386/kernel/edd.c Fri Dec 19 12:53:18 2003
@@ -60,7 +60,7 @@
MODULE_DESCRIPTION("sysfs interface to BIOS EDD information");
MODULE_LICENSE("GPL");
-#define EDD_VERSION "0.11 2003-Dec-17"
+#define EDD_VERSION "0.12 2003-Dec-18"
#define EDD_DEVICE_NAME_SIZE 16
#define REPORT_URL "http://domsch.com/linux/edd30/results.html"
@@ -561,16 +561,6 @@
return sysfs_create_link(&edev->kobj,&pci_dev->dev.kobj,"pci_dev");
}
-/*
- * FIXME - as of 15-Jan-2003, there are some non-"scsi_device"s on the
- * scsi_bus list. The following functions could possibly mis-access
- * memory in that case. This is actually a problem with the SCSI
- * layer, which is being addressed there. Until then, don't use the
- * SCSI functions.
- */
-
-#undef CONFIG_SCSI
-#undef CONFIG_SCSI_MODULE
#if defined(CONFIG_SCSI) || defined(CONFIG_SCSI_MODULE)
struct edd_match_data {
@@ -639,11 +629,11 @@
pci_dev = edd_get_pci_dev(edev);
if (pci_dev) {
struct scsi_device * sdev = edd_find_matching_scsi_device(edev);
- if (sdev && get_device(&sdev->sdev_driverfs_dev)) {
+ if (sdev && get_device(&sdev->sdev_gendev)) {
rc = sysfs_create_link(&edev->kobj,
- &sdev->sdev_driverfs_dev.kobj,
+ &sdev->sdev_gendev.kobj,
"disc");
- put_device(&sdev->sdev_driverfs_dev);
+ put_device(&sdev->sdev_gendev);
}
}
return rc;
===================================================================
This BitKeeper patch contains the following changesets:
1.1532.1.2
## Wrapped with gzip_uu ##
M'XL( !Y)XS\ \55:8_;-A#];/V*01;8).A*(JG#1^$@[7K1+GIDL6[ZU:#)
MD<5:$@V17L>H?WR'<HX>VP!;!"@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ements
2003-12-19 18:57 [RFC] 2.6.0 EDD enhancements Matt Domsch
2003-12-19 19:01 ` Matt Domsch
2003-12-19 19:01 ` Matt Domsch
@ 2003-12-19 19:01 ` Matt Domsch
2003-12-19 19:03 ` Randy.Dunlap
3 siblings, 0 replies; 10+ messages in thread
From: Matt Domsch @ 2003-12-19 19:01 UTC (permalink / raw)
To: linux-kernel
You can import this changeset into BK by piping this whole message to
'| bk receive [path to repository]' or apply the patch as usual.
===================================================================
ChangeSet@1.1532.1.3, 2003-12-18 17:43:51-06:00, Matt_Domsch@dell.com
EDD: add sysfs symlinks for IDE devices
Devices reporting as type "ATA" to the EDD 3.0 BIOS calls
now get symlinks pointing from the int13_dev8x device
to the IDE disk device in sysfs.
EDD 3.0 maps all IDE devices on a single PCI device with a single
device value; there's no concept of multiple channels,
primary/secondary devices on a channel. This may not be equivalent,
but edd.c currently matches only based on ide_drive_t.lun ==
EDD device value. This should perhaps be taken up with
the T13 committee, as their spec seems incomplete in this regard.
edd.c | 88 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 87 insertions, 1 deletion
diff -Nru a/arch/i386/kernel/edd.c b/arch/i386/kernel/edd.c
--- a/arch/i386/kernel/edd.c Fri Dec 19 12:53:46 2003
+++ b/arch/i386/kernel/edd.c Fri Dec 19 12:53:46 2003
@@ -55,12 +55,13 @@
/* FIXME - this really belongs in include/scsi/scsi.h */
#include <../drivers/scsi/scsi.h>
#include <../drivers/scsi/hosts.h>
+#include <linux/ide.h>
MODULE_AUTHOR("Matt Domsch <Matt_Domsch@Dell.com>");
MODULE_DESCRIPTION("sysfs interface to BIOS EDD information");
MODULE_LICENSE("GPL");
-#define EDD_VERSION "0.12 2003-Dec-18"
+#define EDD_VERSION "0.13 2003-Dec-18"
#define EDD_DEVICE_NAME_SIZE 16
#define REPORT_URL "http://domsch.com/linux/edd30/results.html"
@@ -647,6 +648,90 @@
}
#endif
+#if defined(CONFIG_IDE) || defined(CONFIG_IDE_MODULE)
+
+struct edd_ide_match_data {
+ struct edd_device * edev;
+ ide_drive_t * ide_drive;
+};
+
+/**
+ * edd_match_idedev()
+ * @edev - EDD device is a known IDE device
+ * @sd - ide_device with host who's parent is a PCI controller
+ *
+ * returns 1 if a match is found, 0 if not.
+ */
+static int edd_match_idedev(struct device * dev, void * d)
+{
+ struct edd_ide_match_data * data = (struct edd_ide_match_data *)d;
+ struct edd_info *info = edd_dev_get_info(data->edev);
+ ide_drive_t * drive = container_of(dev,ide_drive_t,gendev);
+
+ if (info && drive) {
+ if (drive->lun == info->params.device_path.ata.device) {
+ data->ide_drive = drive;
+ return 1;
+ }
+ }
+ return 0;
+}
+
+/**
+ * edd_find_matching_ide_device()
+ * @edev - edd_device to match
+ *
+ * Search the IDE devices for a drive that matches the EDD
+ * device descriptor we have. If we find a match, return it,
+ * otherwise, return NULL.
+ */
+
+static ide_drive_t *
+edd_find_matching_ide_device(struct edd_device *edev)
+{
+ struct edd_ide_match_data data;
+ struct bus_type * ide_bus = find_bus("ide");
+
+ if (!ide_bus) {
+ return NULL;
+ }
+
+ data.edev = edev;
+
+ if (edd_dev_is_type(edev, "ATA")) {
+ if (bus_for_each_dev(ide_bus,NULL,&data,edd_match_idedev))
+ return data.ide_drive;
+ }
+ return NULL;
+}
+
+static int
+edd_create_symlink_to_idedev(struct edd_device *edev)
+{
+ struct pci_dev *pci_dev;
+ int rc = -EINVAL;
+
+ pci_dev = edd_get_pci_dev(edev);
+ if (pci_dev) {
+ ide_drive_t * ide_drive = edd_find_matching_ide_device(edev);
+ if (ide_drive && get_device(&ide_drive->gendev)) {
+ rc = sysfs_create_link(&edev->kobj,
+ &ide_drive->gendev.kobj,
+ "disc");
+ put_device(&ide_drive->gendev);
+ }
+ }
+ return rc;
+}
+
+#else
+static int
+edd_create_symlink_to_idedev(struct edd_device *edev)
+{
+ return -ENOSYS;
+}
+#endif
+
static inline void
edd_device_unregister(struct edd_device *edev)
@@ -669,6 +754,7 @@
if (!error) {
edd_create_symlink_to_pcidev(edev);
edd_create_symlink_to_scsidev(edev);
+ edd_create_symlink_to_idedev(edev);
}
}
===================================================================
This BitKeeper patch contains the following changesets:
1.1532.1.3
## Wrapped with gzip_uu ##
M'XL( #I)XS\ \57;4_C1A#^'/^*:9!HDL:.-\X[#8(C]!H=!PB.DRJ=9"WV
M!KMQ['1W#8>:^^^=76\2!VBDJTXJ1,&[._/,[#-OY@#N!..CRD<JI3_)%B*(
MK /X/1-R5 E9DCA!ML"-FRS#C5:4+5AK$6JQUOV\Q<*PE<1I_M5N.UT;5Q;*
M7E,91/#(N!A5B.-M=N3SDHTJ-^?O[RY.;RQK/(:SB*8/[)9)&(\MF?%'FH3B
MA,HHR5)'<IJ*!9-4N;#:B*[:KMO&WR[I>VZWMR(]M]-?!20DA'8("]UV9]#K
M6*7[G*SOL0OBD389M-M>E_16W?ZP1ZP)$(=TO;:#7H/KM4B[109 ^J..-^H2
MV^V-7!?> H9?"-BN]0Y^[!W.K #.)Y,1T# $\2QF K\7R/=<P"SC,)V<0\@>
MXX )E,3/I%@ 9\N,RSA] "HT[5 ]_71:1?= 1DQA@N>X\&YZ=0L!31*EGF9/
M\("1V%A89G&J,68<;ZCT<$T\'RT.OAJ[J&<PM2^QF)L#E"T\=@K/UB87="D
M+99]ARP%"@)-)0RNSZ9KB*=81IL#Q##;2'#.CI11SGX6Z#<$61JPI81L!HL\
MD?$2<0+D.F6):*+BDL<+RI];@J%DB$^[EHVH _ IB@6Z^(R@$NX9L+_R&,VQ
M5"J8^UP"IK@30)!SCIO),PIC9FL@7-Q3P4*%&8?,#WG\R'SI)'FJLKN@H'R%
MM3T197D2PI+Q2)	B6=LQ3RI69 48S\?B(>WG.QB*5DK*GC&K&8@UBR 1C
M"X&4HP#>76KVI<+F[('RT+$^0)'AU]N2L^SO_+$LE[K6\9L%L*(<&T+L#7JM
M.>-(9DL3I?.<N.ZP[1*OVUF1;KO?60U[O6%_-NO?T]";]6GPO8A%X7H=K^.N
MR)!TAKJ7O"VOJ/_A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W^?%J^+G
M01&S WRW93\D<@;8/K^\NOWC5J$?H.UXAD:FO3[!:5NI[ 4W#&_^S\,6$<Q%
3OA@S;]CO]?M#ZQ\^.P-/90X
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [RFC] 2.6.0 EDD enhancements
2003-12-19 18:57 [RFC] 2.6.0 EDD enhancements Matt Domsch
` (2 preceding siblings ...)
2003-12-19 19:01 ` Matt Domsch
@ 2003-12-19 19:03 ` Randy.Dunlap
3 siblings, 0 replies; 10+ messages in thread
From: Randy.Dunlap @ 2003-12-19 19:03 UTC (permalink / raw)
To: Matt Domsch; +Cc: linux-kernel
On Fri, 19 Dec 2003 12:57:06 -0600 (CST) Matt Domsch <Matt_Domsch@dell.com> wrote:
| For review and comment, three changesets against 2.6.0 at:
|
| bk pull http://mdomsch.bkbits.net/linux-2.5-edd
|
| This will update the following files:
|
| Documentation/i386/zero-page.txt | 4 -
| arch/i386/boot/setup.S | 21 ++++++
| arch/i386/kernel/edd.c | 128 ++++++++++++++++++++++++++++++++++-----
| arch/i386/kernel/i386_ksyms.c | 6 -
| arch/i386/kernel/setup.c | 7 ++
| include/asm-i386/edd.h | 6 +
| include/asm-i386/setup.h | 1
| 7 files changed, 149 insertions, 24 deletions
|
...
|
|
| Patches will follow. Feedback welcome.
Where is a diff/patch file available for review?
Thanks,
--
~Randy
MOTD: Always include version info.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [RFC] 2.6.0 EDD enhancements
2003-12-19 19:01 ` Matt Domsch
@ 2003-12-19 20:23 ` James Bottomley
2003-12-19 20:37 ` Matt Domsch
2003-12-28 20:08 ` Christoph Hellwig
1 sibling, 1 reply; 10+ messages in thread
From: James Bottomley @ 2003-12-19 20:23 UTC (permalink / raw)
To: Matt Domsch; +Cc: Linux Kernel, SCSI Mailing List
On Fri, 2003-12-19 at 14:01, Matt Domsch wrote:
> @@ -639,11 +629,11 @@
> pci_dev = edd_get_pci_dev(edev);
> if (pci_dev) {
> struct scsi_device * sdev = edd_find_matching_scsi_device(edev);
> - if (sdev && get_device(&sdev->sdev_driverfs_dev)) {
> + if (sdev && get_device(&sdev->sdev_gendev)) {
> rc = sysfs_create_link(&edev->kobj,
> - &sdev->sdev_driverfs_dev.kobj,
> + &sdev->sdev_gendev.kobj,
> "disc");
> - put_device(&sdev->sdev_driverfs_dev);
> + put_device(&sdev->sdev_gendev);
This is a bit nasty...you're assuming a lot of hidden knowledge about
the layout of sysfs objects in scsi_device in this code.
The current(*) way you should be doing this is to use scsi_device_get()
in your edd_match_scsi_dev() and do a scsi_device_put() after creating
the link...that should be hotplug robust.
(*) since SCSI hotplug is a work in progress, this may change...
James
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [RFC] 2.6.0 EDD enhancements
2003-12-19 20:23 ` James Bottomley
@ 2003-12-19 20:37 ` Matt Domsch
2003-12-19 21:03 ` James Bottomley
0 siblings, 1 reply; 10+ messages in thread
From: Matt Domsch @ 2003-12-19 20:37 UTC (permalink / raw)
To: James Bottomley; +Cc: Linux Kernel, SCSI Mailing List
> This is a bit nasty...you're assuming a lot of hidden knowledge about
> the layout of sysfs objects in scsi_device in this code.
>
> The current(*) way you should be doing this is to use scsi_device_get()
> in your edd_match_scsi_dev() and do a scsi_device_put() after creating
> the link...that should be hotplug robust.
Ok, I'll gladly make that change, but I still need a handle on the
sdev_gendev.kobj in order to make the symlink:
> rc = sysfs_create_link(&edev->kobj,
> &sdev->sdev_gendev.kobj,
> "disc");
While there's an accessor function to_scsi_device() to go from the
struct device to the struct scsi_device, there's not accessor to go from the
scsi_device to the struct device, which would further abstract
struct internals. Can I get such added to a SCSI header file?
Something like:
static inline struct device *
sdev_to_gendev(struct scsi_device *sdev)
{
return &sdev->sdev_gendev;
}
Thanks,
Matt
--
Matt Domsch
Sr. Software Engineer, Lead Engineer
Dell Linux Solutions www.dell.com/linux
Linux on Dell mailing lists @ http://lists.us.dell.com
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [RFC] 2.6.0 EDD enhancements
2003-12-19 20:37 ` Matt Domsch
@ 2003-12-19 21:03 ` James Bottomley
0 siblings, 0 replies; 10+ messages in thread
From: James Bottomley @ 2003-12-19 21:03 UTC (permalink / raw)
To: Matt Domsch; +Cc: Linux Kernel, SCSI Mailing List
On Fri, 2003-12-19 at 15:37, Matt Domsch wrote:
> Ok, I'll gladly make that change, but I still need a handle on the
> sdev_gendev.kobj in order to make the symlink:
the scsi device does its refcounting through the generic device (and
hence the kobject), so scsi_device_get() does get a handle on the
kobject for you (as well as doing some checks with the SCSI state model
and getting a handle on the underlying module).
> static inline struct device *
> sdev_to_gendev(struct scsi_device *sdev)
> {
> return &sdev->sdev_gendev;
> }
I'm not too sure about this...exporting such a function might be seen as
encouraging further abuse...
James
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [RFC] 2.6.0 EDD enhancements
2003-12-19 19:01 ` Matt Domsch
2003-12-19 20:23 ` James Bottomley
@ 2003-12-28 20:08 ` Christoph Hellwig
2003-12-29 20:05 ` Matt Domsch
1 sibling, 1 reply; 10+ messages in thread
From: Christoph Hellwig @ 2003-12-28 20:08 UTC (permalink / raw)
To: Matt Domsch; +Cc: linux-kernel, linux-scsi
On Fri, Dec 19, 2003 at 01:01:29PM -0600, Matt Domsch wrote:
> ChangeSet@1.1532.1.2, 2003-12-18 16:35:16-06:00, Matt_Domsch@dell.com
> EDD: enable symlinks to SCSI devices
>
> Symlinks from /sys/firmware/edd/int13_dev8x/disc to the appropriate
> SCSI discs were added a year ago, but disabled because the
> scsi_bus list contained non-'scsi_device's at that time, which
> could have lead to an improper pointer following. The SCSI
> mid-layer has rectified this, so this code can be re-enabled
> in edd.c once again.
As James already said you're poking far too deep into scsi internals.
In addition to his comment I'd suggest putting the symlink creating
into scsi_sysfs.c and exporting a procedural interface for the edd
code. That way it'll get updated automatically if we change something.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [RFC] 2.6.0 EDD enhancements
2003-12-28 20:08 ` Christoph Hellwig
@ 2003-12-29 20:05 ` Matt Domsch
0 siblings, 0 replies; 10+ messages in thread
From: Matt Domsch @ 2003-12-29 20:05 UTC (permalink / raw)
To: Christoph Hellwig, linux-kernel, linux-scsi
> As James already said you're poking far too deep into scsi internals.
> In addition to his comment I'd suggest putting the symlink creating
> into scsi_sysfs.c and exporting a procedural interface for the edd
> code. That way it'll get updated automatically if we change something.
Thanks for the feedback. I'll rework it to move to scsi_sysfs.c (and
for the similar IDE and pci_dev pieces likewise).
Thanks,
Matt
--
Matt Domsch
Sr. Software Engineer, Lead Engineer
Dell Linux Solutions www.dell.com/linux
Linux on Dell mailing lists @ http://lists.us.dell.com
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2003-12-29 20:10 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-12-19 18:57 [RFC] 2.6.0 EDD enhancements Matt Domsch
2003-12-19 19:01 ` Matt Domsch
2003-12-19 19:01 ` Matt Domsch
2003-12-19 20:23 ` James Bottomley
2003-12-19 20:37 ` Matt Domsch
2003-12-19 21:03 ` James Bottomley
2003-12-28 20:08 ` Christoph Hellwig
2003-12-29 20:05 ` Matt Domsch
2003-12-19 19:01 ` Matt Domsch
2003-12-19 19:03 ` Randy.Dunlap
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox