From: Greg KH <greg@kroah.com>
To: linux-kernel@vger.kernel.org, pcihpd-discuss@lists.sourceforge.net
Subject: Re: [BK PATCH] PCI hotplug changes for 2.5.34
Date: Mon, 9 Sep 2002 15:21:12 -0700 [thread overview]
Message-ID: <20020909222112.GK7433@kroah.com> (raw)
In-Reply-To: <20020909222057.GJ7433@kroah.com>
# 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.628 -> 1.629
# drivers/hotplug/ibmphp.h 1.3 -> 1.4
# drivers/hotplug/ibmphp_ebda.c 1.5 -> 1.6
# drivers/hotplug/ibmphp_hpc.c 1.7 -> 1.8
# drivers/hotplug/ibmphp_core.c 1.9 -> 1.10
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 02/09/09 zubarev@us.ibm.com 1.629
# [PATCH] IBM PCI Hotplug driver update for PCI based controllers
#
# --------------------------------------------
#
diff -Nru a/drivers/hotplug/ibmphp.h b/drivers/hotplug/ibmphp.h
--- a/drivers/hotplug/ibmphp.h Mon Sep 9 15:09:39 2002
+++ b/drivers/hotplug/ibmphp.h Mon Sep 9 15:09:39 2002
@@ -737,6 +737,7 @@
struct controller {
struct ebda_hpc_slot *slots;
struct ebda_hpc_bus *buses;
+ struct pci_dev *ctrl_dev; /* in case where controller is PCI */
u8 starting_slot_num; /* starting and ending slot #'s this ctrl controls*/
u8 ending_slot_num;
u8 revision;
diff -Nru a/drivers/hotplug/ibmphp_core.c b/drivers/hotplug/ibmphp_core.c
--- a/drivers/hotplug/ibmphp_core.c Mon Sep 9 15:09:39 2002
+++ b/drivers/hotplug/ibmphp_core.c Mon Sep 9 15:09:39 2002
@@ -1636,6 +1636,11 @@
max_slots = get_max_slots ();
+ if ((rc = ibmphp_register_pci ())) {
+ ibmphp_unload ();
+ return rc;
+ }
+
if (init_ops ()) {
ibmphp_unload ();
return -ENODEV;
diff -Nru a/drivers/hotplug/ibmphp_ebda.c b/drivers/hotplug/ibmphp_ebda.c
--- a/drivers/hotplug/ibmphp_ebda.c Mon Sep 9 15:09:39 2002
+++ b/drivers/hotplug/ibmphp_ebda.c Mon Sep 9 15:09:39 2002
@@ -131,6 +131,7 @@
controller->slots = NULL;
kfree (controller->buses);
controller->buses = NULL;
+ controller->ctrl_dev = NULL;
kfree (controller);
}
@@ -798,6 +799,8 @@
return NULL;
}
+static struct pci_driver ibmphp_driver;
+
/*
* map info (ctlr-id, slot count, slot#.. bus count, bus#, ctlr type...) of
* each hpc from physical address to a list of hot plug controllers based on
@@ -929,6 +932,7 @@
hpc_ptr->u.pci_ctlr.dev_fun = readb (io_mem + addr + 1);
hpc_ptr->irq = readb (io_mem + addr + 2);
addr += 3;
+ debug ("ctrl bus = %x, ctlr devfun = %x, irq = %x\n", hpc_ptr->u.pci_ctlr.bus, hpc_ptr->u.pci_ctlr.dev_fun, hpc_ptr->irq);
break;
case 0:
@@ -954,12 +958,6 @@
return -ENODEV;
}
- /* following 3 line: Now our driver only supports I2c/ISA ctlrType */
- if ((hpc_ptr->ctlr_type != 2) && (hpc_ptr->ctlr_type != 4) && (hpc_ptr->ctlr_type != 0)) {
- err ("Please run this driver on IBM xSeries440 or xSeries 235\n ");
- return -ENODEV;
- }
-
//reorganize chassis' linked list
combine_wpg_for_chassis ();
combine_wpg_for_expansion ();
@@ -1213,11 +1211,16 @@
struct controller *controller = NULL;
struct list_head *list;
struct list_head *next;
+ int pci_flag = 0;
list_for_each_safe (list, next, &ebda_hpc_head) {
controller = list_entry (list, struct controller, ebda_hpc_list);
if (controller->ctlr_type == 0)
release_region (controller->u.isa_ctlr.io_start, (controller->u.isa_ctlr.io_end - controller->u.isa_ctlr.io_start + 1));
+ else if ((controller->ctlr_type == 1) && (!pci_flag)) {
+ ++pci_flag;
+ pci_unregister_driver (&ibmphp_driver);
+ }
free_ebda_hpc (controller);
}
}
@@ -1234,3 +1237,59 @@
resource = NULL;
}
}
+
+static struct pci_device_id id_table[] __devinitdata = {
+ {
+ vendor: PCI_VENDOR_ID_IBM,
+ device: HPC_DEVICE_ID,
+ subvendor: PCI_VENDOR_ID_IBM,
+ subdevice: HPC_SUBSYSTEM_ID,
+ class: ((PCI_CLASS_SYSTEM_PCI_HOTPLUG << 8) | 0x00),
+ }, {}
+};
+
+MODULE_DEVICE_TABLE(pci, id_table);
+
+static int ibmphp_probe (struct pci_dev *, const struct pci_device_id *);
+static struct pci_driver ibmphp_driver = {
+ name: "ibmphp",
+ id_table: id_table,
+ probe: ibmphp_probe,
+};
+
+int ibmphp_register_pci (void)
+{
+ struct controller *ctrl;
+ struct list_head *tmp;
+ int rc = 0;
+
+ list_for_each (tmp, &ebda_hpc_head) {
+ ctrl = list_entry (tmp, struct controller, ebda_hpc_list);
+ if (ctrl->ctlr_type == 1) {
+ rc = pci_module_init (&ibmphp_driver);
+ break;
+ }
+ }
+ return rc;
+}
+static int ibmphp_probe (struct pci_dev * dev, const struct pci_device_id *ids)
+{
+ struct controller *ctrl;
+ struct list_head *tmp;
+
+ debug ("inside ibmphp_probe \n");
+
+ list_for_each (tmp, &ebda_hpc_head) {
+ ctrl = list_entry (tmp, struct controller, ebda_hpc_list);
+ if (ctrl->ctlr_type == 1) {
+ if ((dev->devfn == ctrl->u.pci_ctlr.dev_fun) && (dev->bus->number == ctrl->u.pci_ctlr.bus)) {
+ ctrl->ctrl_dev = dev;
+ debug ("found device!!! \n");
+ debug ("dev->device = %x, dev->subsystem_device = %x\n", dev->device, dev->subsystem_device);
+ return 0;
+ }
+ }
+ }
+ return -ENODEV;
+}
+
diff -Nru a/drivers/hotplug/ibmphp_hpc.c b/drivers/hotplug/ibmphp_hpc.c
--- a/drivers/hotplug/ibmphp_hpc.c Mon Sep 9 15:09:39 2002
+++ b/drivers/hotplug/ibmphp_hpc.c Mon Sep 9 15:09:39 2002
@@ -379,6 +379,26 @@
outb (data, port_address);
}
+static u8 pci_ctrl_read (struct controller *ctrl, u8 offset)
+{
+ u8 data = 0x00;
+ debug ("inside pci_ctrl_read\n");
+ if (ctrl->ctrl_dev)
+ pci_read_config_byte (ctrl->ctrl_dev, HPC_PCI_OFFSET + offset, &data);
+ return data;
+}
+
+static u8 pci_ctrl_write (struct controller *ctrl, u8 offset, u8 data)
+{
+ u8 rc = -ENODEV;
+ debug ("inside pci_ctrl_write\n");
+ if (ctrl->ctrl_dev) {
+ pci_write_config_byte (ctrl->ctrl_dev, HPC_PCI_OFFSET + offset, data);
+ rc = 0;
+ }
+ return rc;
+}
+
static u8 ctrl_read (struct controller *ctlr, void *base, u8 offset)
{
u8 rc;
@@ -386,6 +406,9 @@
case 0:
rc = isa_ctrl_read (ctlr, offset);
break;
+ case 1:
+ rc = pci_ctrl_read (ctlr, offset);
+ break;
case 2:
case 4:
rc = i2c_ctrl_read (ctlr, base, offset);
@@ -402,6 +425,9 @@
switch (ctlr->ctlr_type) {
case 0:
isa_ctrl_write(ctlr, offset, data);
+ break;
+ case 1:
+ rc = pci_ctrl_write (ctlr, offset, data);
break;
case 2:
case 4:
next prev parent reply other threads:[~2002-09-09 22:28 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-09-09 22:16 [BK PATCH] PCI hotplug changes for 2.5.34 Greg KH
2002-09-09 22:19 ` Greg KH
2002-09-09 22:20 ` Greg KH
2002-09-09 22:20 ` Greg KH
2002-09-09 22:20 ` Greg KH
2002-09-09 22:21 ` Greg KH [this message]
2002-09-09 22:21 ` Greg KH
2002-09-09 22:21 ` Greg KH
2002-09-09 22:22 ` Greg KH
2002-09-09 22:22 ` Greg KH
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20020909222112.GK7433@kroah.com \
--to=greg@kroah.com \
--cc=linux-kernel@vger.kernel.org \
--cc=pcihpd-discuss@lists.sourceforge.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.