Commit 92ce78fd authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

Merge kroah.com:/home/greg/linux/BK/bleed-2.5

into kroah.com:/home/greg/linux/BK/pci-2.5
parents 23dabca3 309e1ca8
......@@ -155,17 +155,11 @@ Searching by both vendor/device and subsystem vendor/device ID:
VENDOR_ID or DEVICE_ID. This allows searching for any device from a
specific vendor, for example.
In case you need to decide according to some more complex criteria,
you can walk the list of all known PCI devices yourself:
struct pci_dev *dev;
pci_for_each_dev(dev) {
... do anything you want with dev ...
}
For compatibility with device ordering in older kernels, you can also
use pci_for_each_dev_reverse(dev) for walking the list in the opposite
direction.
Note that these functions are not hotplug-safe. Their hotplug-safe
replacements are pci_get_device(), pci_get_class() and pci_get_subsys().
They increment the reference count on the pci_dev that they return.
You must eventually (possibly at module unload) decrement the reference
count on these devices by calling pci_dev_put().
3. Enabling devices
......@@ -193,6 +187,10 @@ when successful or an error code (PCIBIOS_...) which can be translated to a text
string by pcibios_strerror. Most drivers expect that accesses to valid PCI
devices don't fail.
If you don't have a struct pci_dev available, you can call
pci_bus_(read|write)_config_(byte|word|dword) to access a given device
and function on that bus.
If you access fields in the standard portion of the config header, please
use symbolic names of locations and bits declared in <linux/pci.h>.
......@@ -253,14 +251,23 @@ Documentation/DMA-mapping.txt.
8. Obsolete functions
~~~~~~~~~~~~~~~~~~~~~
There are several functions kept only for compatibility with old drivers
not updated to the new PCI interface. Please don't use them in new code.
There are several functions which you might come across when trying to
port an old driver to the new PCI interface. They are no longer present
in the kernel as they aren't compatible with hotplug or PCI domains or
having sane locking.
pcibios_present() Since ages, you don't need to test presence
of PCI subsystem when trying to talk with it.
pcibios_present() and Since ages, you don't need to test presence
pci_present() of PCI subsystem when trying to talk to it.
If it's not there, the list of PCI devices
is empty and all functions for searching for
devices just return NULL.
pcibios_(read|write)_* Superseded by their pci_(read|write)_*
counterparts.
pcibios_find_* Superseded by their pci_find_* counterparts.
pci_for_each_dev() Superseded by pci_find_device()
pci_for_each_dev_reverse() Superseded by pci_find_device_reverse()
pci_for_each_bus() Superseded by pci_find_next_bus()
pci_find_device() Superseded by pci_get_device()
pci_find_subsys() Superseded by pci_get_subsys()
pcibios_find_class() Superseded by pci_find_class()
pci_(read|write)_*_nodev() Superseded by pci_bus_(read|write)_*()
......@@ -3,6 +3,16 @@
#include <linux/init.h>
#include "pci.h"
struct pci_bus * __devinit pci_acpi_scan_root(struct acpi_device *device, int domain, int busnum)
{
if (domain != 0) {
printk(KERN_WARNING "PCI: Multiple domains not supported\n");
return NULL;
}
return pcibios_scan_root(busnum);
}
static int __init pci_acpi_init(void)
{
if (pcibios_scanned)
......
......@@ -284,21 +284,21 @@ add_window (struct acpi_resource *res, void *data)
}
struct pci_bus *
pcibios_scan_root (void *handle, int seg, int bus)
pci_acpi_scan_root (struct acpi_device *device, int domain, int bus)
{
struct pci_root_info info;
struct pci_controller *controller;
unsigned int windows = 0;
char *name;
printk("PCI: Probing PCI hardware on bus (%02x:%02x)\n", seg, bus);
controller = alloc_pci_controller(seg);
printk("PCI: Probing PCI hardware on bus (%04x:%02x)\n", domain, bus);
controller = alloc_pci_controller(domain);
if (!controller)
goto out1;
controller->acpi_handle = handle;
controller->acpi_handle = device->handle;
acpi_walk_resources(handle, METHOD_NAME__CRS, count_window, &windows);
acpi_walk_resources(device->handle, METHOD_NAME__CRS, count_window, &windows);
controller->window = kmalloc(sizeof(*controller->window) * windows, GFP_KERNEL);
if (!controller->window)
goto out2;
......@@ -307,10 +307,10 @@ pcibios_scan_root (void *handle, int seg, int bus)
if (!name)
goto out3;
sprintf(name, "PCI Bus %02x:%02x", seg, bus);
sprintf(name, "PCI Bus %04x:%02x", domain, bus);
info.controller = controller;
info.name = name;
acpi_walk_resources(handle, METHOD_NAME__CRS, add_window, &info);
acpi_walk_resources(device->handle, METHOD_NAME__CRS, add_window, &info);
return scan_root_bus(bus, &pci_root_ops, controller);
......
......@@ -246,8 +246,6 @@ acpi_pci_root_add (
switch (status) {
case AE_OK:
root->id.segment = (u16) value;
printk("_SEG exists! Unsupported. Abort.\n");
BUG();
break;
case AE_NOT_FOUND:
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
......@@ -309,7 +307,7 @@ acpi_pci_root_add (
* PCI namespace does not get created until this call is made (and
* thus the root bridge's pci_dev does not exist).
*/
root->bus = pcibios_scan_root(root->id.bus);
root->bus = pci_acpi_scan_root(device, root->id.segment, root->id.bus);
if (!root->bus) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"Bus %02x:%02x not present in PCI namespace\n",
......
......@@ -707,6 +707,7 @@ ip2_loadmain(int *iop, int *irqp, unsigned char *firmware, int firmsize)
}
}
#else /* LINUX_VERSION_CODE > 2.1.99 */
{
struct pci_dev *pci_dev_i = NULL;
pci_dev_i = pci_find_device(PCI_VENDOR_ID_COMPUTONE,
PCI_DEVICE_ID_COMPUTONE_IP2EX, pci_dev_i);
......@@ -741,6 +742,7 @@ ip2_loadmain(int *iop, int *irqp, unsigned char *firmware, int firmsize)
pcibios_strerror(status);
}
}
}
#endif /* ! 2_0_X */
#else
printk( KERN_ERR "IP2: PCI card specified but PCI support not\n");
......
......@@ -8,7 +8,7 @@ obj-$(CONFIG_PM) += power.o
obj-$(CONFIG_PROC_FS) += proc.o
ifndef CONFIG_SPARC64
obj-$(CONFIG_PCI) += setup-res.o
obj-y += setup-res.o
endif
obj-$(CONFIG_HOTPLUG) += hotplug.o
......@@ -29,12 +29,7 @@ obj-$(CONFIG_SGI_IP27) += setup-irq.o
obj-$(CONFIG_SGI_IP32) += setup-irq.o
obj-$(CONFIG_X86_VISWS) += setup-irq.o
# CompactPCI hotplug requires the pbus_* functions
ifdef CONFIG_HOTPLUG_PCI_CPCI
obj-y += setup-bus.o
endif
# Hotplug (eg, cardbus) now requires setup-bus
# Cardbus & CompactPCI use setup-bus
obj-$(CONFIG_HOTPLUG) += setup-bus.o
ifndef CONFIG_X86
......
......@@ -21,6 +21,31 @@ config HOTPLUG_PCI
When in doubt, say N.
config HOTPLUG_PCI_FAKE
tristate "Fake PCI Hotplug driver"
depends on HOTPLUG_PCI
help
Say Y here if you want to use the fake PCI hotplug driver. It can
be used to simulate PCI hotplug events if even if your system is
not PCI hotplug capable.
This driver will "emulate" removing PCI devices from the system.
If the "power" file is written to with "0" then the specified PCI
device will be completely removed from the kernel.
WARNING, this does NOT turn off the power to the PCI device.
This is a "logical" removal, not a physical or electrical
removal.
Use this module at your own risk. You have been warned!
This code is also available as a module ( = code which can be
inserted in and removed from the running kernel whenever you want).
The module will be called fakephp. If you want to compile it
as a module, say M here and read <file:Documentation/modules.txt>.
When in doubt, say N.
config HOTPLUG_PCI_COMPAQ
tristate "Compaq PCI Hotplug driver"
depends on HOTPLUG_PCI && X86
......
......@@ -3,6 +3,7 @@
#
obj-$(CONFIG_HOTPLUG_PCI) += pci_hotplug.o
obj-$(CONFIG_HOTPLUG_PCI_FAKE) += fakephp.o
obj-$(CONFIG_HOTPLUG_PCI_COMPAQ) += cpqphp.o
obj-$(CONFIG_HOTPLUG_PCI_IBM) += ibmphp.o
obj-$(CONFIG_HOTPLUG_PCI_ACPI) += acpiphp.o
......
/*
* Fake PCI Hot Plug Controller Driver
*
* Copyright (c) 2003 Greg Kroah-Hartman <greg@kroah.com>
* Copyright (c) 2003 IBM Corp.
* Copyright (c) 2003 Rolf Eike Beer <eike-kernel@sf-tec.de>
*
* Based on ideas and code from:
* Vladimir Kondratiev <vladimir.kondratiev@intel.com>
* Rolf Eike Beer <eike-kernel@sf-tec.de>
*
* All rights reserved.
*
* 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, version 2 of the License.
*
* Send feedback to <greg@kroah.com>
*/
/*
*
* This driver will "emulate" removing PCI devices from the system. If
* the "power" file is written to with "0" then the specified PCI device
* will be completely removed from the kernel.
*
* WARNING, this does NOT turn off the power to the PCI device. This is
* a "logical" removal, not a physical or electrical removal.
*
* Use this module at your own risk, you have been warned!
*
* Enabling PCI devices is left as an exercise for the reader...
*
*/
#include <linux/config.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/pci.h>
#include <linux/init.h>
#include "pci_hotplug.h"
#include "../pci.h"
#if !defined(CONFIG_HOTPLUG_PCI_FAKE_MODULE)
#define MY_NAME "fakephp"
#else
#define MY_NAME THIS_MODULE->name
#endif
#define dbg(format, arg...) \
do { \
if (debug) \
printk(KERN_DEBUG "%s: " format, \
MY_NAME , ## arg); \
} while (0)
#define err(format, arg...) printk(KERN_ERR "%s: " format, MY_NAME , ## arg)
#define info(format, arg...) printk(KERN_INFO "%s: " format, MY_NAME , ## arg)
#define DRIVER_AUTHOR "Greg Kroah-Hartman <greg@kroah.com>"
#define DRIVER_DESC "Fake PCI Hot Plug Controller Driver"
struct dummy_slot {
struct list_head node;
struct hotplug_slot *slot;
struct pci_dev *dev;
};
static int debug;
static LIST_HEAD(slot_list);
static int enable_slot (struct hotplug_slot *slot);
static int disable_slot (struct hotplug_slot *slot);
static struct hotplug_slot_ops dummy_hotplug_slot_ops = {
.owner = THIS_MODULE,
.enable_slot = enable_slot,
.disable_slot = disable_slot,
};
static void dummy_release(struct hotplug_slot *slot)
{
struct dummy_slot *dslot = slot->private;
list_del(&dslot->node);
kfree(dslot->slot->info);
kfree(dslot->slot);
pci_dev_put(dslot->dev);
kfree(dslot);
}
static int add_slot(struct pci_dev *dev)
{
struct dummy_slot *dslot;
struct hotplug_slot *slot;
int retval = -ENOMEM;
slot = kmalloc(sizeof(struct hotplug_slot), GFP_KERNEL);
if (!slot)
goto error;
memset(slot, 0, sizeof(*slot));
slot->info = kmalloc(sizeof(struct hotplug_slot_info), GFP_KERNEL);
if (!slot->info)
goto error_slot;
memset(slot->info, 0, sizeof(struct hotplug_slot_info));
slot->info->power_status = 1;
slot->info->max_bus_speed = PCI_SPEED_UNKNOWN;
slot->info->cur_bus_speed = PCI_SPEED_UNKNOWN;
slot->name = &dev->dev.bus_id[0];
dbg("slot->name = %s\n", slot->name);
dslot = kmalloc(sizeof(struct dummy_slot), GFP_KERNEL);
if (!dslot)
goto error_info;
slot->ops = &dummy_hotplug_slot_ops;
slot->release = &dummy_release;
slot->private = dslot;
retval = pci_hp_register(slot);
if (retval) {
err("pci_hp_register failed with error %d\n", retval);
goto error_dslot;
}
dslot->slot = slot;
dslot->dev = pci_dev_get(dev);
list_add (&dslot->node, &slot_list);
return retval;
error_dslot:
kfree(dslot);
error_info:
kfree(slot->info);
error_slot:
kfree(slot);
error:
return retval;
}
static int __init pci_scan_buses(void)
{
struct pci_dev *dev = NULL;
int retval = 0;
while ((dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) {
retval = add_slot(dev);
if (retval) {
pci_dev_put(dev);
break;
}
}
return retval;
}
static void remove_slot(struct dummy_slot *dslot)
{
int retval;
dbg("removing slot %s\n", dslot->slot->name);
retval = pci_hp_deregister(dslot->slot);
if (retval)
err("Problem unregistering a slot %s\n", dslot->slot->name);
}
static int enable_slot(struct hotplug_slot *hotplug_slot)
{
return -ENODEV;
}
static int disable_slot(struct hotplug_slot *slot)
{
struct dummy_slot *dslot;
if (!slot)
return -ENODEV;
dslot = slot->private;
dbg("%s - physical_slot = %s\n", __FUNCTION__, slot->name);
/* don't disable bridged devices just yet, we can't handle them easily... */
if (dslot->dev->subordinate) {
err("Can't remove PCI devices with other PCI devices behind it yet.\n");
return -ENODEV;
}
/* remove the device from the pci core */
pci_remove_bus_device(dslot->dev);
/* blow away this sysfs entry and other parts. */
remove_slot(dslot);
return 0;
}
static void cleanup_slots (void)
{
struct list_head *tmp;
struct list_head *next;
struct dummy_slot *dslot;
list_for_each_safe (tmp, next, &slot_list) {
dslot = list_entry (tmp, struct dummy_slot, node);
remove_slot(dslot);
}
}
static int __init dummyphp_init(void)
{
info(DRIVER_DESC "\n");
return pci_scan_buses();
}
static void __exit dummyphp_exit(void)
{
cleanup_slots();
}
module_init(dummyphp_init);
module_exit(dummyphp_exit);
MODULE_AUTHOR(DRIVER_AUTHOR);
MODULE_DESCRIPTION(DRIVER_DESC);
MODULE_LICENSE("GPL");
MODULE_PARM(debug, "i");
MODULE_PARM_DESC(debug, "Debugging mode enabled or not");
......@@ -152,11 +152,11 @@ static u8 i2c_ctrl_read (struct controller *ctlr_ptr, void *WPGBbar, u8 index)
u8 status;
int i;
void *wpg_addr; // base addr + offset
ulong wpg_data, // data to/from WPG LOHI format
ultemp, data; // actual data HILO format
unsigned long wpg_data; // data to/from WPG LOHI format
unsigned long ultemp;
unsigned long data; // actual data HILO format
debug_polling ("%s - Entry WPGBbar[%lx] index[%x] \n", __FUNCTION__, (ulong) WPGBbar, index);
debug_polling ("%s - Entry WPGBbar[%p] index[%x] \n", __FUNCTION__, WPGBbar, index);
//--------------------------------------------------------------------
// READ - step 1
......@@ -165,17 +165,17 @@ static u8 i2c_ctrl_read (struct controller *ctlr_ptr, void *WPGBbar, u8 index)
if (ctlr_ptr->ctlr_type == 0x02) {
data = WPG_READATADDR_MASK;
// fill in I2C address
ultemp = (ulong) ctlr_ptr->u.wpeg_ctlr.i2c_addr;
ultemp = (unsigned long)ctlr_ptr->u.wpeg_ctlr.i2c_addr;
ultemp = ultemp >> 1;
data |= (ultemp << 8);
// fill in index
data |= (ulong) index;
data |= (unsigned long)index;
} else if (ctlr_ptr->ctlr_type == 0x04) {
data = WPG_READDIRECT_MASK;
// fill in index
ultemp = (ulong) index;
ultemp = (unsigned long)index;
ultemp = ultemp << 8;
data |= ultemp;
} else {
......@@ -184,14 +184,14 @@ static u8 i2c_ctrl_read (struct controller *ctlr_ptr, void *WPGBbar, u8 index)
}
wpg_data = swab32 (data); // swap data before writing
(ulong) wpg_addr = (ulong) WPGBbar + (ulong) WPG_I2CMOSUP_OFFSET;
wpg_addr = WPGBbar + WPG_I2CMOSUP_OFFSET;
writel (wpg_data, wpg_addr);
//--------------------------------------------------------------------
// READ - step 2 : clear the message buffer
data = 0x00000000;
wpg_data = swab32 (data);
(ulong) wpg_addr = (ulong) WPGBbar + (ulong) WPG_I2CMBUFL_OFFSET;
wpg_addr = WPGBbar + WPG_I2CMBUFL_OFFSET;
writel (wpg_data, wpg_addr);
//--------------------------------------------------------------------
......@@ -199,7 +199,7 @@ static u8 i2c_ctrl_read (struct controller *ctlr_ptr, void *WPGBbar, u8 index)
// 2020 : [20] OR operation at [20] offset 0x20
data = WPG_I2CMCNTL_STARTOP_MASK;
wpg_data = swab32 (data);
(ulong) wpg_addr = (ulong) WPGBbar + (ulong) WPG_I2CMCNTL_OFFSET + (ulong) WPG_I2C_OR;
wpg_addr = WPGBbar + WPG_I2CMCNTL_OFFSET + WPG_I2C_OR;
writel (wpg_data, wpg_addr);
//--------------------------------------------------------------------
......@@ -207,7 +207,7 @@ static u8 i2c_ctrl_read (struct controller *ctlr_ptr, void *WPGBbar, u8 index)
i = CMD_COMPLETE_TOUT_SEC;
while (i) {
long_delay (1 * HZ / 100);
(ulong) wpg_addr = (ulong) WPGBbar + (ulong) WPG_I2CMCNTL_OFFSET;
wpg_addr = WPGBbar + WPG_I2CMCNTL_OFFSET;
wpg_data = readl (wpg_addr);
data = swab32 (wpg_data);
if (!(data & WPG_I2CMCNTL_STARTOP_MASK))
......@@ -223,7 +223,7 @@ static u8 i2c_ctrl_read (struct controller *ctlr_ptr, void *WPGBbar, u8 index)
i = CMD_COMPLETE_TOUT_SEC;
while (i) {
long_delay (1 * HZ / 100);
(ulong) wpg_addr = (ulong) WPGBbar + (ulong) WPG_I2CSTAT_OFFSET;
wpg_addr = WPGBbar + WPG_I2CSTAT_OFFSET;
wpg_data = readl (wpg_addr);
data = swab32 (wpg_data);
if (HPC_I2CSTATUS_CHECK (data))
......@@ -237,7 +237,7 @@ static u8 i2c_ctrl_read (struct controller *ctlr_ptr, void *WPGBbar, u8 index)
//--------------------------------------------------------------------
// READ - step 6 : get DATA
(ulong) wpg_addr = (ulong) WPGBbar + (ulong) WPG_I2CMBUFL_OFFSET;
wpg_addr = WPGBbar + WPG_I2CMBUFL_OFFSET;
wpg_data = readl (wpg_addr);
data = swab32 (wpg_data);
......@@ -259,12 +259,12 @@ static u8 i2c_ctrl_write (struct controller *ctlr_ptr, void *WPGBbar, u8 index,
{
u8 rc;
void *wpg_addr; // base addr + offset
ulong wpg_data, // data to/from WPG LOHI format
ultemp, data; // actual data HILO format
unsigned long wpg_data; // data to/from WPG LOHI format
unsigned long ultemp;
unsigned long data; // actual data HILO format
int i;
debug_polling ("%s - Entry WPGBbar[%lx] index[%x] cmd[%x]\n", __FUNCTION__, (ulong) WPGBbar, index, cmd);
debug_polling ("%s - Entry WPGBbar[%p] index[%x] cmd[%x]\n", __FUNCTION__, WPGBbar, index, cmd);
rc = 0;
//--------------------------------------------------------------------
......@@ -276,17 +276,17 @@ static u8 i2c_ctrl_write (struct controller *ctlr_ptr, void *WPGBbar, u8 index,
if (ctlr_ptr->ctlr_type == 0x02) {
data = WPG_WRITEATADDR_MASK;
// fill in I2C address
ultemp = (ulong) ctlr_ptr->u.wpeg_ctlr.i2c_addr;
ultemp = (unsigned long)ctlr_ptr->u.wpeg_ctlr.i2c_addr;
ultemp = ultemp >> 1;
data |= (ultemp << 8);
// fill in index
data |= (ulong) index;
data |= (unsigned long)index;
} else if (ctlr_ptr->ctlr_type == 0x04) {
data = WPG_WRITEDIRECT_MASK;
// fill in index
ultemp = (ulong) index;
ultemp = (unsigned long)index;
ultemp = ultemp << 8;
data |= ultemp;
} else {
......@@ -295,14 +295,14 @@ static u8 i2c_ctrl_write (struct controller *ctlr_ptr, void *WPGBbar, u8 index,
}
wpg_data = swab32 (data); // swap data before writing
(ulong) wpg_addr = (ulong) WPGBbar + (ulong) WPG_I2CMOSUP_OFFSET;
wpg_addr = WPGBbar + WPG_I2CMOSUP_OFFSET;
writel (wpg_data, wpg_addr);
//--------------------------------------------------------------------
// WRITE - step 2 : clear the message buffer
data = 0x00000000 | (ulong) cmd;
data = 0x00000000 | (unsigned long)cmd;
wpg_data = swab32 (data);
(ulong) wpg_addr = (ulong) WPGBbar + (ulong) WPG_I2CMBUFL_OFFSET;
wpg_addr = WPGBbar + WPG_I2CMBUFL_OFFSET;
writel (wpg_data, wpg_addr);
//--------------------------------------------------------------------
......@@ -310,7 +310,7 @@ static u8 i2c_ctrl_write (struct controller *ctlr_ptr, void *WPGBbar, u8 index,
// 2020 : [20] OR operation at [20] offset 0x20
data = WPG_I2CMCNTL_STARTOP_MASK;
wpg_data = swab32 (data);
(ulong) wpg_addr = (ulong) WPGBbar + (ulong) WPG_I2CMCNTL_OFFSET + (ulong) WPG_I2C_OR;
wpg_addr = WPGBbar + WPG_I2CMCNTL_OFFSET + WPG_I2C_OR;
writel (wpg_data, wpg_addr);
//--------------------------------------------------------------------
......@@ -318,7 +318,7 @@ static u8 i2c_ctrl_write (struct controller *ctlr_ptr, void *WPGBbar, u8 index,
i = CMD_COMPLETE_TOUT_SEC;
while (i) {
long_delay (1 * HZ / 100);
(ulong) wpg_addr = (ulong) WPGBbar + (ulong) WPG_I2CMCNTL_OFFSET;
wpg_addr = WPGBbar + WPG_I2CMCNTL_OFFSET;
wpg_data = readl (wpg_addr);
data = swab32 (wpg_data);
if (!(data & WPG_I2CMCNTL_STARTOP_MASK))
......@@ -335,7 +335,7 @@ static u8 i2c_ctrl_write (struct controller *ctlr_ptr, void *WPGBbar, u8 index,
i = CMD_COMPLETE_TOUT_SEC;
while (i) {
long_delay (1 * HZ / 100);
(ulong) wpg_addr = (ulong) WPGBbar + (ulong) WPG_I2CSTAT_OFFSET;
wpg_addr = WPGBbar + WPG_I2CSTAT_OFFSET;
wpg_data = readl (wpg_addr);
data = swab32 (wpg_data);
if (HPC_I2CSTATUS_CHECK (data))
......@@ -543,7 +543,7 @@ int ibmphp_hpc_readslot (struct slot * pslot, u8 cmd, u8 * pstatus)
int rc = 0;
int busindex;
debug_polling ("%s - Entry pslot[%lx] cmd[%x] pstatus[%lx]\n", __FUNCTION__, (ulong) pslot, cmd, (ulong) pstatus);
debug_polling ("%s - Entry pslot[%p] cmd[%x] pstatus[%p]\n", __FUNCTION__, pslot, cmd, pstatus);
if ((pslot == NULL)
|| ((pstatus == NULL) && (cmd != READ_ALLSTAT) && (cmd != READ_BUSSTATUS))) {
......@@ -683,7 +683,7 @@ int ibmphp_hpc_writeslot (struct slot * pslot, u8 cmd)
int rc = 0;
int timeout;
debug_polling ("%s - Entry pslot[%lx] cmd[%x]\n", __FUNCTION__, (ulong) pslot, cmd);
debug_polling ("%s - Entry pslot[%p] cmd[%x]\n", __FUNCTION__, pslot, cmd);
if (pslot == NULL) {
rc = -EINVAL;
err ("%s - Error Exit rc[%d]\n", __FUNCTION__, rc);
......@@ -976,7 +976,7 @@ static int update_slot (struct slot *pslot, u8 update)
{
int rc = 0;
debug ("%s - Entry pslot[%lx]\n", __FUNCTION__, (ulong) pslot);
debug ("%s - Entry pslot[%p]\n", __FUNCTION__, pslot);
rc = ibmphp_hpc_readslot (pslot, READ_ALLSTAT, NULL);
debug ("%s - Exit rc[%d]\n", __FUNCTION__, rc);
return rc;
......@@ -1004,8 +1004,7 @@ static int process_changeinstatus (struct slot *pslot, struct slot *poldslot)
u8 disable = FALSE;
u8 update = FALSE;
debug ("process_changeinstatus - Entry pslot[%lx], poldslot[%lx]\n", (ulong) pslot,
(ulong) poldslot);
debug ("process_changeinstatus - Entry pslot[%p], poldslot[%p]\n", pslot, poldslot);
// bit 0 - HPC_SLOT_POWER
if ((pslot->status & 0x01) != (poldslot->status & 0x01))
......
......@@ -42,7 +42,7 @@ static int remove_ranges (struct bus_node *, struct bus_node *);
static int update_bridge_ranges (struct bus_node **);
static int add_range (int type, struct range_node *, struct bus_node *);
static void fix_resources (struct bus_node *);
static inline struct bus_node *find_bus_wprev (u8, struct bus_node **, u8);
static struct bus_node *find_bus_wprev (u8, struct bus_node **, u8);
static LIST_HEAD(gbuses);
LIST_HEAD(ibmphp_res_head);
......@@ -1757,7 +1757,7 @@ struct bus_node *ibmphp_find_res_bus (u8 bus_number)
return find_bus_wprev (bus_number, NULL, 0);
}
static inline struct bus_node *find_bus_wprev (u8 bus_number, struct bus_node **prev, u8 flag)
static struct bus_node *find_bus_wprev (u8 bus_number, struct bus_node **prev, u8 flag)
{
struct bus_node *bus_cur;
struct list_head *tmp;
......
......@@ -51,6 +51,8 @@ struct hotplug_slot_attribute {
ssize_t (*show)(struct hotplug_slot *, char *);
ssize_t (*store)(struct hotplug_slot *, const char *, size_t);
};
#define to_hotplug_attr(n) container_of(n, struct hotplug_slot_attribute, attr);
/**
* struct hotplug_slot_ops -the callbacks that the hotplug pci core can use
* @owner: The module owner of this structure
......@@ -130,12 +132,14 @@ struct hotplug_slot {
char *name;
struct hotplug_slot_ops *ops;
struct hotplug_slot_info *info;
void (*release) (struct hotplug_slot *slot);
void *private;
/* Variables below this are for use only by the hotplug pci core. */
struct list_head slot_list;
struct kobject kobj;
};
#define to_hotplug_slot(n) container_of(n, struct hotplug_slot, kobj)
extern int pci_hp_register (struct hotplug_slot *slot);
extern int pci_hp_deregister (struct hotplug_slot *slot);
......
......@@ -74,20 +74,16 @@ static struct subsystem hotplug_slots_subsys;
static ssize_t hotplug_slot_attr_show(struct kobject *kobj,
struct attribute *attr, char *buf)
{
struct hotplug_slot *slot=container_of(kobj,
struct hotplug_slot,kobj);
struct hotplug_slot_attribute *attribute =
container_of(attr, struct hotplug_slot_attribute, attr);
struct hotplug_slot *slot = to_hotplug_slot(kobj);
struct hotplug_slot_attribute *attribute = to_hotplug_attr(attr);
return attribute->show ? attribute->show(slot, buf) : 0;
}
static ssize_t hotplug_slot_attr_store(struct kobject *kobj,
struct attribute *attr, const char *buf, size_t len)
{
struct hotplug_slot *slot=container_of(kobj,
struct hotplug_slot,kobj);
struct hotplug_slot_attribute *attribute =
container_of(attr, struct hotplug_slot_attribute, attr);
struct hotplug_slot *slot = to_hotplug_slot(kobj);
struct hotplug_slot_attribute *attribute = to_hotplug_attr(attr);
return attribute->store ? attribute->store(slot, buf, len) : 0;
}
......@@ -96,8 +92,16 @@ static struct sysfs_ops hotplug_slot_sysfs_ops = {
.store = hotplug_slot_attr_store,
};
static void hotplug_slot_release(struct kobject *kobj)
{
struct hotplug_slot *slot = to_hotplug_slot(kobj);
if (slot->release)
slot->release(slot);
}
static struct kobj_type hotplug_slot_ktype = {
.sysfs_ops = &hotplug_slot_sysfs_ops
.sysfs_ops = &hotplug_slot_sysfs_ops,
.release = &hotplug_slot_release,
};
static decl_subsys(hotplug_slots, &hotplug_slot_ktype, NULL);
......
......@@ -18,7 +18,10 @@
#define CARDBUS_LATENCY_TIMER 176 /* secondary latency timer */
#define CARDBUS_RESERVE_BUSNR 3
/* Ugh. Need to stop exporting this to modules. */
LIST_HEAD(pci_root_buses);
EXPORT_SYMBOL(pci_root_buses);
LIST_HEAD(pci_devices);
/*
......@@ -643,7 +646,7 @@ int __devinit pci_bus_exists(const struct list_head *list, int nr)
return 0;
}
static struct pci_bus * __devinit pci_alloc_primary_bus_parented(struct device *parent, int bus)
struct pci_bus * __devinit pci_scan_bus_parented(struct device *parent, int bus, struct pci_ops *ops, void *sysdata)
{
struct pci_bus *b;
......@@ -663,39 +666,32 @@ static struct pci_bus * __devinit pci_alloc_primary_bus_parented(struct device *
return NULL;
}
b->sysdata = sysdata;
b->ops = ops;
list_add_tail(&b->node, &pci_root_buses);
memset(b->dev,0,sizeof(*(b->dev)));
sprintf(b->dev->bus_id,"pci%d",bus);
strcpy(b->dev->name,"Host/PCI Bridge");
b->dev->parent = parent;
sprintf(b->dev->bus_id,"pci%04x:%02x", pci_domain_nr(b), bus);
strcpy(b->dev->name,"Host/PCI Bridge");
device_register(b->dev);
b->number = b->secondary = bus;
b->resource[0] = &ioport_resource;
b->resource[1] = &iomem_resource;
return b;
}
struct pci_bus * __devinit pci_scan_bus_parented(struct device *parent, int bus, struct pci_ops *ops, void *sysdata)
{
struct pci_bus *b = pci_alloc_primary_bus_parented(parent, bus);
if (b) {
b->sysdata = sysdata;
b->ops = ops;
b->subordinate = pci_scan_child_bus(b);
pci_bus_add_devices(b);
}
return b;
}
EXPORT_SYMBOL(pci_scan_bus_parented);
EXPORT_SYMBOL(pci_root_buses);
#ifdef CONFIG_HOTPLUG
EXPORT_SYMBOL(pci_add_new_bus);
EXPORT_SYMBOL(pci_do_scan_bus);
EXPORT_SYMBOL(pci_scan_slot);
EXPORT_SYMBOL(pci_scan_bus);
EXPORT_SYMBOL(pci_scan_bridge);
#endif
......@@ -73,6 +73,10 @@ struct pci_bus;
int acpi_pci_bind (struct acpi_device *device);
int acpi_pci_bind_root (struct acpi_device *device, struct acpi_pci_id *id, struct pci_bus *bus);
/* Arch-defined function to add a bus to the system */
struct pci_bus *pci_acpi_scan_root(struct acpi_device *device, int domain, int bus);
#endif /*CONFIG_ACPI_PCI*/
......
......@@ -21,7 +21,6 @@
#define PCIBIOS_MIN_MEM 0x10000000
void pcibios_config_init(void);
struct pci_bus * pcibios_scan_root(void *acpi_handle, int segment, int bus);
struct pci_dev;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment