Skip to contentSkip to conversation

Driver Core update for 2.6.4-rc1

PATCH New Greg KH 3 participants 17 messages Mar 3, 2004

Subsystems (13)
lore
Share & tools
lore

Greg KH

author
#0 lore raw

PATCH 1/1 Driver Core update for 2.6.4-rc1

Hi,

Here are a few driver core changes for 2.6.4-rc1. There are a few patches from Randy Dunlap that finish up his big sys_* cleanups, and the ibm service processor driver has been added as well as some other minor bugfixes. All of these patches have been in the -mm tree for a while now.

Please pull from:

	bk://kernel.bkbits.net/gregkh/linux/driver-2.6

thanks,

greg k-h

p.s. I'll send these as patches in response to this email to lkml for those who want to see them.

 arch/arm/kernel/time.c                   |    2 
 arch/arm/mach-integrator/integrator_ap.c |    2 
 arch/arm/mach-sa1100/irq.c               |    2 
 arch/i386/kernel/apic.c                  |    4 
 arch/i386/kernel/i8259.c                 |    4 
 arch/i386/kernel/nmi.c                   |    2 
 arch/i386/kernel/time.c                  |    2 
 arch/i386/oprofile/nmi_int.c             |    8 
 arch/mips/kernel/i8259.c                 |    4 
 arch/ppc/platforms/pmac_pic.c            |    2 
 arch/ppc/syslib/open_pic.c               |    2 
 arch/ppc/syslib/open_pic2.c              |    2 
 arch/x86_64/kernel/apic.c                |    4 
 arch/x86_64/kernel/i8259.c               |    4 
 arch/x86_64/kernel/mce.c                 |    4 
 arch/x86_64/kernel/nmi.c                 |    4 
 arch/x86_64/kernel/time.c                |    4 
 drivers/Kconfig                          |    2 
 drivers/base/Kconfig                     |   11 
 drivers/base/bus.c                       |    5 
 drivers/base/class.c                     |    5 
 drivers/base/class_simple.c              |    5 
 drivers/base/core.c                      |    5 
 drivers/base/cpu.c                       |    2 
 drivers/base/driver.c                    |    5 
 drivers/base/init.c                      |    4 
 drivers/base/node.c                      |    2 
 drivers/base/power/main.c                |    5 
 drivers/base/power/shutdown.c            |    7 
 drivers/base/sys.c                       |   19 
 drivers/char/misc.c                      |   24 -
 drivers/input/serio/i8042.c              |    4 
 drivers/misc/Kconfig                     |   17 
 drivers/misc/Makefile                    |    2 
 drivers/misc/ibmasm/Makefile             |   13 
 drivers/misc/ibmasm/command.c            |  175 +++++++
 drivers/misc/ibmasm/dot_command.c        |  146 ++++++
 drivers/misc/ibmasm/dot_command.h        |   78 +++
 drivers/misc/ibmasm/event.c              |  169 +++++++
 drivers/misc/ibmasm/heartbeat.c          |   91 +++
 drivers/misc/ibmasm/i2o.h                |   77 +++
 drivers/misc/ibmasm/ibmasm.h             |  224 +++++++++
 drivers/misc/ibmasm/ibmasmfs.c           |  717 +++++++++++++++++++++++++++++++
 drivers/misc/ibmasm/lowlevel.c           |   81 +++
 drivers/misc/ibmasm/lowlevel.h           |  137 +++++
 drivers/misc/ibmasm/module.c             |  210 +++++++++
 drivers/misc/ibmasm/r_heartbeat.c        |   98 ++++
 drivers/misc/ibmasm/remote.c             |  152 ++++++
 drivers/misc/ibmasm/remote.h             |  119 +++++
 drivers/misc/ibmasm/uart.c               |   72 +++
 drivers/s390/block/xpram.c               |   12 
 include/linux/sysdev.h                   |    4 
 lib/kobject.c                            |   11 
 53 files changed, 2695 insertions(+), 71 deletions(-)

-----

<masbock:us.ibm.com>:
o Driver for IBM service processor - updated (2/2)
o Driver for IBM service processor - updated (1/2)

Andrew Morton:
o fix x86_64 build for sys_device_register rename

Greg Kroah-Hartman:
o Driver core: add CONFIG_DEBUG_DRIVER to help track down driver core bugs easier
o Make IBMASM driver depend on X86 as that is the only valid platform for it
o kobject: clean up kobject_get() convoluted logic
o kobject: fix kobject hotplug debug message to show more needed info

Randy Dunlap:
o rename sys_bus_init()
o sys_device_[un]register() are not syscalls

Stephen Hemminger:
o propogate errors from misc_register to caller

author
#1 lore raw

PATCH 1/1 Driver Core update for 2.6.4-rc1

ChangeSet 1.1557.72.1, 2004/02/19 13:09:14-08:00, [email protected]

[PATCH] sys_device_[un]register() are not syscalls

sys_xyz() names in Linux are all syscalls... except for sys_device_register() and sys_device_unregister().

This patch renames them so that the sys_ namespace is once again used only by syscalls.

 arch/arm/kernel/time.c                   |    2 +-
 arch/arm/mach-integrator/integrator_ap.c |    2 +-
 arch/arm/mach-sa1100/irq.c               |    2 +-
 arch/i386/kernel/apic.c                  |    2 +-
 arch/i386/kernel/i8259.c                 |    4 ++--
 arch/i386/kernel/nmi.c                   |    2 +-
 arch/i386/kernel/time.c                  |    2 +-
 arch/i386/oprofile/nmi_int.c             |    4 ++--
 arch/mips/kernel/i8259.c                 |    2 +-
 arch/ppc/platforms/pmac_pic.c            |    2 +-
 arch/ppc/syslib/open_pic.c               |    2 +-
 arch/ppc/syslib/open_pic2.c              |    2 +-
 arch/x86_64/kernel/apic.c                |    2 +-
 arch/x86_64/kernel/i8259.c               |    2 +-
 arch/x86_64/kernel/nmi.c                 |    2 +-
 drivers/base/cpu.c                       |    2 +-
 drivers/base/node.c                      |    2 +-
 drivers/base/sys.c                       |   12 ++++++------
 drivers/input/serio/i8042.c              |    4 ++--
 drivers/s390/block/xpram.c               |    6 +++---
 include/linux/sysdev.h                   |    4 ++--
 21 files changed, 32 insertions(+), 32 deletions(-)
arch/arm/kernel/time.c +1 -1
diff -Nru a/arch/arm/kernel/time.c b/arch/arm/kernel/time.c
@@ -178,7 +178,7 @@
 	int ret;
 	ret = sysdev_class_register(&leds_sysclass);
 	if (ret == 0)
-		ret = sys_device_register(&leds_device);
+		ret = sysdev_register(&leds_device);
 	return ret;
 }
 
arch/arm/mach-integrator/integrator_ap.c +1 -1
diff -Nru a/arch/arm/mach-integrator/integrator_ap.c b/arch/arm/mach-integrator/integrator_ap.c
@@ -173,7 +173,7 @@
 {
 	int ret = sysdev_class_register(&irq_class);
 	if (ret == 0)
-		ret = sys_device_register(&irq_device);
+		ret = sysdev_register(&irq_device);
 	return ret;
 }
 
arch/arm/mach-sa1100/irq.c +1 -1
diff -Nru a/arch/arm/mach-sa1100/irq.c b/arch/arm/mach-sa1100/irq.c
@@ -278,7 +278,7 @@
 static int __init sa1100irq_init_devicefs(void)
 {
 	sysdev_class_register(&sa1100irq_sysclass);
-	return sys_device_register(&sa1100irq_device);
+	return sysdev_register(&sa1100irq_device);
 }
 
 device_initcall(sa1100irq_init_devicefs);
arch/i386/kernel/apic.c +1 -1
diff -Nru a/arch/i386/kernel/apic.c b/arch/i386/kernel/apic.c
@@ -595,7 +595,7 @@
 
 	error = sysdev_class_register(&lapic_sysclass);
 	if (!error)
-		error = sys_device_register(&device_lapic);
+		error = sysdev_register(&device_lapic);
 	return error;
 }
 device_initcall(init_lapic_sysfs);
arch/i386/kernel/i8259.c +2 -2
diff -Nru a/arch/i386/kernel/i8259.c b/arch/i386/kernel/i8259.c
@@ -258,7 +258,7 @@
 {
 	int error = sysdev_class_register(&i8259_sysdev_class);
 	if (!error)
-		error = sys_device_register(&device_i8259A);
+		error = sysdev_register(&device_i8259A);
 	return error;
 }
 
@@ -401,7 +401,7 @@
 {
 	int error = sysdev_class_register(&timer_sysclass);
 	if (!error)
-		error = sys_device_register(&device_timer);
+		error = sysdev_register(&device_timer);
 	return error;
 }
 
arch/i386/kernel/nmi.c +1 -1
diff -Nru a/arch/i386/kernel/nmi.c b/arch/i386/kernel/nmi.c
@@ -248,7 +248,7 @@
 
 	error = sysdev_class_register(&nmi_sysclass);
 	if (!error)
-		error = sys_device_register(&device_lapic_nmi);
+		error = sysdev_register(&device_lapic_nmi);
 	return error;
 }
 /* must come after the local APIC's device_initcall() */
arch/i386/kernel/time.c +1 -1
diff -Nru a/arch/i386/kernel/time.c b/arch/i386/kernel/time.c
@@ -346,7 +346,7 @@
 {
 	int error = sysdev_class_register(&pit_sysclass);
 	if (!error)
-		error = sys_device_register(&device_i8253);
+		error = sysdev_register(&device_i8253);
 	return error;
 }
 
arch/i386/oprofile/nmi_int.c +2 -2
diff -Nru a/arch/i386/oprofile/nmi_int.c b/arch/i386/oprofile/nmi_int.c
@@ -65,14 +65,14 @@
 {
 	int error;
 	if (!(error = sysdev_class_register(&oprofile_sysclass)))
-		error = sys_device_register(&device_oprofile);
+		error = sysdev_register(&device_oprofile);
 	return error;
 }
 
 
 static void __exit exit_driverfs(void)
 {
-	sys_device_unregister(&device_oprofile);
+	sysdev_unregister(&device_oprofile);
 	sysdev_class_unregister(&oprofile_sysclass);
 }
 
arch/mips/kernel/i8259.c +1 -1
diff -Nru a/arch/mips/kernel/i8259.c b/arch/mips/kernel/i8259.c
@@ -242,7 +242,7 @@
 {
 	int error = sysdev_class_register(&i8259_sysdev_class);
 	if (!error)
-		error = sys_device_register(&device_i8259A);
+		error = sysdev_register(&device_i8259A);
 	return error;
 }
 
arch/ppc/platforms/pmac_pic.c +1 -1
diff -Nru a/arch/ppc/platforms/pmac_pic.c b/arch/ppc/platforms/pmac_pic.c
@@ -646,7 +646,7 @@
 
 	printk(KERN_DEBUG "Registering pmac pic with sysfs...\n");
 	sysdev_class_register(&pmacpic_sysclass);
-	sys_device_register(&device_pmacpic);
+	sysdev_register(&device_pmacpic);
 	sysdev_driver_register(&pmacpic_sysclass, &driver_pmacpic);
 	return 0;
 }
arch/ppc/syslib/open_pic.c +1 -1
diff -Nru a/arch/ppc/syslib/open_pic.c b/arch/ppc/syslib/open_pic.c
@@ -1032,7 +1032,7 @@
 		printk(KERN_ERR "Failed registering openpic sys class\n");
 		return -ENODEV;
 	}
-	rc = sys_device_register(&device_openpic);
+	rc = sysdev_register(&device_openpic);
 	if (rc) {
 		printk(KERN_ERR "Failed registering openpic sys device\n");
 		return -ENODEV;
arch/ppc/syslib/open_pic2.c +1 -1
diff -Nru a/arch/ppc/syslib/open_pic2.c b/arch/ppc/syslib/open_pic2.c
@@ -699,7 +699,7 @@
 		printk(KERN_ERR "Failed registering openpic sys class\n");
 		return -ENODEV;
 	}
-	rc = sys_device_register(&device_openpic2);
+	rc = sysdev_register(&device_openpic2);
 	if (rc) {
 		printk(KERN_ERR "Failed registering openpic sys device\n");
 		return -ENODEV;
arch/x86_64/kernel/apic.c +1 -1
diff -Nru a/arch/x86_64/kernel/apic.c b/arch/x86_64/kernel/apic.c
@@ -552,7 +552,7 @@
 	/* XXX: remove suspend/resume procs if !apic_pm_state.active? */
 	error = sysdev_class_register(&lapic_sysclass);
 	if (!error)
-		error = sys_device_register(&device_lapic);
+		error = sysdev_register(&device_lapic);
 	return error;
 }
 device_initcall(init_lapic_sysfs);
arch/x86_64/kernel/i8259.c +1 -1
diff -Nru a/arch/x86_64/kernel/i8259.c b/arch/x86_64/kernel/i8259.c
@@ -430,7 +430,7 @@
 {
 	int error = sysdev_class_register(&timer_sysclass);
 	if (!error)
-		error = sys_device_register(&device_timer);
+		error = sysdev_register(&device_timer);
 	return error;
 }
 
arch/x86_64/kernel/nmi.c +1 -1
diff -Nru a/arch/x86_64/kernel/nmi.c b/arch/x86_64/kernel/nmi.c
@@ -218,7 +218,7 @@
 
 	error = sysdev_class_register(&nmi_sysclass);
 	if (!error)
-		error = sys_device_register(&device_lapic_nmi);
+		error = sysdev_register(&device_lapic_nmi);
 	return error;
 }
 /* must come after the local APIC's device_initcall() */
drivers/base/cpu.c +1 -1
diff -Nru a/drivers/base/cpu.c b/drivers/base/cpu.c
@@ -29,7 +29,7 @@
 	cpu->sysdev.id = num;
 	cpu->sysdev.cls = &cpu_sysdev_class;
 
-	error = sys_device_register(&cpu->sysdev);
+	error = sysdev_register(&cpu->sysdev);
 	if (!error && root)
 		error = sysfs_create_link(&root->sysdev.kobj,
 					  &cpu->sysdev.kobj,
drivers/base/node.c +1 -1
diff -Nru a/drivers/base/node.c b/drivers/base/node.c
@@ -69,7 +69,7 @@
 	node->cpumap = node_to_cpumask(num);
 	node->sysdev.id = num;
 	node->sysdev.cls = &node_class;
-	error = sys_device_register(&node->sysdev);
+	error = sysdev_register(&node->sysdev);
 
 	if (!error){
 		sysdev_create_file(&node->sysdev, &attr_cpumap);
drivers/base/sys.c +6 -6
diff -Nru a/drivers/base/sys.c b/drivers/base/sys.c
@@ -8,7 +8,7 @@
  * 
  * This exports a 'system' bus type. 
  * By default, a 'sys' bus gets added to the root of the system. There will
- * always be core system devices. Devices can use sys_device_register() to
+ * always be core system devices. Devices can use sysdev_register() to
  * add themselves as children of the system bus.
  */
 
@@ -164,11 +164,11 @@
 
 
 /**
- *	sys_device_register - add a system device to the tree
+ *	sysdev_register - add a system device to the tree
  *	@sysdev:	device in question
  *
  */
-int sys_device_register(struct sys_device * sysdev)
+int sysdev_register(struct sys_device * sysdev)
 {
 	int error;
 	struct sysdev_class * cls = sysdev->cls;
@@ -212,7 +212,7 @@
 	return error;
 }
 
-void sys_device_unregister(struct sys_device * sysdev)
+void sysdev_unregister(struct sys_device * sysdev)
 {
 	struct sysdev_driver * drv;
 
@@ -390,5 +390,5 @@
 	return subsystem_register(&system_subsys);
 }
 
-EXPORT_SYMBOL(sys_device_register);
-EXPORT_SYMBOL(sys_device_unregister);
+EXPORT_SYMBOL(sysdev_register);
+EXPORT_SYMBOL(sysdev_unregister);
drivers/input/serio/i8042.c +2 -2
diff -Nru a/drivers/input/serio/i8042.c b/drivers/input/serio/i8042.c
@@ -957,7 +957,7 @@
 	mod_timer(&i8042_timer, jiffies + I8042_POLL_PERIOD);
 
         if (sysdev_class_register(&kbc_sysclass) == 0) {
-                if (sys_device_register(&device_i8042) == 0)
+                if (sysdev_register(&device_i8042) == 0)
 			i8042_sysdev_initialized = 1;
 		else
 			sysdev_class_unregister(&kbc_sysclass);
@@ -980,7 +980,7 @@
 		pm_unregister(i8042_pm_dev);
 
 	if (i8042_sysdev_initialized) {
-		sys_device_unregister(&device_i8042);
+		sysdev_unregister(&device_i8042);
 		sysdev_class_unregister(&kbc_sysclass);
 	}
 
drivers/s390/block/xpram.c +3 -3
diff -Nru a/drivers/s390/block/xpram.c b/drivers/s390/block/xpram.c
@@ -492,7 +492,7 @@
 	}
 	unregister_blkdev(XPRAM_MAJOR, XPRAM_NAME);
 	devfs_remove("slram");
-	sys_device_unregister(&xpram_sys_device);
+	sysdev_unregister(&xpram_sys_device);
 	sysdev_class_unregister(&xpram_sysclass);
 }
 
@@ -515,14 +515,14 @@
 	if (rc)
 		return rc;
 
-	rc = sys_device_register(&xpram_sys_device);
+	rc = sysdev_register(&xpram_sys_device);
 	if (rc) {
 		sysdev_class_unregister(&xpram_sysclass);
 		return rc;
 	}
 	rc = xpram_setup_blkdev();
 	if (rc)
-		sys_device_unregister(&xpram_sys_device);
+		sysdev_unregister(&xpram_sys_device);
 	return rc;
 }
 
include/linux/sysdev.h +2 -2
diff -Nru a/include/linux/sysdev.h b/include/linux/sysdev.h
@@ -70,8 +70,8 @@
 	struct kobject		kobj;
 };
 
-extern int sys_device_register(struct sys_device *);
-extern void sys_device_unregister(struct sys_device *);
+extern int sysdev_register(struct sys_device *);
+extern void sysdev_unregister(struct sys_device *);
 
 
 struct sysdev_attribute { 
author
#2 lore raw

ChangeSet 1.1557.72.2, 2004/02/19 15:38:41-08:00, [email protected]

[PATCH] propogate errors from misc_register to caller

The patch to check for / in class_device is not enough.
The misc_register function needs to check return value of the things it calls!

 drivers/char/misc.c |   24 +++++++++++++++++++-----
 1 files changed, 19 insertions(+), 5 deletions(-)
drivers/char/misc.c +19 -5
diff -Nru a/drivers/char/misc.c b/drivers/char/misc.c
@@ -212,6 +212,9 @@
 int misc_register(struct miscdevice * misc)
 {
 	struct miscdevice *c;
+	struct class_device *class;
+	dev_t dev;
+	int err;
 	
 	down(&misc_sem);
 	list_for_each_entry(c, &misc_list, list) {
@@ -240,19 +243,30 @@
 		snprintf(misc->devfs_name, sizeof(misc->devfs_name),
 				"misc/%s", misc->name);
 	}
+	dev = MKDEV(MISC_MAJOR, misc->minor);
 
-	class_simple_device_add(misc_class, MKDEV(MISC_MAJOR, misc->minor),
-				misc->dev, misc->name);
-	devfs_mk_cdev(MKDEV(MISC_MAJOR, misc->minor),
-			S_IFCHR|S_IRUSR|S_IWUSR|S_IRGRP, misc->devfs_name);
+	class = class_simple_device_add(misc_class, dev,
+					misc->dev, misc->name);
+	if (IS_ERR(class)) {
+		err = PTR_ERR(class);
+		goto out;
+	}
+
+	err = devfs_mk_cdev(dev, S_IFCHR|S_IRUSR|S_IWUSR|S_IRGRP, 
+			    misc->devfs_name);
+	if (err) {
+		class_simple_device_remove(dev);
+		goto out;
+	}
 
 	/*
 	 * Add it to the front, so that later devices can "override"
 	 * earlier defaults
 	 */
 	list_add(&misc->list, &misc_list);
+ out:
 	up(&misc_sem);
-	return 0;
+	return err;
 }
 
 /**
author
#3 lore raw

ChangeSet 1.1612.17.2, 2004/02/26 16:31:27-08:00, [email protected]

[PATCH] fix x86_64 build for sys_device_register rename

fix x86_64 build for sys_device_register rename

 arch/x86_64/kernel/mce.c  |    2 +-
 arch/x86_64/kernel/time.c |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
arch/x86_64/kernel/mce.c +1 -1
diff -Nru a/arch/x86_64/kernel/mce.c b/arch/x86_64/kernel/mce.c
@@ -448,7 +448,7 @@
 		return -EIO;
 	err = sysdev_class_register(&mce_sysclass);
 	if (!err)
-		err = sys_device_register(&device_mce);
+		err = sysdev_register(&device_mce);
 	if (!err) { 
 		/* could create per CPU objects, but is not worth it. */
 		sysdev_create_file(&device_mce, &attr_disabled_banks); 
arch/x86_64/kernel/time.c +1 -1
diff -Nru a/arch/x86_64/kernel/time.c b/arch/x86_64/kernel/time.c
@@ -788,7 +788,7 @@
 {
 	int error = sysdev_class_register(&pit_sysclass);
 	if (!error)
-		error = sys_device_register(&device_i8253);
+		error = sysdev_register(&device_i8253);
 	return error;
 }
 
author
#4 lore raw

ChangeSet 1.1612.17.3, 2004/02/27 11:12:02-08:00, [email protected]

kobject: fix kobject hotplug debug message to show more needed info.

 lib/kobject.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
lib/kobject.c +2 -2
diff -Nru a/lib/kobject.c b/lib/kobject.c
@@ -185,8 +185,8 @@
 		}
 	}
 
-	pr_debug ("%s: %s %s %s %s %s %s\n", __FUNCTION__, argv[0], argv[1],
-		  envp[0], envp[1], envp[2], envp[3]);
+	pr_debug ("%s: %s %s %s %s %s %s %s\n", __FUNCTION__, argv[0], argv[1],
+		  envp[0], envp[1], envp[2], envp[3], envp[4]);
 	retval = call_usermodehelper (argv[0], argv, envp, 0);
 	if (retval)
 		pr_debug ("%s - call_usermodehelper returned %d\n",
author
#5 lore raw

ChangeSet 1.1612.17.4, 2004/02/27 11:18:21-08:00, [email protected]

kobject: clean up kobject_get() convoluted logic.

 lib/kobject.c |    7 ++-----
 1 files changed, 2 insertions(+), 5 deletions(-)
lib/kobject.c +2 -5
diff -Nru a/lib/kobject.c b/lib/kobject.c
@@ -425,14 +425,11 @@
 
 struct kobject * kobject_get(struct kobject * kobj)
 {
-	struct kobject * ret = kobj;
-
 	if (kobj) {
 		WARN_ON(!atomic_read(&kobj->refcount));
 		atomic_inc(&kobj->refcount);
-	} else
-		ret = NULL;
-	return ret;
+	}
+	return kobj;
 }
 
 /**
author
#6 lore raw

ChangeSet 1.1612.17.5, 2004/02/27 11:40:29-08:00, [email protected]

[PATCH] Driver for IBM service processor - updated (1/2)

Here is a device driver for the IBM xSeries RSA service processor. The ibmasm driver is mainly intended to be used in conjunction with a user space API and systems management applications that need to get in-band access to the service processor, such as sending commands or waiting for events. For the remote video feature the driver relays remote mouse and keyboard events to user space.
By itself the driver also allows the OS to make use the UART on the service processor board as a regular serial line.

The user interface to the driver is a custom file system. It does not use sysfs since the operations on the files are somewhat beyond the one file / one value rule for sysfs. Since it is not strictly a char driver I put it into the drivers/misc directory.

The patch is fairly big, therefore I split it up into the file system part and the everything-else part.

Here is the non-filesystem part:

 drivers/Kconfig                   |    2 
 drivers/misc/Kconfig              |   16 ++
 drivers/misc/Makefile             |    2 
 drivers/misc/ibmasm/Makefile      |   13 ++
 drivers/misc/ibmasm/command.c     |  175 +++++++++++++++++++++++++++++
 drivers/misc/ibmasm/dot_command.c |  146 ++++++++++++++++++++++++
 drivers/misc/ibmasm/dot_command.h |   78 +++++++++++++
 drivers/misc/ibmasm/event.c       |  169 ++++++++++++++++++++++++++++
 drivers/misc/ibmasm/heartbeat.c   |   91 +++++++++++++++
 drivers/misc/ibmasm/i2o.h         |   77 +++++++++++++
 drivers/misc/ibmasm/ibmasm.h      |  224 ++++++++++++++++++++++++++++++++++++++
 drivers/misc/ibmasm/lowlevel.c    |   81 +++++++++++++
 drivers/misc/ibmasm/lowlevel.h    |  137 +++++++++++++++++++++++
 drivers/misc/ibmasm/module.c      |  210 +++++++++++++++++++++++++++++++++++
 drivers/misc/ibmasm/r_heartbeat.c |   98 ++++++++++++++++
 drivers/misc/ibmasm/remote.c      |  152 +++++++++++++++++++++++++
 drivers/misc/ibmasm/remote.h      |  119 ++++++++++++++++++++
 drivers/misc/ibmasm/uart.c        |   72 ++++++++++++
 18 files changed, 1861 insertions(+), 1 deletion(-)
drivers/Kconfig +1 -1
diff -Nru a/drivers/Kconfig b/drivers/Kconfig
@@ -42,7 +42,7 @@
 
 source "drivers/i2c/Kconfig"
 
-# source "drivers/misc/Kconfig"
+source "drivers/misc/Kconfig"
 
 source "drivers/media/Kconfig"
 
drivers/misc/Kconfig +16 -0
diff -Nru a/drivers/misc/Kconfig b/drivers/misc/Kconfig
@@ -4,5 +4,21 @@
 
 menu "Misc devices"
 
+config IBM_ASM
+	tristate "Device driver for IBM RSA service processor"
+	default n
+	---help---
+	  This option enables device driver support for in-band access to the
+	  IBM RSA (Condor) service processor in eServer xSeries systems.
+	  The ibmasm device driver allows user space application to access
+	  ASM (Advanced Systems Management) functions on the service
+	  processor. The driver is meant to be used in conjunction with
+	  a user space API.
+	  The ibmasm driver also enables the OS to use the UART on the
+          service processor board as a regular serial port.
+	  
+
+	  If unsure, say N.
+
 endmenu
 
drivers/misc/Makefile +2 -0
diff -Nru a/drivers/misc/Makefile b/drivers/misc/Makefile
@@ -2,3 +2,5 @@
 # Makefile for misc devices that really don't fit anywhere else.
 #
 obj- := misc.o	# Dummy rule to force built-in.o to be made
+
+obj-$(CONFIG_IBM_ASM)	+= ibmasm/
drivers/misc/ibmasm/Makefile new file +13 -0
diff -Nru a/drivers/misc/ibmasm/Makefile b/drivers/misc/ibmasm/Makefile
@@ -0,0 +1,13 @@
+
+obj-$(CONFIG_IBM_ASM) := ibmasm.o
+
+ibmasm-objs :=	module.o      \
+		ibmasmfs.o    \
+		event.o       \
+		command.o     \
+		remote.o      \
+		heartbeat.o   \
+		r_heartbeat.o \
+		dot_command.o \
+		lowlevel.o    \
+		uart.o
drivers/misc/ibmasm/command.c new file +175 -0

175 lines not on this page · raw message

drivers/misc/ibmasm/dot_command.c new file +146 -0

146 lines not on this page · raw message

drivers/misc/ibmasm/dot_command.h new file +78 -0

78 lines not on this page · raw message

drivers/misc/ibmasm/event.c new file +169 -0

169 lines not on this page · raw message

drivers/misc/ibmasm/heartbeat.c new file +91 -0

91 lines not on this page · raw message

drivers/misc/ibmasm/i2o.h new file +77 -0

77 lines not on this page · raw message

drivers/misc/ibmasm/ibmasm.h new file +224 -0

224 lines not on this page · raw message

drivers/misc/ibmasm/lowlevel.c new file +81 -0

81 lines not on this page · raw message

drivers/misc/ibmasm/lowlevel.h new file +137 -0

137 lines not on this page · raw message

drivers/misc/ibmasm/module.c new file +210 -0

210 lines not on this page · raw message

drivers/misc/ibmasm/r_heartbeat.c new file +98 -0

98 lines not on this page · raw message

drivers/misc/ibmasm/remote.c new file +152 -0

152 lines not on this page · raw message

drivers/misc/ibmasm/remote.h new file +119 -0

119 lines not on this page · raw message

drivers/misc/ibmasm/uart.c new file +72 -0

72 lines not on this page · raw message

author
#7 lore raw

ChangeSet 1.1612.17.6, 2004/02/27 11:40:48-08:00, [email protected]

[PATCH] Driver for IBM service processor - updated (2/2)

Here is the filesystem part for the IBM RSA service processor device driver

 drivers/misc/ibmasm/ibmasmfs.c |  717 +++++++++++++++++++++++++++++++++++++++++
 1 files changed, 717 insertions(+)
drivers/misc/ibmasm/ibmasmfs.c new file +717 -0
diff -Nru a/drivers/misc/ibmasm/ibmasmfs.c b/drivers/misc/ibmasm/ibmasmfs.c
@@ -0,0 +1,717 @@
+/*
+ * IBM ASM Service Processor Device Driver
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * Copyright (C) IBM Corporation, 2004
+ *
+ * Author: Max Asböck <[email protected]> 
+ *
+ */
+
+/*
+ * Parts of this code are based on an article by Jonathan Corbet 
+ * that appeared in Linux Weekly News.
+ */
+
+
+/*
+ * The IBMASM file virtual filesystem. It creates the following hierarchy
+ * dymamically when mounted from user space:
+ *
+ *    /ibmasm
+ *    |-- 0
+ *    |   |-- command
+ *    |   |-- event
+ *    |   |-- reverse_heartbeat
+ *    |   `-- remote_video
+ *    |       |-- connected
+ *    |       |-- depth
+ *    |       |-- events
+ *    |       |-- height
+ *    |       `-- width
+ *    .
+ *    .
+ *    .
+ *    `-- n
+ *        |-- command
+ *        |-- event
+ *        |-- reverse_heartbeat
+ *        `-- remote_video
+ *            |-- connected
+ *            |-- depth
+ *            |-- events
+ *            |-- height
+ *            `-- width
+ *
+ * For each service processor the following files are created:
+ *
+ * command: execute dot commands
+ * 	write: execute a dot command on the service processor
+ * 	read: return the result of a previously executed dot command
+ *
+ * events: listen for service processor events
+ * 	read: sleep (interruptible) until an event occurs
+ *      write: wakeup sleeping event listener
+ *
+ * reverse_heartbeat: send a heartbeat to the service processor
+ * 	read: sleep (interruptible) until the reverse heartbeat fails
+ *      write: wakeup sleeping heartbeat listener
+ *
+ * remote_video/width
+ * remote_video/height
+ * remote_video/width: control remote display settings
+ * 	write: set value
+ * 	read: read value
+ *
+ * remote_video/connected
+ * 	read: return "1" if web browser VNC java applet is connected, 
+ * 		"0" otherwise
+ *
+ * remote_video/events
+ * 	read: sleep until a remote mouse or keyboard event occurs, then return
+ * 		then event.
+ */
+
+#include <linux/fs.h>
+#include <linux/pagemap.h>
+#include <asm/uaccess.h>
+#include <asm/io.h>
+#include "ibmasm.h"
+#include "remote.h"
+#include "dot_command.h"
+
+#define IBMASMFS_MAGIC 0x66726f67
+
+static LIST_HEAD(service_processors);
+
+static struct inode *ibmasmfs_make_inode(struct super_block *sb, int mode);
+static void ibmasmfs_create_files (struct super_block *sb, struct dentry *root);
+static int ibmasmfs_fill_super (struct super_block *sb, void *data, int silent);
+
+
+static struct super_block *ibmasmfs_get_super(struct file_system_type *fst,
+			int flags, const char *name, void *data)
+{
+	return get_sb_single(fst, flags, data, ibmasmfs_fill_super);
+}
+
+static struct super_operations ibmasmfs_s_ops = {
+	.statfs		= simple_statfs,
+	.drop_inode	= generic_delete_inode,
+};
+
+static struct file_operations *ibmasmfs_dir_ops = &simple_dir_operations;
+
+static struct file_system_type ibmasmfs_type = {
+	.owner          = THIS_MODULE,
+	.name           = "ibmasmfs",
+	.get_sb         = ibmasmfs_get_super,
+	.kill_sb        = kill_litter_super,
+};
+
+static int ibmasmfs_fill_super (struct super_block *sb, void *data, int silent)
+{
+	struct inode *root;
+	struct dentry *root_dentry;
+
+	sb->s_blocksize = PAGE_CACHE_SIZE;
+	sb->s_blocksize_bits = PAGE_CACHE_SHIFT;
+	sb->s_magic = IBMASMFS_MAGIC;
+	sb->s_op = &ibmasmfs_s_ops;
+
+	root = ibmasmfs_make_inode (sb, S_IFDIR | 0500);
+	if (!root)
+		return -ENOMEM;
+
+	root->i_op = &simple_dir_inode_operations;
+	root->i_fop = ibmasmfs_dir_ops;
+
+	root_dentry = d_alloc_root(root);
+	if (!root_dentry) {
+		iput(root);
+		return -ENOMEM;
+	}
+	sb->s_root = root_dentry;
+
+	ibmasmfs_create_files(sb, root_dentry);
+	return 0;
+}
+
+static struct inode *ibmasmfs_make_inode(struct super_block *sb, int mode)
+{
+	struct inode *ret = new_inode(sb);
+
+	if (ret) {
+		ret->i_mode = mode;
+		ret->i_uid = ret->i_gid = 0;
+		ret->i_blksize = PAGE_CACHE_SIZE;
+		ret->i_blocks = 0;
+		ret->i_atime = ret->i_mtime = ret->i_ctime = CURRENT_TIME;
+	}
+	return ret;
+}
+
+static struct dentry *ibmasmfs_create_file (struct super_block *sb,
+			struct dentry *parent,
+		       	const char *name,
+			struct file_operations *fops,
+			void *data,
+			int mode)
+{
+	struct dentry *dentry;
+	struct inode *inode;
+	struct qstr qname;
+
+	qname.name = name;
+	qname.len = strlen (name);
+	qname.hash = full_name_hash(name, qname.len);
+
+	dentry = d_alloc(parent, &qname);
+	if (!dentry)
+		return NULL;
+
+	inode = ibmasmfs_make_inode(sb, S_IFREG | mode);
+	if (!inode) {
+		dput(dentry);
+		return NULL;
+	}
+
+	inode->i_fop = fops;
+	inode->u.generic_ip = data;
+
+	d_add(dentry, inode);
+	return dentry;
+}
+
+static struct dentry *ibmasmfs_create_dir (struct super_block *sb,
+				struct dentry *parent,
+				const char *name)
+{
+	struct dentry *dentry;
+	struct inode *inode;
+	struct qstr qname;
+
+	qname.name = name;
+	qname.len = strlen (name);
+	qname.hash = full_name_hash(name, qname.len);
+	dentry = d_alloc(parent, &qname);
+	if (!dentry)
+		return NULL;
+
+	inode = ibmasmfs_make_inode(sb, S_IFDIR | 0500);
+	if (!inode) {
+		dput(dentry);
+		return NULL;
+	}
+
+	inode->i_op = &simple_dir_inode_operations;
+	inode->i_fop = ibmasmfs_dir_ops;
+
+	d_add(dentry, inode);
+	return dentry;
+}
+
+int ibmasmfs_register()
+{
+	return register_filesystem(&ibmasmfs_type);
+}
+
+void ibmasmfs_unregister()
+{
+	unregister_filesystem(&ibmasmfs_type);
+}
+
+void ibmasmfs_add_sp(struct service_processor *sp)
+{
+	list_add(&sp->node, &service_processors);
+}
+
+/* struct to save state between command file operations */
+struct ibmasmfs_command_data {
+	struct service_processor	*sp;
+	struct command			*command;
+};
+
+/* struct to save state between event file operations */
+struct ibmasmfs_event_data {
+	struct service_processor	*sp;
+	struct event_reader		reader;
+	int				active;
+};
+
+/* struct to save state between reverse heartbeat file operations */
+struct ibmasmfs_heartbeat_data {
+	struct service_processor	*sp;
+	struct reverse_heartbeat	heartbeat;
+	int				active;
+};
+
+static int command_file_open(struct inode *inode, struct file *file)
+{
+	struct ibmasmfs_command_data *command_data;
+
+	if (!inode->u.generic_ip)
+		return -ENODEV;
+
+	command_data = kmalloc(sizeof(struct ibmasmfs_command_data), GFP_KERNEL);
+	if (!command_data)
+		return -ENOMEM;
+
+	command_data->command = NULL;
+	command_data->sp = inode->u.generic_ip;
+	file->private_data = command_data;
+	return 0;
+}
+
+static int command_file_close(struct inode *inode, struct file *file)
+{
+	struct ibmasmfs_command_data *command_data = file->private_data;
+
+	if (command_data->command)
+		command_put(command_data->command);	
+
+	kfree(command_data);
+	return 0;
+}
+
+static ssize_t command_file_read(struct file *file, char *buf, size_t count, loff_t *offset)
+{
+	struct ibmasmfs_command_data *command_data = file->private_data;
+	struct command *cmd;
+	int len;
+	unsigned long flags;
+
+	if (*offset < 0)
+		return -EINVAL;
+	if (count == 0 || count > IBMASM_CMD_MAX_BUFFER_SIZE)
+		return 0;
+	if (*offset != 0)
+		return 0;
+
+	spin_lock_irqsave(&command_data->sp->lock, flags);
+	cmd = command_data->command;
+	if (cmd == NULL) {
+		spin_unlock_irqrestore(&command_data->sp->lock, flags);
+		return 0;
+	}
+	command_data->command = NULL;
+	spin_unlock_irqrestore(&command_data->sp->lock, flags);
+
+	if (cmd->status != IBMASM_CMD_COMPLETE) {
+		command_put(cmd);
+		return -EIO;
+	}
+	len = min(count, cmd->buffer_size);
+	if (copy_to_user(buf, cmd->buffer, len)) {
+		command_put(cmd);
+		return -EFAULT;
+	}
+	command_put(cmd);
+
+	return len;
+}
+
+static ssize_t command_file_write(struct file *file, const char *ubuff, size_t count, loff_t *offset)
+{
+	struct ibmasmfs_command_data *command_data = file->private_data;
+	struct command *cmd;
+	unsigned long flags;
+
+	if (*offset < 0)
+		return -EINVAL;
+	if (count == 0 || count > IBMASM_CMD_MAX_BUFFER_SIZE)
+		return 0;
+	if (*offset != 0)
+		return 0;
+
+	/* commands are executed sequentially, only one command at a time */
+	if (command_data->command)
+		return -EAGAIN;
+
+	cmd = ibmasm_new_command(count);
+	if (!cmd)
+		return -ENOMEM;
+
+	if (copy_from_user((void *)cmd->buffer, (void *)ubuff, count)) {
+		command_put(cmd);
+		return -EFAULT;
+	}
+
+	spin_lock_irqsave(&command_data->sp->lock, flags);
+	if (command_data->command) {
+		spin_unlock_irqrestore(&command_data->sp->lock, flags);
+		command_put(cmd);
+		return -EAGAIN;
+	}
+	command_data->command = cmd;
+	spin_unlock_irqrestore(&command_data->sp->lock, flags);
+
+	ibmasm_exec_command(command_data->sp, cmd);
+	ibmasm_wait_for_response(cmd, get_dot_command_timeout(cmd->buffer));
+
+	return count;
+}
+
+static int event_file_open(struct inode *inode, struct file *file)
+{
+	struct ibmasmfs_event_data *event_data;
+	struct service_processor *sp; 
+
+	if (!inode->u.generic_ip)
+		return -ENODEV;
+
+	sp = inode->u.generic_ip;
+
+	event_data = kmalloc(sizeof(struct ibmasmfs_event_data), GFP_KERNEL);
+	if (!event_data)
+		return -ENOMEM;
+
+	ibmasm_event_reader_register(sp, &event_data->reader);
+
+	event_data->sp = sp;
+	file->private_data = event_data;
+	return 0;
+}
+
+static int event_file_close(struct inode *inode, struct file *file)
+{
+	struct ibmasmfs_event_data *event_data = file->private_data;
+
+	ibmasm_event_reader_unregister(event_data->sp, &event_data->reader);
+	kfree(event_data);
+	return 0;
+}
+
+static ssize_t event_file_read(struct file *file, char *buf, size_t count, loff_t *offset)
+{
+	struct ibmasmfs_event_data *event_data = file->private_data;
+	struct event_reader *reader = &event_data->reader;
+	int ret;
+
+	if (*offset < 0)
+		return -EINVAL;
+	if (count == 0 || count > IBMASM_EVENT_MAX_SIZE)
+		return 0;
+	if (*offset != 0)
+		return 0;
+
+	ret = ibmasm_get_next_event(event_data->sp, reader);
+	if (ret <= 0)
+		return ret;
+
+	if (count < reader->data_size)
+		return -EINVAL;
+
+        if (copy_to_user(buf, reader->data, reader->data_size))
+		return -EFAULT;
+
+	return reader->data_size;
+}
+
+static ssize_t event_file_write(struct file *file, const char *buf, size_t count, loff_t *offset)
+{
+	struct ibmasmfs_event_data *event_data = file->private_data;
+
+	if (*offset < 0)
+		return -EINVAL;
+	if (count != 1)
+		return 0;
+	if (*offset != 0)
+		return 0;
+
+	wake_up_interruptible(&event_data->reader.wait);
+	return 0;
+}
+
+static int r_heartbeat_file_open(struct inode *inode, struct file *file)
+{
+	struct ibmasmfs_heartbeat_data *rhbeat;
+
+	if (!inode->u.generic_ip)
+		return -ENODEV;
+
+	rhbeat = kmalloc(sizeof(struct ibmasmfs_heartbeat_data), GFP_KERNEL);
+	if (!rhbeat)
+		return -ENOMEM;
+
+	rhbeat->sp = (struct service_processor *)inode->u.generic_ip;
+	rhbeat->active = 0;
+	ibmasm_init_reverse_heartbeat(rhbeat->sp, &rhbeat->heartbeat);
+	file->private_data = rhbeat;
+	return 0;
+}
+
+static int r_heartbeat_file_close(struct inode *inode, struct file *file)
+{
+	struct ibmasmfs_heartbeat_data *rhbeat = file->private_data;
+
+	kfree(rhbeat);
+	return 0;
+}
+
+static ssize_t r_heartbeat_file_read(struct file *file, char *buf, size_t count, loff_t *offset)
+{
+	struct ibmasmfs_heartbeat_data *rhbeat = file->private_data;
+	unsigned long flags;
+	int result;
+
+	if (*offset < 0)
+		return -EINVAL;
+	if (count == 0 || count > 1024)
+		return 0;
+	if (*offset != 0)
+		return 0;
+
+	/* allow only one reverse heartbeat per process */
+	spin_lock_irqsave(&rhbeat->sp->lock, flags);
+	if (rhbeat->active) {
+		spin_unlock_irqrestore(&rhbeat->sp->lock, flags);
+		return -EBUSY;
+	}
+	rhbeat->active = 1;
+	spin_unlock_irqrestore(&rhbeat->sp->lock, flags);
+
+	result = ibmasm_start_reverse_heartbeat(rhbeat->sp, &rhbeat->heartbeat);
+	rhbeat->active = 0;
+
+	return result;
+}
+
+static ssize_t r_heartbeat_file_write(struct file *file, const char *buf, size_t count, loff_t *offset)
+{
+	struct ibmasmfs_heartbeat_data *rhbeat = file->private_data;
+
+	if (*offset < 0)
+		return -EINVAL;
+	if (count != 1)
+		return 0;
+	if (*offset != 0)
+		return 0;
+
+	if (rhbeat->active)
+		ibmasm_stop_reverse_heartbeat(&rhbeat->heartbeat);
+
+	return 1;
+}
+
+static int remote_settings_file_open(struct inode *inode, struct file *file)
+{
+	file->private_data = inode->u.generic_ip;
+	return 0;
+}
+
+static int remote_settings_file_close(struct inode *inode, struct file *file)
+{
+	return 0;
+}
+
+static ssize_t remote_settings_file_read(struct file *file, char *buf, size_t count, loff_t *offset)
+{
+	unsigned long address = (unsigned long)file->private_data;
+	unsigned char *page;
+	int retval;
+	int len = 0;
+	unsigned int value;
+
+	if (*offset < 0)
+		return -EINVAL;
+	if (count == 0 || count > 1024)
+		return 0;
+	if (*offset != 0)
+		return 0;
+
+	page = (unsigned char *)__get_free_page(GFP_KERNEL);
+	if (!page)
+		return -ENOMEM;
+
+	value = readl(address);
+	len = sprintf(page, "%d\n", value);
+
+	if (copy_to_user(buf, page, len)) {
+		retval = -EFAULT;
+		goto exit;
+	}
+	*offset += len;
+	retval = len;
+
+exit:
+	free_page((unsigned long)page);
+	return retval;
+}
+
+static ssize_t remote_settings_file_write(struct file *file, const char *ubuff, size_t count, loff_t *offset)
+{
+	unsigned long address = (unsigned long)file->private_data;
+	char *buff;
+	unsigned int value;
+
+	if (*offset < 0)
+		return -EINVAL;
+	if (count == 0 || count > 1024)
+		return 0;
+	if (*offset != 0)
+		return 0;
+
+	buff = kmalloc (count + 1, GFP_KERNEL);
+	if (!buff)
+		return -ENOMEM;
+
+	memset(buff, 0x0, count + 1);
+
+	if (copy_from_user((void *)buff, (void *)ubuff, count)) {
+		kfree(buff);
+		return -EFAULT;
+	}
+	
+	value = simple_strtoul(buff, NULL, 10);
+	writel(value, address);
+	kfree(buff);
+
+	return count;
+}
+
+static int remote_event_file_open(struct inode *inode, struct file *file)
+{
+	struct service_processor *sp;
+	unsigned long flags;
+	struct remote_queue *q;
+	
+	file->private_data = inode->u.generic_ip;
+	sp = file->private_data;
+	q = &sp->remote_queue;
+
+	/* allow only one event reader */
+	spin_lock_irqsave(&sp->lock, flags);
+	if (q->open) {
+		spin_unlock_irqrestore(&sp->lock, flags);
+		return -EBUSY;
+	}
+	q->open = 1;
+	spin_unlock_irqrestore(&sp->lock, flags);
+
+	enable_mouse_interrupts(sp);
+	
+	return 0;
+}
+
+static int remote_event_file_close(struct inode *inode, struct file *file)
+{
+	struct service_processor *sp = file->private_data;
+
+	disable_mouse_interrupts(sp);
+	wake_up_interruptible(&sp->remote_queue.wait);
+	sp->remote_queue.open = 0;
+
+	return 0;
+}
+
+static ssize_t remote_event_file_read(struct file *file, char *buf, size_t count, loff_t *offset)
+{
+	struct service_processor *sp = file->private_data;
+	struct remote_queue *q = &sp->remote_queue;
+	size_t data_size;
+	struct remote_event *reader = q->reader;
+	size_t num_events;
+
+	if (*offset < 0)
+		return -EINVAL;
+	if (count == 0 || count > 1024)
+		return 0;
+	if (*offset != 0)
+		return 0;
+
+	if (wait_event_interruptible(q->wait, q->reader != q->writer))
+		return -ERESTARTSYS;
+
+	/* only get multiples of struct remote_event */
+	num_events = min((count/sizeof(struct remote_event)), ibmasm_events_available(q));
+	if (!num_events)
+		return 0;
+
+	data_size = num_events * sizeof(struct remote_event);
+
+	if (copy_to_user(buf, reader, data_size))
+		return -EFAULT;
+
+	ibmasm_advance_reader(q, num_events);
+
+	return data_size;
+}
+
+
+static struct file_operations command_fops = {
+	.open =		command_file_open,
+	.release =	command_file_close,
+	.read =		command_file_read,
+	.write =	command_file_write,
+};
+
+static struct file_operations event_fops = {
+	.open =		event_file_open,
+	.release =	event_file_close,
+	.read =		event_file_read,
+	.write 		event_file_write,
+};
+
+static struct file_operations r_heartbeat_fops = {
+	.open =		r_heartbeat_file_open,
+	.release =	r_heartbeat_file_close,
+	.read =		r_heartbeat_file_read,
+	.write =	r_heartbeat_file_write,
+};
+
+static struct file_operations remote_settings_fops = {
+	.open =		remote_settings_file_open,
+	.release =	remote_settings_file_close,
+	.read =		remote_settings_file_read,
+	.write =	remote_settings_file_write,
+};
+
+static struct file_operations remote_event_fops = {
+	.open =		remote_event_file_open,
+	.release =	remote_event_file_close,
+	.read =		remote_event_file_read,
+};
+
+
+static void ibmasmfs_create_files (struct super_block *sb, struct dentry *root)
+{
+	struct list_head *entry;
+	struct service_processor *sp;
+
+	list_for_each(entry, &service_processors) {
+		struct dentry *dir;
+		struct dentry *remote_dir;
+		sp = list_entry(entry, struct service_processor, node);
+		dir = ibmasmfs_create_dir(sb, root, sp->dirname);
+		if (!dir)
+			continue;
+
+		ibmasmfs_create_file(sb, dir, "command", &command_fops, sp, S_IRUSR|S_IWUSR);
+		ibmasmfs_create_file(sb, dir, "event", &event_fops, sp, S_IRUSR|S_IWUSR);
+		ibmasmfs_create_file(sb, dir, "reverse_heartbeat", &r_heartbeat_fops, sp, S_IRUSR|S_IWUSR);
+
+		remote_dir = ibmasmfs_create_dir(sb, dir, "remote_video");
+		if (!remote_dir)
+			continue;
+
+		ibmasmfs_create_file(sb, remote_dir, "width", &remote_settings_fops, (void *)display_width(sp), S_IRUSR|S_IWUSR);
+		ibmasmfs_create_file(sb, remote_dir, "height", &remote_settings_fops, (void *)display_height(sp), S_IRUSR|S_IWUSR);
+		ibmasmfs_create_file(sb, remote_dir, "depth", &remote_settings_fops, (void *)display_depth(sp), S_IRUSR|S_IWUSR);
+		ibmasmfs_create_file(sb, remote_dir, "connected", &remote_settings_fops, (void *)vnc_status(sp), S_IRUSR);
+		ibmasmfs_create_file(sb, remote_dir, "events", &remote_event_fops, (void *)sp, S_IRUSR);
+	}
+}
author
#8 lore raw

ChangeSet 1.1612.24.2, 2004/03/01 15:54:54-08:00, [email protected]

[PATCH] rename sys_bus_init()

	rename sys_bus_init() to system_bus_init() so that
	it doesn't appear to be a syscall;
 drivers/base/init.c |    4 ++--
 drivers/base/sys.c  |    2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/base/init.c +2 -2
diff -Nru a/drivers/base/init.c b/drivers/base/init.c
@@ -15,7 +15,7 @@
 extern int classes_init(void);
 extern int firmware_init(void);
 extern int platform_bus_init(void);
-extern int sys_bus_init(void);
+extern int system_bus_init(void);
 extern int cpu_dev_init(void);
 
 /**
@@ -37,6 +37,6 @@
 	 * core core pieces.
 	 */
 	platform_bus_init();
-	sys_bus_init();
+	system_bus_init();
 	cpu_dev_init();
 }
drivers/base/sys.c +1 -1
diff -Nru a/drivers/base/sys.c b/drivers/base/sys.c
@@ -384,7 +384,7 @@
 }
 
 
-int __init sys_bus_init(void)
+int __init system_bus_init(void)
 {
 	system_subsys.kset.kobj.parent = &devices_subsys.kset.kobj;
 	return subsystem_register(&system_subsys);
author
#9 lore raw

ChangeSet 1.1612.24.3, 2004/03/02 12:13:47-08:00, [email protected]

Make IBMASM driver depend on X86 as that is the only valid platform for it.

 drivers/misc/Kconfig |    1 +
 1 files changed, 1 insertion(+)
drivers/misc/Kconfig +1 -0
diff -Nru a/drivers/misc/Kconfig b/drivers/misc/Kconfig
@@ -6,6 +6,7 @@
 
 config IBM_ASM
 	tristate "Device driver for IBM RSA service processor"
+	depends on X86
 	default n
 	---help---
 	  This option enables device driver support for in-band access to the
author
#10 lore raw

ChangeSet 1.1612.24.4, 2004/03/02 16:39:36-08:00, [email protected]

Driver core: add CONFIG_DEBUG_DRIVER to help track down driver core bugs easier.

 drivers/base/Kconfig          |   11 +++++++++++
 drivers/base/bus.c            |    5 ++++-
 drivers/base/class.c          |    5 ++++-
 drivers/base/class_simple.c   |    5 ++++-
 drivers/base/core.c           |    5 ++++-
 drivers/base/driver.c         |    5 ++++-
 drivers/base/power/main.c     |    5 ++++-
 drivers/base/power/shutdown.c |    7 +++++--
 drivers/base/sys.c            |    5 ++++-
 9 files changed, 44 insertions(+), 9 deletions(-)
drivers/base/Kconfig +11 -0
diff -Nru a/drivers/base/Kconfig b/drivers/base/Kconfig
@@ -8,4 +8,15 @@
 	  require hotplug firmware loading support, but a module built outside
 	  the kernel tree does.
 
+config DEBUG_DRIVER
+        bool "Driver Core verbose debug messages"
+        depends on DEBUG_KERNEL
+        help
+          Say Y here if you want the Driver core to produce a bunch of
+          debug messages to the system log. Select this if you are having a
+          problem with the driver core and want to see more of what is
+          going on.
+
+          If you are unsure about this, say N here.
+
 endmenu
drivers/base/bus.c +4 -1
diff -Nru a/drivers/base/bus.c b/drivers/base/bus.c
@@ -8,7 +8,10 @@
  *
  */
 
-#undef DEBUG
+#include <linux/config.h>
+#ifdef CONFIG_DEBUG_DRIVER
+#define DEBUG	1
+#endif
 
 #include <linux/device.h>
 #include <linux/module.h>
drivers/base/class.c +4 -1
diff -Nru a/drivers/base/class.c b/drivers/base/class.c
@@ -10,7 +10,10 @@
  *
  */
 
-#undef DEBUG
+#include <linux/config.h>
+#ifdef CONFIG_DEBUG_DRIVER
+#define DEBUG	1
+#endif
 
 #include <linux/device.h>
 #include <linux/module.h>
drivers/base/class_simple.c +4 -1
diff -Nru a/drivers/base/class_simple.c b/drivers/base/class_simple.c
@@ -8,7 +8,10 @@
  *
  */
 
-#define DEBUG 1
+#include <linux/config.h>
+#ifdef CONFIG_DEBUG_DRIVER
+#define DEBUG	1
+#endif
 
 #include <linux/device.h>
 #include <linux/kdev_t.h>
drivers/base/core.c +4 -1
diff -Nru a/drivers/base/core.c b/drivers/base/core.c
@@ -8,7 +8,10 @@
  *
  */
 
-#undef DEBUG
+#include <linux/config.h>
+#ifdef CONFIG_DEBUG_DRIVER
+#define DEBUG	1
+#endif
 
 #include <linux/device.h>
 #include <linux/err.h>
drivers/base/driver.c +4 -1
diff -Nru a/drivers/base/driver.c b/drivers/base/driver.c
@@ -8,7 +8,10 @@
  *
  */
 
-#undef DEBUG
+#include <linux/config.h>
+#ifdef CONFIG_DEBUG_DRIVER
+#define DEBUG	1
+#endif
 
 #include <linux/device.h>
 #include <linux/module.h>
drivers/base/power/main.c +4 -1
diff -Nru a/drivers/base/power/main.c b/drivers/base/power/main.c
@@ -19,7 +19,10 @@
  * ancestral dependencies that the subsystem list maintains.
  */
 
-#undef DEBUG
+#include <linux/config.h>
+#ifdef CONFIG_DEBUG_DRIVER
+#define DEBUG	1
+#endif
 
 #include <linux/device.h>
 #include "power.h"
drivers/base/power/shutdown.c +5 -2
diff -Nru a/drivers/base/power/shutdown.c b/drivers/base/power/shutdown.c
@@ -8,7 +8,10 @@
  *
  */
 
-#undef DEBUG
+#include <linux/config.h>
+#ifdef CONFIG_DEBUG_DRIVER
+#define DEBUG	1
+#endif
 
 #include <linux/device.h>
 #include <asm/semaphore.h>
@@ -54,7 +57,7 @@
 	
 	down_write(&devices_subsys.rwsem);
 	list_for_each_entry_reverse(dev,&devices_subsys.kset.list,kobj.entry) {
-		pr_debug("shutting down %s: ",dev->name);
+		pr_debug("shutting down %s: ",dev->bus_id);
 		if (dev->driver && dev->driver->shutdown) {
 			pr_debug("Ok\n");
 			dev->driver->shutdown(dev);
drivers/base/sys.c +4 -1
diff -Nru a/drivers/base/sys.c b/drivers/base/sys.c
@@ -12,7 +12,10 @@
  * add themselves as children of the system bus.
  */
 
-#undef DEBUG
+#include <linux/config.h>
+#ifdef CONFIG_DEBUG_DRIVER
+#define DEBUG	1
+#endif
 
 #include <linux/sysdev.h>
 #include <linux/err.h>
#11 lore raw
Quoted 3 lines · Greg KH

ChangeSet 1.1612.24.4, 2004/03/02 16:39:36-08:00, [email protected]

Driver core: add CONFIG_DEBUG_DRIVER to help track down driver core bugs easier.

Wouldn't a cleaner way to do this be to add -DDEBUG to EXTRA_CFLAGS in the makefile if CONFIG_DEBUG_DRIVER is set, and remove the #undef DEBUG statements in each .c file?

Signature · 4 lines
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:  2.6 PCMCIA      - http://pcmcia.arm.linux.org.uk/
                 2.6 Serial core
author
#12 lore raw
Quoted 8 lines · Russell King
Quoted 3 lines · Greg KH

ChangeSet 1.1612.24.4, 2004/03/02 16:39:36-08:00, [email protected]

Driver core: add CONFIG_DEBUG_DRIVER to help track down driver core bugs easier.

Wouldn't a cleaner way to do this be to add -DDEBUG to EXTRA_CFLAGS in the makefile if CONFIG_DEBUG_DRIVER is set, and remove the #undef DEBUG statements in each .c file?

Yes it would, I didn't realize we could do that :) Do any other subsystems do that?

thanks,

greg k-h

#13 lore raw
In reply to Greg KH
Quoted 3 lines · Greg KH

ChangeSet 1.1612.17.5, 2004/02/27 11:40:29-08:00, [email protected]

[PATCH] Driver for IBM service processor - updated (1/2)

please don't put anything into drivers/misc for now. We might over to it, but then we should do it for all drivers we think it makes sense instead of random ones.

author
#14 lore raw
Quoted 8 lines · Christoph Hellwig
Quoted 3 lines · Greg KH

ChangeSet 1.1612.17.5, 2004/02/27 11:40:29-08:00, [email protected]

[PATCH] Driver for IBM service processor - updated (1/2)

please don't put anything into drivers/misc for now. We might over to it, but then we should do it for all drivers we think it makes sense instead of random ones.

Hm, well where do you feel I should move this driver to in the tree then?

thanks,

greg k-h

#15 lore raw
Quoted 4 lines · Greg KH
Quoted 3 lines · Christoph Hellwig
Quoted 2 lines · Greg KH

ChangeSet 1.1612.17.5, 2004/02/27 11:40:29-08:00, [email protected]

Quoted 8 lines
Quoted 5 lines
Quoted 1 line

[PATCH] Driver for IBM service processor - updated (1/2)

please don't put anything into drivers/misc for now. We might over to it, but then we should do it for all drivers we think it makes sense instead of random ones.

Hm, well where do you feel I should move this driver to in the tree then?

Currently drivers/char/ is the catchall for random gunk. But given that there seem to be more and more such service processors around it might be a good idea to just give them a directory udner drivers/ for themselves.

author
#16 lore raw
Quoted 7 lines · Christoph Hellwig
Quoted 6 lines · Greg KH
Quoted 5 lines · Christoph Hellwig
Quoted 3 lines · Greg KH

ChangeSet 1.1612.17.5, 2004/02/27 11:40:29-08:00, [email protected]

[PATCH] Driver for IBM service processor - updated (1/2)

Quoted 8 lines
Quoted 6 lines
Quoted 3 lines

please don't put anything into drivers/misc for now. We might over to it, but then we should do it for all drivers we think it makes sense instead of random ones.

Hm, well where do you feel I should move this driver to in the tree then?

Currently drivers/char/ is the catchall for random gunk.

Yeah, but this driver does not even have a char interface, otherwise I would have no problem adding this there.

Quoted 3 lines

But given that
there seem to be more and more such service processors around it might be a good idea to just give them a directory udner drivers/ for themselves.

How about drivers/sp or drivers/service_processor? I'd be glad to rename the misc directory to that and clear up two issues at once :)

thanks,

greg k-h