mirror of https://gitee.com/openkylin/linux.git
Merge master.kernel.org:/pub/scm/linux/kernel/git/gregkh/pci-2.6
This commit is contained in:
commit
41d0ab2a7d
|
@ -20,46 +20,35 @@ int pci_hotplug (struct device *dev, char **envp, int num_envp,
|
|||
|
||||
scratch = buffer;
|
||||
|
||||
/* stuff we want to pass to /sbin/hotplug */
|
||||
envp[i++] = scratch;
|
||||
length += scnprintf (scratch, buffer_size - length, "PCI_CLASS=%04X",
|
||||
pdev->class);
|
||||
if ((buffer_size - length <= 0) || (i >= num_envp))
|
||||
return -ENOMEM;
|
||||
++length;
|
||||
scratch += length;
|
||||
|
||||
envp[i++] = scratch;
|
||||
length += scnprintf (scratch, buffer_size - length, "PCI_ID=%04X:%04X",
|
||||
pdev->vendor, pdev->device);
|
||||
if ((buffer_size - length <= 0) || (i >= num_envp))
|
||||
return -ENOMEM;
|
||||
++length;
|
||||
scratch += length;
|
||||
|
||||
envp[i++] = scratch;
|
||||
length += scnprintf (scratch, buffer_size - length,
|
||||
"PCI_SUBSYS_ID=%04X:%04X", pdev->subsystem_vendor,
|
||||
pdev->subsystem_device);
|
||||
if ((buffer_size - length <= 0) || (i >= num_envp))
|
||||
return -ENOMEM;
|
||||
++length;
|
||||
scratch += length;
|
||||
|
||||
envp[i++] = scratch;
|
||||
length += scnprintf (scratch, buffer_size - length, "PCI_SLOT_NAME=%s",
|
||||
pci_name(pdev));
|
||||
if ((buffer_size - length <= 0) || (i >= num_envp))
|
||||
if (add_hotplug_env_var(envp, num_envp, &i,
|
||||
buffer, buffer_size, &length,
|
||||
"PCI_CLASS=%04X", pdev->class))
|
||||
return -ENOMEM;
|
||||
|
||||
envp[i++] = scratch;
|
||||
length += scnprintf (scratch, buffer_size - length,
|
||||
"MODALIAS=pci:v%08Xd%08Xsv%08Xsd%08Xbc%02Xsc%02Xi%02x",
|
||||
pdev->vendor, pdev->device,
|
||||
pdev->subsystem_vendor, pdev->subsystem_device,
|
||||
(u8)(pdev->class >> 16), (u8)(pdev->class >> 8),
|
||||
(u8)(pdev->class));
|
||||
if ((buffer_size - length <= 0) || (i >= num_envp))
|
||||
if (add_hotplug_env_var(envp, num_envp, &i,
|
||||
buffer, buffer_size, &length,
|
||||
"PCI_ID=%04X:%04X", pdev->vendor, pdev->device))
|
||||
return -ENOMEM;
|
||||
|
||||
if (add_hotplug_env_var(envp, num_envp, &i,
|
||||
buffer, buffer_size, &length,
|
||||
"PCI_SUBSYS_ID=%04X:%04X", pdev->subsystem_vendor,
|
||||
pdev->subsystem_device))
|
||||
return -ENOMEM;
|
||||
|
||||
if (add_hotplug_env_var(envp, num_envp, &i,
|
||||
buffer, buffer_size, &length,
|
||||
"PCI_SLOT_NAME=%s", pci_name(pdev)))
|
||||
return -ENOMEM;
|
||||
|
||||
if (add_hotplug_env_var(envp, num_envp, &i,
|
||||
buffer, buffer_size, &length,
|
||||
"MODALIAS=pci:v%08Xd%08Xsv%08Xsd%08Xbc%02Xsc%02Xi%02x",
|
||||
pdev->vendor, pdev->device,
|
||||
pdev->subsystem_vendor, pdev->subsystem_device,
|
||||
(u8)(pdev->class >> 16), (u8)(pdev->class >> 8),
|
||||
(u8)(pdev->class)))
|
||||
return -ENOMEM;
|
||||
|
||||
envp[i] = NULL;
|
||||
|
|
|
@ -1696,15 +1696,15 @@ void pciehprm_enable_card(
|
|||
pci_bus->number = func->bus;
|
||||
devfn = PCI_DEVFN(func->device, func->function);
|
||||
|
||||
rc = pci_bus_read_config_word(pci_bus, devfn, PCI_COMMAND, &command);
|
||||
rc = pci_bus_read_config_word(pci_bus, devfn, PCI_COMMAND, &cmd);
|
||||
|
||||
if (card_type == PCI_HEADER_TYPE_BRIDGE) {
|
||||
rc = pci_bus_read_config_word(pci_bus, devfn, PCI_BRIDGE_CONTROL, &bcommand);
|
||||
rc = pci_bus_read_config_word(pci_bus, devfn, PCI_BRIDGE_CONTROL, &bcmd);
|
||||
}
|
||||
|
||||
cmd = command = command | PCI_COMMAND_MASTER | PCI_COMMAND_INVALIDATE
|
||||
command = cmd | PCI_COMMAND_MASTER | PCI_COMMAND_INVALIDATE
|
||||
| PCI_COMMAND_IO | PCI_COMMAND_MEMORY;
|
||||
bcmd = bcommand = bcommand | PCI_BRIDGE_CTL_NO_ISA;
|
||||
bcommand = bcmd | PCI_BRIDGE_CTL_NO_ISA;
|
||||
|
||||
ab = find_acpi_bridge_by_bus(acpi_bridges_head, ctrl->seg, ctrl->bus);
|
||||
if (ab) {
|
||||
|
|
|
@ -29,7 +29,6 @@ static inline int pci_proc_detach_bus(struct pci_bus *bus) { return 0; }
|
|||
#endif
|
||||
|
||||
/* Functions for PCI Hotplug drivers to use */
|
||||
extern struct pci_bus * pci_add_new_bus(struct pci_bus *parent, struct pci_dev *dev, int busnr);
|
||||
extern unsigned int pci_do_scan_bus(struct pci_bus *bus);
|
||||
extern int pci_remove_device_safe(struct pci_dev *dev);
|
||||
extern unsigned char pci_max_busnr(void);
|
||||
|
|
|
@ -753,6 +753,12 @@ pci_scan_device(struct pci_bus *bus, int devfn)
|
|||
kfree(dev);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return dev;
|
||||
}
|
||||
|
||||
void __devinit pci_device_add(struct pci_dev *dev, struct pci_bus *bus)
|
||||
{
|
||||
device_initialize(&dev->dev);
|
||||
dev->dev.release = pci_release_dev;
|
||||
pci_dev_get(dev);
|
||||
|
@ -760,20 +766,6 @@ pci_scan_device(struct pci_bus *bus, int devfn)
|
|||
dev->dev.dma_mask = &dev->dma_mask;
|
||||
dev->dev.coherent_dma_mask = 0xffffffffull;
|
||||
|
||||
return dev;
|
||||
}
|
||||
|
||||
struct pci_dev * __devinit
|
||||
pci_scan_single_device(struct pci_bus *bus, int devfn)
|
||||
{
|
||||
struct pci_dev *dev;
|
||||
|
||||
dev = pci_scan_device(bus, devfn);
|
||||
pci_scan_msi_device(dev);
|
||||
|
||||
if (!dev)
|
||||
return NULL;
|
||||
|
||||
/* Fix up broken headers */
|
||||
pci_fixup_device(pci_fixup_header, dev);
|
||||
|
||||
|
@ -785,6 +777,19 @@ pci_scan_single_device(struct pci_bus *bus, int devfn)
|
|||
spin_lock(&pci_bus_lock);
|
||||
list_add_tail(&dev->bus_list, &bus->devices);
|
||||
spin_unlock(&pci_bus_lock);
|
||||
}
|
||||
|
||||
struct pci_dev * __devinit
|
||||
pci_scan_single_device(struct pci_bus *bus, int devfn)
|
||||
{
|
||||
struct pci_dev *dev;
|
||||
|
||||
dev = pci_scan_device(bus, devfn);
|
||||
if (!dev)
|
||||
return NULL;
|
||||
|
||||
pci_device_add(dev, bus);
|
||||
pci_scan_msi_device(dev);
|
||||
|
||||
return dev;
|
||||
}
|
||||
|
@ -881,7 +886,8 @@ unsigned int __devinit pci_do_scan_bus(struct pci_bus *bus)
|
|||
return max;
|
||||
}
|
||||
|
||||
struct pci_bus * __devinit pci_scan_bus_parented(struct device *parent, int bus, struct pci_ops *ops, void *sysdata)
|
||||
struct pci_bus * __devinit pci_create_bus(struct device *parent,
|
||||
int bus, struct pci_ops *ops, void *sysdata)
|
||||
{
|
||||
int error;
|
||||
struct pci_bus *b;
|
||||
|
@ -938,8 +944,6 @@ struct pci_bus * __devinit pci_scan_bus_parented(struct device *parent, int bus,
|
|||
b->resource[0] = &ioport_resource;
|
||||
b->resource[1] = &iomem_resource;
|
||||
|
||||
b->subordinate = pci_scan_child_bus(b);
|
||||
|
||||
return b;
|
||||
|
||||
sys_create_link_err:
|
||||
|
@ -957,6 +961,18 @@ struct pci_bus * __devinit pci_scan_bus_parented(struct device *parent, int bus,
|
|||
kfree(b);
|
||||
return NULL;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(pci_create_bus);
|
||||
|
||||
struct pci_bus * __devinit pci_scan_bus_parented(struct device *parent,
|
||||
int bus, struct pci_ops *ops, void *sysdata)
|
||||
{
|
||||
struct pci_bus *b;
|
||||
|
||||
b = pci_create_bus(parent, bus, ops, sysdata);
|
||||
if (b)
|
||||
b->subordinate = pci_scan_child_bus(b);
|
||||
return b;
|
||||
}
|
||||
EXPORT_SYMBOL(pci_scan_bus_parented);
|
||||
|
||||
#ifdef CONFIG_HOTPLUG
|
||||
|
|
|
@ -876,6 +876,12 @@ static void __init asus_hides_smbus_hostbridge(struct pci_dev *dev)
|
|||
case 0xC00C: /* Samsung P35 notebook */
|
||||
asus_hides_smbus = 1;
|
||||
}
|
||||
} else if (unlikely(dev->subsystem_vendor == PCI_VENDOR_ID_COMPAQ)) {
|
||||
if (dev->device == PCI_DEVICE_ID_INTEL_82855PM_HB)
|
||||
switch(dev->subsystem_device) {
|
||||
case 0x0058: /* Compaq Evo N620c */
|
||||
asus_hides_smbus = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82845_HB, asus_hides_smbus_hostbridge );
|
||||
|
|
|
@ -315,8 +315,11 @@ static inline struct pci_bus *pci_scan_bus(int bus, struct pci_ops *ops, void *s
|
|||
pci_bus_add_devices(root_bus);
|
||||
return root_bus;
|
||||
}
|
||||
struct pci_bus *pci_create_bus(struct device *parent, int bus, struct pci_ops *ops, void *sysdata);
|
||||
struct pci_bus * pci_add_new_bus(struct pci_bus *parent, struct pci_dev *dev, int busnr);
|
||||
int pci_scan_slot(struct pci_bus *bus, int devfn);
|
||||
struct pci_dev * pci_scan_single_device(struct pci_bus *bus, int devfn);
|
||||
void pci_device_add(struct pci_dev *dev, struct pci_bus *bus);
|
||||
unsigned int pci_scan_child_bus(struct pci_bus *bus);
|
||||
void pci_bus_add_device(struct pci_dev *dev);
|
||||
void pci_read_bridge_bases(struct pci_bus *child);
|
||||
|
@ -377,32 +380,32 @@ static inline int pci_write_config_dword(struct pci_dev *dev, int where, u32 val
|
|||
return pci_bus_write_config_dword (dev->bus, dev->devfn, where, val);
|
||||
}
|
||||
|
||||
int pci_enable_device(struct pci_dev *dev);
|
||||
int pci_enable_device_bars(struct pci_dev *dev, int mask);
|
||||
int __must_check pci_enable_device(struct pci_dev *dev);
|
||||
int __must_check pci_enable_device_bars(struct pci_dev *dev, int mask);
|
||||
void pci_disable_device(struct pci_dev *dev);
|
||||
void pci_set_master(struct pci_dev *dev);
|
||||
#define HAVE_PCI_SET_MWI
|
||||
int pci_set_mwi(struct pci_dev *dev);
|
||||
int __must_check pci_set_mwi(struct pci_dev *dev);
|
||||
void pci_clear_mwi(struct pci_dev *dev);
|
||||
void pci_intx(struct pci_dev *dev, int enable);
|
||||
int pci_set_dma_mask(struct pci_dev *dev, u64 mask);
|
||||
int pci_set_consistent_dma_mask(struct pci_dev *dev, u64 mask);
|
||||
int __must_check pci_set_dma_mask(struct pci_dev *dev, u64 mask);
|
||||
int __must_check pci_set_consistent_dma_mask(struct pci_dev *dev, u64 mask);
|
||||
void pci_update_resource(struct pci_dev *dev, struct resource *res, int resno);
|
||||
int pci_assign_resource(struct pci_dev *dev, int i);
|
||||
void pci_restore_bars(struct pci_dev *dev);
|
||||
|
||||
/* ROM control related routines */
|
||||
void __iomem *pci_map_rom(struct pci_dev *pdev, size_t *size);
|
||||
void __iomem *pci_map_rom_copy(struct pci_dev *pdev, size_t *size);
|
||||
void __iomem __must_check *pci_map_rom(struct pci_dev *pdev, size_t *size);
|
||||
void __iomem __must_check *pci_map_rom_copy(struct pci_dev *pdev, size_t *size);
|
||||
void pci_unmap_rom(struct pci_dev *pdev, void __iomem *rom);
|
||||
void pci_remove_rom(struct pci_dev *pdev);
|
||||
|
||||
/* Power management related routines */
|
||||
int pci_save_state(struct pci_dev *dev);
|
||||
int pci_restore_state(struct pci_dev *dev);
|
||||
int pci_set_power_state(struct pci_dev *dev, pci_power_t state);
|
||||
pci_power_t pci_choose_state(struct pci_dev *dev, pm_message_t state);
|
||||
int pci_enable_wake(struct pci_dev *dev, pci_power_t state, int enable);
|
||||
int __must_check pci_set_power_state(struct pci_dev *dev, pci_power_t state);
|
||||
pci_power_t __must_check pci_choose_state(struct pci_dev *dev, pm_message_t state);
|
||||
int __must_check pci_enable_wake(struct pci_dev *dev, pci_power_t state, int enable);
|
||||
|
||||
/* Helper functions for low-level code (drivers/pci/setup-[bus,res].c) */
|
||||
void pci_bus_assign_resources(struct pci_bus *bus);
|
||||
|
|
Loading…
Reference in New Issue