* [BK PATCH] PCI hotplug changes for 2.5.36
@ 2002-09-20 0:54 Greg KH
2002-09-20 0:54 ` Greg KH
0 siblings, 1 reply; 8+ messages in thread
From: Greg KH @ 2002-09-20 0:54 UTC (permalink / raw)
To: torvalds; +Cc: linux-kernel, pcihpd-discuss
Here are some PCI hotplug changes for 2.5.36.
Please pull from: bk://linuxusb.bkbits.net/pci_hp-2.5
thanks,
greg k-h
drivers/hotplug/cpqphp.h | 9 -
drivers/hotplug/cpqphp_core.c | 66 ++++++--
drivers/hotplug/cpqphp_ctrl.c | 4
drivers/hotplug/ibmphp_core.c | 32 ++--
drivers/hotplug/pci_hotplug.h | 28 +++
drivers/hotplug/pci_hotplug_core.c | 290 +++++++++++++++++++++++++++++++------
drivers/pci/proc.c | 3
kernel/ksyms.c | 2
8 files changed, 353 insertions(+), 81 deletions(-)
-----
ChangeSet@1.564, 2002-09-19 17:47:49-07:00, greg@kroah.com
PCI Hotplug: created /proc/bus/pci/slots for pcihpfs to be mounted on.
proc_bus_pci_dir had to be exported for this to work properly.
drivers/hotplug/pci_hotplug_core.c | 17 +++++++++++++++++
drivers/pci/proc.c | 3 ++-
2 files changed, 19 insertions(+), 1 deletion(-)
------
ChangeSet@1.563, 2002-09-19 17:45:19-07:00, greg@kroah.com
PCI Hotplug Core: Add allocation sanity checks. Patch from Silvio Cesare
drivers/hotplug/pci_hotplug_core.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
------
ChangeSet@1.562, 2002-09-19 17:43:34-07:00, greg@kroah.com
PCI Hotplug: added speed status to the IBM driver.
drivers/hotplug/ibmphp_core.c | 32 +++++++++++++++++---------------
1 files changed, 17 insertions(+), 15 deletions(-)
------
ChangeSet@1.561, 2002-09-19 17:43:07-07:00, greg@kroah.com
PCI Hotplug: added speed status to the Compaq driver.
drivers/hotplug/cpqphp.h | 9 +----
drivers/hotplug/cpqphp_core.c | 66 ++++++++++++++++++++++++++++++++++--------
drivers/hotplug/cpqphp_ctrl.c | 4 +-
3 files changed, 59 insertions(+), 20 deletions(-)
------
ChangeSet@1.560, 2002-09-19 17:40:04-07:00, greg@kroah.com
PCI Hotplug: added max bus speed and current bus speed files to the pci hotplug core.
Patch based on work done by Irene Zubarev <zubarev@us.ibm.com>
drivers/hotplug/pci_hotplug.h | 28 ++++
drivers/hotplug/pci_hotplug_core.c | 249 +++++++++++++++++++++++++++++++------
2 files changed, 242 insertions(+), 35 deletions(-)
------
ChangeSet@1.559, 2002-09-19 17:37:13-07:00, greg@kroah.com
export __inode_dir_notify so that dnotify can be called from filesystems in modules.
kernel/ksyms.c | 2 ++
1 files changed, 2 insertions(+)
------
ChangeSet@1.558, 2002-09-19 17:29:16-07:00, scottm@somanetworks.com
[PATCH] Small pcihpfs dnotify fix
I've been working on a userspace daemon to go with my CompactPCI driver,
and yesterday I discovered an oversight in pci_hp_change_slot_info - it
doesn't call dnotify_parent, so dnotify based clients basically don't
work against pcihpfs. The following patch (against 2.5 BK) reworks
things to just update the mtime (since we're modifying the file after
all), and then call dnotify_parent.
drivers/hotplug/pci_hotplug_core.c | 18 +++++++++++-------
1 files changed, 11 insertions(+), 7 deletions(-)
------
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [BK PATCH] PCI hotplug changes for 2.5.36
2002-09-20 0:54 [BK PATCH] PCI hotplug changes for 2.5.36 Greg KH
@ 2002-09-20 0:54 ` Greg KH
2002-09-20 0:54 ` Greg KH
0 siblings, 1 reply; 8+ messages in thread
From: Greg KH @ 2002-09-20 0:54 UTC (permalink / raw)
To: linux-kernel, pcihpd-discuss
# This is a BitKeeper generated patch for the following project:
# Project Name: Linux kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher.
# This patch includes the following deltas:
# ChangeSet 1.557 -> 1.558
# drivers/hotplug/pci_hotplug_core.c 1.20 -> 1.21
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 02/09/19 scottm@somanetworks.com 1.558
# [PATCH] Small pcihpfs dnotify fix
#
# I've been working on a userspace daemon to go with my CompactPCI driver,
# and yesterday I discovered an oversight in pci_hp_change_slot_info - it
# doesn't call dnotify_parent, so dnotify based clients basically don't
# work against pcihpfs. The following patch (against 2.5 BK) reworks
# things to just update the mtime (since we're modifying the file after
# all), and then call dnotify_parent.
# --------------------------------------------
#
diff -Nru a/drivers/hotplug/pci_hotplug_core.c b/drivers/hotplug/pci_hotplug_core.c
--- a/drivers/hotplug/pci_hotplug_core.c Thu Sep 19 17:50:53 2002
+++ b/drivers/hotplug/pci_hotplug_core.c Thu Sep 19 17:50:53 2002
@@ -38,6 +38,7 @@
#include <linux/init.h>
#include <linux/namei.h>
#include <linux/pci.h>
+#include <linux/dnotify.h>
#include <asm/uaccess.h>
#include "pci_hotplug.h"
@@ -1012,10 +1013,13 @@
return 0;
}
-static inline void update_inode_time (struct inode *inode)
+static inline void update_dentry_inode_time (struct dentry *dentry)
{
- if (inode)
- inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
+ struct inode *inode = dentry->d_inode;
+ if (inode) {
+ inode->i_mtime = CURRENT_TIME;
+ dnotify_parent(dentry, DN_MODIFY);
+ }
}
/**
@@ -1050,16 +1054,16 @@
core = temp->core_priv;
if ((core->power_dentry) &&
(temp->info->power_status != info->power_status))
- update_inode_time (core->power_dentry->d_inode);
+ update_dentry_inode_time (core->power_dentry);
if ((core->attention_dentry) &&
(temp->info->attention_status != info->attention_status))
- update_inode_time (core->attention_dentry->d_inode);
+ update_dentry_inode_time (core->attention_dentry);
if ((core->latch_dentry) &&
(temp->info->latch_status != info->latch_status))
- update_inode_time (core->latch_dentry->d_inode);
+ update_dentry_inode_time (core->latch_dentry);
if ((core->adapter_dentry) &&
(temp->info->adapter_status != info->adapter_status))
- update_inode_time (core->adapter_dentry->d_inode);
+ update_dentry_inode_time (core->adapter_dentry);
memcpy (temp->info, info, sizeof (struct hotplug_slot_info));
spin_unlock (&list_lock);
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [BK PATCH] PCI hotplug changes for 2.5.36
2002-09-20 0:54 ` Greg KH
@ 2002-09-20 0:54 ` Greg KH
2002-09-20 0:55 ` Greg KH
0 siblings, 1 reply; 8+ messages in thread
From: Greg KH @ 2002-09-20 0:54 UTC (permalink / raw)
To: linux-kernel, pcihpd-discuss
# This is a BitKeeper generated patch for the following project:
# Project Name: Linux kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher.
# This patch includes the following deltas:
# ChangeSet 1.558 -> 1.559
# kernel/ksyms.c 1.130 -> 1.131
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 02/09/19 greg@kroah.com 1.559
# export __inode_dir_notify so that dnotify can be called from filesystems in modules.
# --------------------------------------------
#
diff -Nru a/kernel/ksyms.c b/kernel/ksyms.c
--- a/kernel/ksyms.c Thu Sep 19 17:50:50 2002
+++ b/kernel/ksyms.c Thu Sep 19 17:50:50 2002
@@ -53,6 +53,7 @@
#include <linux/root_dev.h>
#include <linux/percpu.h>
#include <linux/smp_lock.h>
+#include <linux/dnotify.h>
#include <asm/checksum.h>
#if defined(CONFIG_PROC_FS)
@@ -560,6 +561,7 @@
EXPORT_SYMBOL(make_bad_inode);
EXPORT_SYMBOL(is_bad_inode);
EXPORT_SYMBOL(event);
+EXPORT_SYMBOL(__inode_dir_notify);
#ifdef CONFIG_UID16
EXPORT_SYMBOL(overflowuid);
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [BK PATCH] PCI hotplug changes for 2.5.36
2002-09-20 0:54 ` Greg KH
@ 2002-09-20 0:55 ` Greg KH
2002-09-20 0:55 ` Greg KH
0 siblings, 1 reply; 8+ messages in thread
From: Greg KH @ 2002-09-20 0:55 UTC (permalink / raw)
To: linux-kernel, pcihpd-discuss
# This is a BitKeeper generated patch for the following project:
# Project Name: Linux kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher.
# This patch includes the following deltas:
# ChangeSet 1.559 -> 1.560
# drivers/hotplug/pci_hotplug_core.c 1.21 -> 1.22
# drivers/hotplug/pci_hotplug.h 1.2 -> 1.3
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 02/09/19 greg@kroah.com 1.560
# PCI Hotplug: added max bus speed and current bus speed files to the pci hotplug core.
#
# Patch based on work done by Irene Zubarev <zubarev@us.ibm.com>
# --------------------------------------------
#
diff -Nru a/drivers/hotplug/pci_hotplug.h b/drivers/hotplug/pci_hotplug.h
--- a/drivers/hotplug/pci_hotplug.h Thu Sep 19 17:50:46 2002
+++ b/drivers/hotplug/pci_hotplug.h Thu Sep 19 17:50:46 2002
@@ -29,6 +29,22 @@
#define _PCI_HOTPLUG_H
+/* These values come from the PCI Hotplug Spec */
+enum pci_bus_speed {
+ PCI_SPEED_33MHz = 0x00,
+ PCI_SPEED_66MHz = 0x01,
+ PCI_SPEED_66MHz_PCIX = 0x02,
+ PCI_SPEED_100MHz_PCIX = 0x03,
+ PCI_SPEED_133MHz_PCIX = 0x04,
+ PCI_SPEED_66MHz_PCIX_266 = 0x09,
+ PCI_SPEED_100MHz_PCIX_266 = 0x0a,
+ PCI_SPEED_133MHz_PCIX_266 = 0x0b,
+ PCI_SPEED_66MHz_PCIX_533 = 0x11,
+ PCI_SPEED_100MHz_PCIX_533 = 0X12,
+ PCI_SPEED_133MHz_PCIX_533 = 0x13,
+ PCI_SPEED_UNKNOWN = 0xff,
+};
+
struct hotplug_slot;
struct hotplug_slot_core;
@@ -50,7 +66,13 @@
* @get_latch_status: Called to get the current latch status of a slot.
* If this field is NULL, the value passed in the struct hotplug_slot_info
* will be used when this value is requested by a user.
- * @get_adapter_present: Called to get see if an adapter is present in the slot or not.
+ * @get_adapter_status: Called to get see if an adapter is present in the slot or not.
+ * If this field is NULL, the value passed in the struct hotplug_slot_info
+ * will be used when this value is requested by a user.
+ * @get_max_bus_speed: Called to get the max bus speed for a slot.
+ * If this field is NULL, the value passed in the struct hotplug_slot_info
+ * will be used when this value is requested by a user.
+ * @get_cur_bus_speed: Called to get the current bus speed for a slot.
* If this field is NULL, the value passed in the struct hotplug_slot_info
* will be used when this value is requested by a user.
*
@@ -69,6 +91,8 @@
int (*get_attention_status) (struct hotplug_slot *slot, u8 *value);
int (*get_latch_status) (struct hotplug_slot *slot, u8 *value);
int (*get_adapter_status) (struct hotplug_slot *slot, u8 *value);
+ int (*get_max_bus_speed) (struct hotplug_slot *slot, enum pci_bus_speed *value);
+ int (*get_cur_bus_speed) (struct hotplug_slot *slot, enum pci_bus_speed *value);
};
/**
@@ -85,6 +109,8 @@
u8 attention_status;
u8 latch_status;
u8 adapter_status;
+ enum pci_bus_speed max_bus_speed;
+ enum pci_bus_speed cur_bus_speed;
};
/**
diff -Nru a/drivers/hotplug/pci_hotplug_core.c b/drivers/hotplug/pci_hotplug_core.c
--- a/drivers/hotplug/pci_hotplug_core.c Thu Sep 19 17:50:46 2002
+++ b/drivers/hotplug/pci_hotplug_core.c Thu Sep 19 17:50:46 2002
@@ -75,6 +75,8 @@
struct dentry *latch_dentry;
struct dentry *adapter_dentry;
struct dentry *test_dentry;
+ struct dentry *max_bus_speed_dentry;
+ struct dentry *cur_bus_speed_dentry;
};
static struct super_operations pcihpfs_ops;
@@ -87,6 +89,29 @@
LIST_HEAD(pci_hotplug_slot_list);
+/* these strings match up with the values in pci_bus_speed */
+static char *pci_bus_speed_strings[] = {
+ "33 MHz PCI", /* 0x00 */
+ "66 MHz PCI", /* 0x01 */
+ "66 MHz PCIX", /* 0x02 */
+ "100 MHz PCIX", /* 0x03 */
+ "133 MHz PCIX", /* 0x04 */
+ NULL, /* 0x05 */
+ NULL, /* 0x06 */
+ NULL, /* 0x07 */
+ NULL, /* 0x08 */
+ "66 MHz PCIX 266", /* 0x09 */
+ "100 MHz PCIX 266", /* 0x0a */
+ "133 MHz PCIX 266", /* 0x0b */
+ NULL, /* 0x0c */
+ NULL, /* 0x0d */
+ NULL, /* 0x0e */
+ NULL, /* 0x0f */
+ NULL, /* 0x10 */
+ "66 MHz PCIX 533", /* 0x11 */
+ "100 MHz PCIX 533", /* 0x12 */
+ "133 MHz PCIX 533", /* 0x13 */
+};
static struct inode *pcihpfs_get_inode (struct super_block *sb, int mode, int dev)
{
@@ -275,6 +300,24 @@
.llseek = default_file_lseek,
};
+/* file ops for the "max bus speed" files */
+static ssize_t max_bus_speed_read_file (struct file *file, char *buf, size_t count, loff_t *offset);
+static struct file_operations max_bus_speed_file_operations = {
+ read: max_bus_speed_read_file,
+ write: default_write_file,
+ open: default_open,
+ llseek: default_file_lseek,
+};
+
+/* file ops for the "current bus speed" files */
+static ssize_t cur_bus_speed_read_file (struct file *file, char *buf, size_t count, loff_t *offset);
+static struct file_operations cur_bus_speed_file_operations = {
+ read: cur_bus_speed_read_file,
+ write: default_write_file,
+ open: default_open,
+ llseek: default_file_lseek,
+};
+
/* file ops for the "test" files */
static ssize_t test_write_file (struct file *file, const char *buf, size_t count, loff_t *ppos);
static struct file_operations test_file_operations = {
@@ -502,26 +545,28 @@
up(&parent->d_inode->i_sem);
}
-#define GET_STATUS(name) \
-static int get_##name##_status (struct hotplug_slot *slot, u8 *value) \
+#define GET_STATUS(name,type) \
+static int get_##name (struct hotplug_slot *slot, type *value) \
{ \
struct hotplug_slot_ops *ops = slot->ops; \
int retval = 0; \
if (ops->owner) \
__MOD_INC_USE_COUNT(ops->owner); \
- if (ops->get_##name##_status) \
- retval = ops->get_##name##_status (slot, value); \
+ if (ops->get_##name) \
+ retval = ops->get_##name (slot, value); \
else \
- *value = slot->info->name##_status; \
+ *value = slot->info->name; \
if (ops->owner) \
__MOD_DEC_USE_COUNT(ops->owner); \
return retval; \
}
-GET_STATUS(power)
-GET_STATUS(attention)
-GET_STATUS(latch)
-GET_STATUS(adapter)
+GET_STATUS(power_status, u8)
+GET_STATUS(attention_status, u8)
+GET_STATUS(latch_status, u8)
+GET_STATUS(adapter_status, u8)
+GET_STATUS(max_bus_speed, enum pci_bus_speed)
+GET_STATUS(cur_bus_speed, enum pci_bus_speed)
static ssize_t power_read_file (struct file *file, char *buf, size_t count, loff_t *offset)
{
@@ -770,7 +815,6 @@
return retval;
}
-
static ssize_t presence_read_file (struct file *file, char *buf, size_t count, loff_t *offset)
{
struct hotplug_slot *slot = file->private_data;
@@ -814,6 +858,108 @@
return retval;
}
+static char *unknown_speed = "Unknown bus speed";
+
+static ssize_t max_bus_speed_read_file (struct file *file, char *buf, size_t count, loff_t *offset)
+{
+ struct hotplug_slot *slot = file->private_data;
+ unsigned char *page;
+ char *speed_string;
+ int retval;
+ int len = 0;
+ enum pci_bus_speed value;
+
+ dbg ("count = %d, offset = %lld\n", count, *offset);
+
+ if (*offset < 0)
+ return -EINVAL;
+ if (count <= 0)
+ return 0;
+ if (*offset != 0)
+ return 0;
+
+ if (slot == NULL) {
+ dbg("slot == NULL???\n");
+ return -ENODEV;
+ }
+
+ page = (unsigned char *)__get_free_page(GFP_KERNEL);
+ if (!page)
+ return -ENOMEM;
+
+ retval = get_max_bus_speed (slot, &value);
+ if (retval)
+ goto exit;
+
+ if (value == PCI_SPEED_UNKNOWN)
+ speed_string = unknown_speed;
+ else
+ speed_string = pci_bus_speed_strings[value];
+
+ len = sprintf (page, "%s\n", speed_string);
+
+ 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 cur_bus_speed_read_file (struct file *file, char *buf, size_t count, loff_t *offset)
+{
+ struct hotplug_slot *slot = file->private_data;
+ unsigned char *page;
+ char *speed_string;
+ int retval;
+ int len = 0;
+ enum pci_bus_speed value;
+
+ dbg ("count = %d, offset = %lld\n", count, *offset);
+
+ if (*offset < 0)
+ return -EINVAL;
+ if (count <= 0)
+ return 0;
+ if (*offset != 0)
+ return 0;
+
+ if (slot == NULL) {
+ dbg("slot == NULL???\n");
+ return -ENODEV;
+ }
+
+ page = (unsigned char *)__get_free_page(GFP_KERNEL);
+ if (!page)
+ return -ENOMEM;
+
+ retval = get_cur_bus_speed (slot, &value);
+ if (retval)
+ goto exit;
+
+ if (value == PCI_SPEED_UNKNOWN)
+ speed_string = unknown_speed;
+ else
+ speed_string = pci_bus_speed_strings[value];
+
+ len = sprintf (page, "%s\n", speed_string);
+
+ 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 test_write_file (struct file *file, const char *ubuff, size_t count, loff_t *offset)
{
struct hotplug_slot *slot = file->private_data;
@@ -877,30 +1023,57 @@
S_IFDIR | S_IXUGO | S_IRUGO,
NULL, NULL, NULL);
if (core->dir_dentry != NULL) {
- core->power_dentry = fs_create_file ("power",
- S_IFREG | S_IRUGO | S_IWUSR,
- core->dir_dentry, slot,
- &power_file_operations);
-
- core->attention_dentry = fs_create_file ("attention",
- S_IFREG | S_IRUGO | S_IWUSR,
- core->dir_dentry, slot,
- &attention_file_operations);
-
- core->latch_dentry = fs_create_file ("latch",
- S_IFREG | S_IRUGO,
- core->dir_dentry, slot,
- &latch_file_operations);
-
- core->adapter_dentry = fs_create_file ("adapter",
- S_IFREG | S_IRUGO,
- core->dir_dentry, slot,
- &presence_file_operations);
-
- core->test_dentry = fs_create_file ("test",
- S_IFREG | S_IRUGO | S_IWUSR,
- core->dir_dentry, slot,
- &test_file_operations);
+ if ((slot->ops->enable_slot) ||
+ (slot->ops->disable_slot) ||
+ (slot->ops->get_power_status))
+ core->power_dentry =
+ fs_create_file ("power",
+ S_IFREG | S_IRUGO | S_IWUSR,
+ core->dir_dentry, slot,
+ &power_file_operations);
+
+ if ((slot->ops->set_attention_status) ||
+ (slot->ops->get_attention_status))
+ core->attention_dentry =
+ fs_create_file ("attention",
+ S_IFREG | S_IRUGO | S_IWUSR,
+ core->dir_dentry, slot,
+ &attention_file_operations);
+
+ if (slot->ops->get_latch_status)
+ core->latch_dentry =
+ fs_create_file ("latch",
+ S_IFREG | S_IRUGO,
+ core->dir_dentry, slot,
+ &latch_file_operations);
+
+ if (slot->ops->get_adapter_status)
+ core->adapter_dentry =
+ fs_create_file ("adapter",
+ S_IFREG | S_IRUGO,
+ core->dir_dentry, slot,
+ &presence_file_operations);
+
+ if (slot->ops->get_max_bus_speed)
+ core->max_bus_speed_dentry =
+ fs_create_file ("max_bus_speed",
+ S_IFREG | S_IRUGO,
+ core->dir_dentry, slot,
+ &max_bus_speed_file_operations);
+
+ if (slot->ops->get_cur_bus_speed)
+ core->cur_bus_speed_dentry =
+ fs_create_file ("cur_bus_speed",
+ S_IFREG | S_IRUGO,
+ core->dir_dentry, slot,
+ &cur_bus_speed_file_operations);
+
+ if (slot->ops->hardware_test)
+ core->test_dentry =
+ fs_create_file ("test",
+ S_IFREG | S_IRUGO | S_IWUSR,
+ core->dir_dentry, slot,
+ &test_file_operations);
}
return 0;
}
@@ -918,6 +1091,10 @@
fs_remove_file (core->latch_dentry);
if (core->adapter_dentry)
fs_remove_file (core->adapter_dentry);
+ if (core->max_bus_speed_dentry)
+ fs_remove_file (core->max_bus_speed_dentry);
+ if (core->cur_bus_speed_dentry)
+ fs_remove_file (core->cur_bus_speed_dentry);
if (core->test_dentry)
fs_remove_file (core->test_dentry);
fs_remove_file (core->dir_dentry);
@@ -970,6 +1147,7 @@
return -EINVAL;
}
+ memset (core, 0, sizeof (struct hotplug_slot_core));
slot->core_priv = core;
list_add (&slot->slot_list, &pci_hotplug_slot_list);
@@ -1064,6 +1242,9 @@
if ((core->adapter_dentry) &&
(temp->info->adapter_status != info->adapter_status))
update_dentry_inode_time (core->adapter_dentry);
+ if ((core->cur_bus_speed_dentry) &&
+ (temp->info->cur_bus_speed != info->cur_bus_speed))
+ update_dentry_inode_time (core->cur_bus_speed_dentry);
memcpy (temp->info, info, sizeof (struct hotplug_slot_info));
spin_unlock (&list_lock);
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [BK PATCH] PCI hotplug changes for 2.5.36
2002-09-20 0:55 ` Greg KH
@ 2002-09-20 0:55 ` Greg KH
2002-09-20 0:55 ` Greg KH
0 siblings, 1 reply; 8+ messages in thread
From: Greg KH @ 2002-09-20 0:55 UTC (permalink / raw)
To: linux-kernel, pcihpd-discuss
# This is a BitKeeper generated patch for the following project:
# Project Name: Linux kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher.
# This patch includes the following deltas:
# ChangeSet 1.560 -> 1.561
# drivers/hotplug/cpqphp_core.c 1.8 -> 1.9
# drivers/hotplug/cpqphp.h 1.3 -> 1.4
# drivers/hotplug/cpqphp_ctrl.c 1.4 -> 1.5
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 02/09/19 greg@kroah.com 1.561
# PCI Hotplug: added speed status to the Compaq driver.
# --------------------------------------------
#
diff -Nru a/drivers/hotplug/cpqphp.h b/drivers/hotplug/cpqphp.h
--- a/drivers/hotplug/cpqphp.h Thu Sep 19 17:50:43 2002
+++ b/drivers/hotplug/cpqphp.h Thu Sep 19 17:50:43 2002
@@ -305,8 +305,8 @@
u8 first_slot;
u8 add_support;
u8 push_flag;
- u8 speed; /* 0 = 33MHz, 1 = 66MHz */
- u8 speed_capability; /* 0 = 33MHz, 1 = 66MHz */
+ enum pci_bus_speed speed;
+ enum pci_bus_speed speed_capability;
u8 push_button; /* 0 = no pushbutton, 1 = pushbutton present */
u8 slot_switch_type; /* 0 = no switch, 1 = switch present */
u8 defeature_PHP; /* 0 = PHP not supported, 1 = PHP supported */
@@ -321,9 +321,6 @@
wait_queue_head_t queue; /* sleep & wake process */
};
-#define CTRL_SPEED_33MHz 0
-#define CTRL_SPEED_66MHz 1
-
struct irq_mapping {
u8 barber_pole;
u8 valid_INT;
@@ -635,7 +632,7 @@
u16 misc;
misc = readw(ctrl->hpc_reg + MISC);
- return (misc & 0x0800) ? 1 : 0;
+ return (misc & 0x0800) ? PCI_SPEED_66MHz : PCI_SPEED_33MHz;
}
diff -Nru a/drivers/hotplug/cpqphp_core.c b/drivers/hotplug/cpqphp_core.c
--- a/drivers/hotplug/cpqphp_core.c Thu Sep 19 17:50:43 2002
+++ b/drivers/hotplug/cpqphp_core.c Thu Sep 19 17:50:43 2002
@@ -79,6 +79,8 @@
static int get_attention_status (struct hotplug_slot *slot, u8 *value);
static int get_latch_status (struct hotplug_slot *slot, u8 *value);
static int get_adapter_status (struct hotplug_slot *slot, u8 *value);
+static int get_max_bus_speed (struct hotplug_slot *slot, enum pci_bus_speed *value);
+static int get_cur_bus_speed (struct hotplug_slot *slot, enum pci_bus_speed *value);
static struct hotplug_slot_ops cpqphp_hotplug_slot_ops = {
.owner = THIS_MODULE,
@@ -90,6 +92,8 @@
.get_attention_status = get_attention_status,
.get_latch_status = get_latch_status,
.get_adapter_status = get_adapter_status,
+ .get_max_bus_speed = get_max_bus_speed,
+ .get_cur_bus_speed = get_cur_bus_speed,
};
@@ -378,7 +382,7 @@
new_slot->capabilities |= PCISLOT_64_BIT_SUPPORTED;
if (is_slot66mhz(new_slot))
new_slot->capabilities |= PCISLOT_66_MHZ_SUPPORTED;
- if (ctrl->speed == 1)
+ if (ctrl->speed == PCI_SPEED_66MHz)
new_slot->capabilities |= PCISLOT_66_MHZ_OPERATION;
ctrl_slot = slot_device - (readb(ctrl->hpc_reg + SLOT_MASK) >> 4);
@@ -782,6 +786,44 @@
return 0;
}
+static int get_max_bus_speed (struct hotplug_slot *hotplug_slot, enum pci_bus_speed *value)
+{
+ struct slot *slot = get_slot (hotplug_slot, __FUNCTION__);
+ struct controller *ctrl;
+
+ if (slot == NULL)
+ return -ENODEV;
+
+ dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name);
+
+ ctrl = slot->ctrl;
+ if (ctrl == NULL)
+ return -ENODEV;
+
+ *value = ctrl->speed_capability;
+
+ return 0;
+}
+
+static int get_cur_bus_speed (struct hotplug_slot *hotplug_slot, enum pci_bus_speed *value)
+{
+ struct slot *slot = get_slot (hotplug_slot, __FUNCTION__);
+ struct controller *ctrl;
+
+ if (slot == NULL)
+ return -ENODEV;
+
+ dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name);
+
+ ctrl = slot->ctrl;
+ if (ctrl == NULL)
+ return -ENODEV;
+
+ *value = ctrl->speed;
+
+ return 0;
+}
+
static int cpqhpc_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
{
u8 num_of_slots = 0;
@@ -853,28 +895,28 @@
case PCI_SUB_HPC_ID:
/* Original 6500/7000 implementation */
ctrl->slot_switch_type = 1; // Switch is present
- ctrl->speed_capability = CTRL_SPEED_33MHz;
+ ctrl->speed_capability = PCI_SPEED_33MHz;
ctrl->push_button = 0; // No pushbutton
ctrl->pci_config_space = 1; // Index/data access to working registers 0 = not supported, 1 = supported
- ctrl->defeature_PHP = 1; // PHP is supported
+ ctrl->defeature_PHP = 1; // PHP is supported
ctrl->pcix_support = 0; // PCI-X not supported
- ctrl->pcix_speed_capability = 0; // N/A since PCI-X not supported
+ ctrl->pcix_speed_capability = 0; // N/A since PCI-X not supported
break;
case PCI_SUB_HPC_ID2:
/* First Pushbutton implementation */
ctrl->push_flag = 1;
ctrl->slot_switch_type = 1; // Switch is present
- ctrl->speed_capability = CTRL_SPEED_33MHz;
+ ctrl->speed_capability = PCI_SPEED_33MHz;
ctrl->push_button = 1; // Pushbutton is present
ctrl->pci_config_space = 1; // Index/data access to working registers 0 = not supported, 1 = supported
- ctrl->defeature_PHP = 1; // PHP is supported
+ ctrl->defeature_PHP = 1; // PHP is supported
ctrl->pcix_support = 0; // PCI-X not supported
- ctrl->pcix_speed_capability = 0; // N/A since PCI-X not supported
+ ctrl->pcix_speed_capability = 0; // N/A since PCI-X not supported
break;
case PCI_SUB_HPC_ID_INTC:
/* Third party (6500/7000) */
ctrl->slot_switch_type = 1; // Switch is present
- ctrl->speed_capability = CTRL_SPEED_33MHz;
+ ctrl->speed_capability = PCI_SPEED_33MHz;
ctrl->push_button = 0; // No pushbutton
ctrl->pci_config_space = 1; // Index/data access to working registers 0 = not supported, 1 = supported
ctrl->defeature_PHP = 1; // PHP is supported
@@ -885,7 +927,7 @@
/* First 66 Mhz implementation */
ctrl->push_flag = 1;
ctrl->slot_switch_type = 1; // Switch is present
- ctrl->speed_capability = CTRL_SPEED_66MHz;
+ ctrl->speed_capability = PCI_SPEED_66MHz;
ctrl->push_button = 1; // Pushbutton is present
ctrl->pci_config_space = 1; // Index/data access to working registers 0 = not supported, 1 = supported
ctrl->defeature_PHP = 1; // PHP is supported
@@ -903,9 +945,9 @@
case PCI_VENDOR_ID_INTEL:
/* Check for speed capability (0=33, 1=66) */
if (subsystem_deviceid & 0x0001) {
- ctrl->speed_capability = CTRL_SPEED_66MHz;
+ ctrl->speed_capability = PCI_SPEED_66MHz;
} else {
- ctrl->speed_capability = CTRL_SPEED_33MHz;
+ ctrl->speed_capability = PCI_SPEED_33MHz;
}
/* Check for push button */
@@ -982,7 +1024,7 @@
info("Initializing the PCI hot plug controller residing on PCI bus %d\n", pdev->bus->number);
dbg ("Hotplug controller capabilities:\n");
- dbg (" speed_capability %s\n", ctrl->speed_capability == CTRL_SPEED_33MHz ? "33MHz" : "66Mhz");
+ dbg (" speed_capability %s\n", ctrl->speed_capability == PCI_SPEED_33MHz ? "33MHz" : "66Mhz");
dbg (" slot_switch_type %s\n", ctrl->slot_switch_type == 0 ? "no switch" : "switch present");
dbg (" defeature_PHP %s\n", ctrl->defeature_PHP == 0 ? "PHP not supported" : "PHP supported");
dbg (" alternate_base_address %s\n", ctrl->alternate_base_address == 0 ? "not supported" : "supported");
diff -Nru a/drivers/hotplug/cpqphp_ctrl.c b/drivers/hotplug/cpqphp_ctrl.c
--- a/drivers/hotplug/cpqphp_ctrl.c Thu Sep 19 17:50:43 2002
+++ b/drivers/hotplug/cpqphp_ctrl.c Thu Sep 19 17:50:43 2002
@@ -1187,7 +1187,7 @@
//*********************************
rc = CARD_FUNCTIONING;
} else {
- if (ctrl->speed == 1) {
+ if (ctrl->speed == PCI_SPEED_66MHz) {
// Wait for exclusive access to hardware
down(&ctrl->crit_sect);
@@ -1385,7 +1385,7 @@
dbg("%s: func->device, slot_offset, hp_slot = %d, %d ,%d\n",
__FUNCTION__, func->device, ctrl->slot_device_offset, hp_slot);
- if (ctrl->speed == 1) {
+ if (ctrl->speed == PCI_SPEED_66MHz) {
// Wait for exclusive access to hardware
down(&ctrl->crit_sect);
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [BK PATCH] PCI hotplug changes for 2.5.36
2002-09-20 0:55 ` Greg KH
@ 2002-09-20 0:55 ` Greg KH
2002-09-20 0:56 ` Greg KH
0 siblings, 1 reply; 8+ messages in thread
From: Greg KH @ 2002-09-20 0:55 UTC (permalink / raw)
To: linux-kernel, pcihpd-discuss
# This is a BitKeeper generated patch for the following project:
# Project Name: Linux kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher.
# This patch includes the following deltas:
# ChangeSet 1.561 -> 1.562
# drivers/hotplug/ibmphp_core.c 1.11 -> 1.12
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 02/09/19 greg@kroah.com 1.562
# PCI Hotplug: added speed status to the IBM driver.
# --------------------------------------------
#
diff -Nru a/drivers/hotplug/ibmphp_core.c b/drivers/hotplug/ibmphp_core.c
--- a/drivers/hotplug/ibmphp_core.c Thu Sep 19 17:50:40 2002
+++ b/drivers/hotplug/ibmphp_core.c Thu Sep 19 17:50:40 2002
@@ -384,14 +384,15 @@
debug ("get_adapter_present - Exit rc[%d] hpcrc[%x] value[%x]\n", rc, hpcrc, *value);
return rc;
}
-/*
-static int get_max_bus_speed (struct hotplug_slot *hotplug_slot, u8 * value)
+
+static int get_max_bus_speed (struct hotplug_slot *hotplug_slot, enum pci_bus_speed *value)
{
int rc = -ENODEV;
struct slot *pslot;
u8 mode = 0;
- debug ("get_max_bus_speed - Entry hotplug_slot[%lx] pvalue[%lx]\n", (ulong)hotplug_slot, (ulong) value);
+ debug ("%s - Entry hotplug_slot[%p] pvalue[%p]\n", __FUNCTION__,
+ hotplug_slot, value);
ibmphp_lock_operations ();
@@ -413,25 +414,26 @@
*value = pslot->supported_speed + 0x01;
break;
default:
-*/ /* Note (will need to change): there would be soon 256, 512 also */
-/* rc = -ENODEV;
+ /* Note (will need to change): there would be soon 256, 512 also */
+ rc = -ENODEV;
}
}
} else
rc = -ENODEV;
ibmphp_unlock_operations ();
- debug ("get_max_bus_speed - Exit rc[%d] value[%x]\n", rc, *value);
+ debug ("%s - Exit rc[%d] value[%x]\n", __FUNCTION__, rc, *value);
return rc;
}
-static int get_cur_bus_speed (struct hotplug_slot *hotplug_slot, u8 * value)
+static int get_cur_bus_speed (struct hotplug_slot *hotplug_slot, enum pci_bus_speed *value)
{
int rc = -ENODEV;
struct slot *pslot;
u8 mode = 0;
- debug ("get_cur_bus_speed - Entry hotplug_slot[%lx] pvalue[%lx]\n", (ulong)hotplug_slot, (ulong) value);
+ debug ("%s - Entry hotplug_slot[%p] pvalue[%p]\n", __FUNCTION__,
+ hotplug_slot, value);
ibmphp_lock_operations ();
@@ -458,8 +460,8 @@
*value += 0x01;
break;
default:
-*/ /* Note of change: there would also be 256, 512 soon */
-/* rc = -ENODEV;
+ /* Note of change: there would also be 256, 512 soon */
+ rc = -ENODEV;
}
}
}
@@ -467,10 +469,10 @@
rc = -ENODEV;
ibmphp_unlock_operations ();
- debug ("get_cur_bus_speed - Exit rc[%d] value[%x]\n", rc, *value);
+ debug ("%s - Exit rc[%d] value[%x]\n", __FUNCTION__, rc, *value);
return rc;
}
-
+/*
static int get_max_adapter_speed_1 (struct hotplug_slot *hotplug_slot, u8 * value, u8 flag)
{
int rc = -ENODEV;
@@ -1584,9 +1586,9 @@
.get_attention_status = get_attention_status,
.get_latch_status = get_latch_status,
.get_adapter_status = get_adapter_present,
-/* .get_max_bus_speed_status = get_max_bus_speed,
- .get_max_adapter_speed_status = get_max_adapter_speed,
- .get_cur_bus_speed_status = get_cur_bus_speed,
+ .get_max_bus_speed = get_max_bus_speed,
+ .get_cur_bus_speed = get_cur_bus_speed,
+/* .get_max_adapter_speed = get_max_adapter_speed,
.get_bus_name_status = get_bus_name,
*/
};
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [BK PATCH] PCI hotplug changes for 2.5.36
2002-09-20 0:55 ` Greg KH
@ 2002-09-20 0:56 ` Greg KH
2002-09-20 0:57 ` Greg KH
0 siblings, 1 reply; 8+ messages in thread
From: Greg KH @ 2002-09-20 0:56 UTC (permalink / raw)
To: linux-kernel, pcihpd-discuss
# This is a BitKeeper generated patch for the following project:
# Project Name: Linux kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher.
# This patch includes the following deltas:
# ChangeSet 1.562 -> 1.563
# drivers/hotplug/pci_hotplug_core.c 1.22 -> 1.23
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 02/09/19 greg@kroah.com 1.563
# PCI Hotplug Core: Add allocation sanity checks. Patch from Silvio Cesare
# --------------------------------------------
#
diff -Nru a/drivers/hotplug/pci_hotplug_core.c b/drivers/hotplug/pci_hotplug_core.c
--- a/drivers/hotplug/pci_hotplug_core.c Thu Sep 19 17:50:36 2002
+++ b/drivers/hotplug/pci_hotplug_core.c Thu Sep 19 17:50:36 2002
@@ -621,7 +621,7 @@
if (*offset < 0)
return -EINVAL;
- if (count <= 0)
+ if (count == 0 || count > 16384)
return 0;
if (*offset != 0)
return 0;
@@ -732,7 +732,7 @@
if (*offset < 0)
return -EINVAL;
- if (count <= 0)
+ if (count == 0 || count > 16384)
return 0;
if (*offset != 0)
return 0;
@@ -970,7 +970,7 @@
if (*offset < 0)
return -EINVAL;
- if (count <= 0)
+ if (count == 0 || count > 16384)
return 0;
if (*offset != 0)
return 0;
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [BK PATCH] PCI hotplug changes for 2.5.36
2002-09-20 0:56 ` Greg KH
@ 2002-09-20 0:57 ` Greg KH
0 siblings, 0 replies; 8+ messages in thread
From: Greg KH @ 2002-09-20 0:57 UTC (permalink / raw)
To: linux-kernel, pcihpd-discuss
# This is a BitKeeper generated patch for the following project:
# Project Name: Linux kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher.
# This patch includes the following deltas:
# ChangeSet 1.563 -> 1.564
# drivers/hotplug/pci_hotplug_core.c 1.23 -> 1.24
# drivers/pci/proc.c 1.18 -> 1.19
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 02/09/19 greg@kroah.com 1.564
# PCI Hotplug: created /proc/bus/pci/slots for pcihpfs to be mounted on.
#
# proc_bus_pci_dir had to be exported for this to work properly.
# --------------------------------------------
#
diff -Nru a/drivers/hotplug/pci_hotplug_core.c b/drivers/hotplug/pci_hotplug_core.c
--- a/drivers/hotplug/pci_hotplug_core.c Thu Sep 19 17:50:33 2002
+++ b/drivers/hotplug/pci_hotplug_core.c Thu Sep 19 17:50:33 2002
@@ -39,6 +39,7 @@
#include <linux/namei.h>
#include <linux/pci.h>
#include <linux/dnotify.h>
+#include <linux/proc_fs.h>
#include <asm/uaccess.h>
#include "pci_hotplug.h"
@@ -113,6 +114,12 @@
"133 MHz PCIX 533", /* 0x13 */
};
+#ifdef CONFIG_PROC_FS
+extern struct proc_dir_entry *proc_bus_pci_dir;
+static struct proc_dir_entry *slotdir = NULL;
+static const char *slotdir_name = "slots";
+#endif
+
static struct inode *pcihpfs_get_inode (struct super_block *sb, int mode, int dev)
{
struct inode *inode = new_inode(sb);
@@ -1265,6 +1272,11 @@
goto exit;
}
+#ifdef CONFIG_PROC_FS
+ /* create mount point for pcihpfs */
+ slotdir = proc_mkdir(slotdir_name, proc_bus_pci_dir);
+#endif
+
info (DRIVER_DESC " version: " DRIVER_VERSION "\n");
exit:
@@ -1274,6 +1286,11 @@
static void __exit pci_hotplug_exit (void)
{
unregister_filesystem(&pcihpfs_type);
+
+#ifdef CONFIG_PROC_FS
+ if (slotdir)
+ remove_proc_entry(slotdir_name, proc_bus_pci_dir);
+#endif
}
module_init(pci_hotplug_init);
diff -Nru a/drivers/pci/proc.c b/drivers/pci/proc.c
--- a/drivers/pci/proc.c Thu Sep 19 17:50:33 2002
+++ b/drivers/pci/proc.c Thu Sep 19 17:50:33 2002
@@ -371,7 +371,7 @@
show: show_device
};
-static struct proc_dir_entry *proc_bus_pci_dir;
+struct proc_dir_entry *proc_bus_pci_dir;
/* driverfs files */
static ssize_t pci_show_irq(struct device * dev, char * buf, size_t count, loff_t off)
@@ -621,5 +621,6 @@
EXPORT_SYMBOL(pci_proc_detach_device);
EXPORT_SYMBOL(pci_proc_attach_bus);
EXPORT_SYMBOL(pci_proc_detach_bus);
+EXPORT_SYMBOL(proc_bus_pci_dir);
#endif
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2002-09-20 0:53 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-09-20 0:54 [BK PATCH] PCI hotplug changes for 2.5.36 Greg KH
2002-09-20 0:54 ` Greg KH
2002-09-20 0:54 ` Greg KH
2002-09-20 0:55 ` Greg KH
2002-09-20 0:55 ` Greg KH
2002-09-20 0:55 ` Greg KH
2002-09-20 0:56 ` Greg KH
2002-09-20 0:57 ` Greg KH
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).