lkml.org 
[lkml]   [2003]   [Dec]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [RFC] 2.6.0 EDD enhancements
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.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CO]?M#ZQ\^.P-/90X

-
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:59    [W:0.071 / U:0.064 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site