Skip to content

Commit

Permalink
Merge of rsync://rsync.kernel.org/pub/scm/linux/kernel/git/gregkh/pci…
Browse files Browse the repository at this point in the history
…-2.6.git/
  • Loading branch information
Linus Torvalds committed May 4, 2005
2 parents 235bd61 + 9171078 commit 742b0c9
Show file tree
Hide file tree
Showing 18 changed files with 113 additions and 103 deletions.
1 change: 1 addition & 0 deletions Documentation/pci.txt
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,7 @@ 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()
pci_find_slot() Superseded by pci_get_slot()
pcibios_find_class() Superseded by pci_get_class()
pci_find_class() Superseded by pci_get_class()
pci_(read|write)_*_nodev() Superseded by pci_bus_(read|write)_*()
35 changes: 2 additions & 33 deletions Documentation/power/pci.txt
Original file line number Diff line number Diff line change
Expand Up @@ -165,40 +165,9 @@ Description:
These functions are intended for use by individual drivers, and are defined in
struct pci_driver:

int (*save_state) (struct pci_dev *dev, u32 state);
int (*suspend) (struct pci_dev *dev, u32 state);
int (*suspend) (struct pci_dev *dev, pm_message_t state);
int (*resume) (struct pci_dev *dev);
int (*enable_wake) (struct pci_dev *dev, u32 state, int enable);


save_state
----------

Usage:

if (dev->driver && dev->driver->save_state)
dev->driver->save_state(dev,state);

The driver should use this callback to save device state. It should take into
account the current state of the device and the requested state in order to
avoid any unnecessary operations.

For example, a video card that supports all 4 states (D0-D3), all controller
context is preserved when entering D1, but the screen is placed into a low power
state (blanked).

The driver can also interpret this function as a notification that it may be
entering a sleep state in the near future. If it knows that the device cannot
enter the requested state, either because of lack of support for it, or because
the device is middle of some critical operation, then it should fail.

This function should not be used to set any state in the device or the driver
because the device may not actually enter the sleep state (e.g. another driver
later causes causes a global state transition to fail).

Note that in intermediate low power states, a device's I/O and memory spaces may
be disabled and may not be available in subsequent transitions to lower power
states.
int (*enable_wake) (struct pci_dev *dev, pci_power_t state, int enable);


suspend
Expand Down
10 changes: 0 additions & 10 deletions arch/arm/mach-ixp4xx/common-pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -501,15 +501,6 @@ pci_set_dma_mask(struct pci_dev *dev, u64 mask)
return -EIO;
}

int
pci_dac_set_dma_mask(struct pci_dev *dev, u64 mask)
{
if (mask >= SZ_64M - 1 )
return 0;

return -EIO;
}

int
pci_set_consistent_dma_mask(struct pci_dev *dev, u64 mask)
{
Expand All @@ -520,7 +511,6 @@ pci_set_consistent_dma_mask(struct pci_dev *dev, u64 mask)
}

EXPORT_SYMBOL(pci_set_dma_mask);
EXPORT_SYMBOL(pci_dac_set_dma_mask);
EXPORT_SYMBOL(pci_set_consistent_dma_mask);
EXPORT_SYMBOL(ixp4xx_pci_read);
EXPORT_SYMBOL(ixp4xx_pci_write);
Expand Down
2 changes: 1 addition & 1 deletion drivers/pci/hotplug/ibmphp.h
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ struct ebda_hpc_bus {


/********************************************************************
* THREE TYPE OF HOT PLUG CONTROLER *
* THREE TYPE OF HOT PLUG CONTROLLER *
********************************************************************/

struct isa_ctlr_access {
Expand Down
6 changes: 3 additions & 3 deletions drivers/pci/hotplug/ibmphp_hpc.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ static int to_debug = FALSE;
#define WPG_I2C_OR 0x2000 // I2C OR operation

//----------------------------------------------------------------------------
// Command set for I2C Master Operation Setup Regisetr
// Command set for I2C Master Operation Setup Register
//----------------------------------------------------------------------------
#define WPG_READATADDR_MASK 0x00010000 // read,bytes,I2C shifted,index
#define WPG_WRITEATADDR_MASK 0x40010000 // write,bytes,I2C shifted,index
Expand Down Expand Up @@ -835,7 +835,7 @@ static void poll_hpc (void)
if (ibmphp_shutdown)
break;

/* try to get the lock to do some kind of harware access */
/* try to get the lock to do some kind of hardware access */
down (&semOperations);

switch (poll_state) {
Expand Down Expand Up @@ -906,7 +906,7 @@ static void poll_hpc (void)
poll_state = POLL_LATCH_REGISTER;
break;
}
/* give up the harware semaphore */
/* give up the hardware semaphore */
up (&semOperations);
/* sleep for a short time just for good measure */
msleep(100);
Expand Down
7 changes: 5 additions & 2 deletions drivers/pci/hotplug/ibmphp_pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -1308,10 +1308,10 @@ static int unconfigure_boot_device (u8 busno, u8 device, u8 function)
/* ????????? DO WE NEED TO WRITE ANYTHING INTO THE PCI CONFIG SPACE BACK ?????????? */
} else {
/* This is Memory */
start_address &= PCI_BASE_ADDRESS_MEM_MASK;
if (start_address & PCI_BASE_ADDRESS_MEM_PREFETCH) {
/* pfmem */
debug ("start address of pfmem is %x\n", start_address);
start_address &= PCI_BASE_ADDRESS_MEM_MASK;

if (ibmphp_find_resource (bus, start_address, &pfmem, PFMEM) < 0) {
err ("cannot find corresponding PFMEM resource to remove\n");
Expand All @@ -1325,6 +1325,8 @@ static int unconfigure_boot_device (u8 busno, u8 device, u8 function)
} else {
/* regular memory */
debug ("start address of mem is %x\n", start_address);
start_address &= PCI_BASE_ADDRESS_MEM_MASK;

if (ibmphp_find_resource (bus, start_address, &mem, MEM) < 0) {
err ("cannot find corresponding MEM resource to remove\n");
return -EIO;
Expand Down Expand Up @@ -1422,9 +1424,9 @@ static int unconfigure_boot_bridge (u8 busno, u8 device, u8 function)
/* ????????? DO WE NEED TO WRITE ANYTHING INTO THE PCI CONFIG SPACE BACK ?????????? */
} else {
/* This is Memory */
start_address &= PCI_BASE_ADDRESS_MEM_MASK;
if (start_address & PCI_BASE_ADDRESS_MEM_PREFETCH) {
/* pfmem */
start_address &= PCI_BASE_ADDRESS_MEM_MASK;
if (ibmphp_find_resource (bus, start_address, &pfmem, PFMEM) < 0) {
err ("cannot find corresponding PFMEM resource to remove\n");
return -EINVAL;
Expand All @@ -1436,6 +1438,7 @@ static int unconfigure_boot_bridge (u8 busno, u8 device, u8 function)
}
} else {
/* regular memory */
start_address &= PCI_BASE_ADDRESS_MEM_MASK;
if (ibmphp_find_resource (bus, start_address, &mem, MEM) < 0) {
err ("cannot find corresponding MEM resource to remove\n");
return -EINVAL;
Expand Down
2 changes: 1 addition & 1 deletion drivers/pci/hotplug/pci_hotplug.h
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ struct hotplug_slot_info {
* @name: the name of the slot being registered. This string must
* be unique amoung slots registered on this system.
* @ops: pointer to the &struct hotplug_slot_ops to be used for this slot
* @info: pointer to the &struct hotplug_slot_info for the inital values for
* @info: pointer to the &struct hotplug_slot_info for the initial values for
* this slot.
* @release: called during pci_hp_deregister to free memory allocated in a
* hotplug_slot structure.
Expand Down
23 changes: 18 additions & 5 deletions drivers/pci/hotplug/pciehp_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,22 @@ static struct hotplug_slot_ops pciehp_hotplug_slot_ops = {
.get_cur_bus_speed = get_cur_bus_speed,
};

/**
* release_slot - free up the memory used by a slot
* @hotplug_slot: slot to free
*/
static void release_slot(struct hotplug_slot *hotplug_slot)
{
struct slot *slot = hotplug_slot->private;

dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name);

kfree(slot->hotplug_slot->info);
kfree(slot->hotplug_slot->name);
kfree(slot->hotplug_slot);
kfree(slot);
}

static int init_slots(struct controller *ctrl)
{
struct slot *new_slot;
Expand Down Expand Up @@ -139,7 +155,8 @@ static int init_slots(struct controller *ctrl)

/* register this slot with the hotplug pci core */
new_slot->hotplug_slot->private = new_slot;
make_slot_name (new_slot->hotplug_slot->name, SLOT_NAME_SIZE, new_slot);
new_slot->hotplug_slot->release = &release_slot;
make_slot_name(new_slot->hotplug_slot->name, SLOT_NAME_SIZE, new_slot);
new_slot->hotplug_slot->ops = &pciehp_hotplug_slot_ops;

new_slot->hpc_ops->get_power_status(new_slot, &(new_slot->hotplug_slot->info->power_status));
Expand Down Expand Up @@ -188,10 +205,6 @@ static int cleanup_slots (struct controller * ctrl)
while (old_slot) {
next_slot = old_slot->next;
pci_hp_deregister (old_slot->hotplug_slot);
kfree(old_slot->hotplug_slot->info);
kfree(old_slot->hotplug_slot->name);
kfree(old_slot->hotplug_slot);
kfree(old_slot);
old_slot = next_slot;
}

Expand Down
2 changes: 1 addition & 1 deletion drivers/pci/hotplug/pcihp_skeleton.c
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ static int __init init_slots(void)
hotplug_slot->ops = &skel_hotplug_slot_ops;

/*
* Initilize the slot info structure with some known
* Initialize the slot info structure with some known
* good values.
*/
info->power_status = get_power_status(slot);
Expand Down
6 changes: 3 additions & 3 deletions drivers/pci/msi.c
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,7 @@ void pci_scan_msi_device(struct pci_dev *dev)
* msi_capability_init - configure device's MSI capability structure
* @dev: pointer to the pci_dev data structure of MSI device function
*
* Setup the MSI capability structure of device funtion with a single
* Setup the MSI capability structure of device function with a single
* MSI vector, regardless of device function is capable of handling
* multiple messages. A return of zero indicates the successful setup
* of an entry zero with the new MSI vector or non-zero for otherwise.
Expand Down Expand Up @@ -599,7 +599,7 @@ static int msi_capability_init(struct pci_dev *dev)
* msix_capability_init - configure device's MSI-X capability
* @dev: pointer to the pci_dev data structure of MSI-X device function
*
* Setup the MSI-X capability structure of device funtion with a
* Setup the MSI-X capability structure of device function with a
* single MSI-X vector. A return of zero indicates the successful setup of
* requested MSI-X entries with allocated vectors or non-zero for otherwise.
**/
Expand Down Expand Up @@ -1074,7 +1074,7 @@ void pci_disable_msix(struct pci_dev* dev)
* msi_remove_pci_irq_vectors - reclaim MSI(X) vectors to unused state
* @dev: pointer to the pci_dev data structure of MSI(X) device function
*
* Being called during hotplug remove, from which the device funciton
* Being called during hotplug remove, from which the device function
* is hot-removed. All previous assigned MSI/MSI-X vectors, if
* allocated for this device function, are reclaimed to unused state,
* which may be used later on.
Expand Down
2 changes: 1 addition & 1 deletion drivers/pci/pci-acpi.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

static u32 ctrlset_buf[3] = {0, 0, 0};
static u32 global_ctrlsets = 0;
u8 OSC_UUID[16] = {0x5B, 0x4D, 0xDB, 0x33, 0xF7, 0x1F, 0x1C, 0x40, 0x96, 0x57, 0x74, 0x41, 0xC0, 0x3D, 0xD7, 0x66};
static u8 OSC_UUID[16] = {0x5B, 0x4D, 0xDB, 0x33, 0xF7, 0x1F, 0x1C, 0x40, 0x96, 0x57, 0x74, 0x41, 0xC0, 0x3D, 0xD7, 0x66};

static acpi_status
acpi_query_osc (
Expand Down
11 changes: 10 additions & 1 deletion drivers/pci/pci-driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,14 @@ static int pci_device_resume(struct device * dev)
return 0;
}

static void pci_device_shutdown(struct device *dev)
{
struct pci_dev *pci_dev = to_pci_dev(dev);
struct pci_driver *drv = pci_dev->driver;

if (drv && drv->shutdown)
drv->shutdown(pci_dev);
}

#define kobj_to_pci_driver(obj) container_of(obj, struct device_driver, kobj)
#define attr_to_driver_attribute(obj) container_of(obj, struct driver_attribute, attr)
Expand Down Expand Up @@ -373,7 +381,7 @@ pci_populate_driver_dir(struct pci_driver *drv)
*
* Adds the driver structure to the list of registered drivers.
* Returns a negative value on error, otherwise 0.
* If no error occured, the driver remains registered even if
* If no error occurred, the driver remains registered even if
* no device was claimed during registration.
*/
int pci_register_driver(struct pci_driver *drv)
Expand All @@ -385,6 +393,7 @@ int pci_register_driver(struct pci_driver *drv)
drv->driver.bus = &pci_bus_type;
drv->driver.probe = pci_device_probe;
drv->driver.remove = pci_device_remove;
drv->driver.shutdown = pci_device_shutdown,
drv->driver.owner = drv->owner;
drv->driver.kobj.ktype = &pci_driver_kobj_type;
pci_init_dynids(&drv->dynids);
Expand Down
Loading

0 comments on commit 742b0c9

Please sign in to comment.