lkml.org 
[lkml]   [2000]   [Sep]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectPATCH: pci_enable_device_mask
I didn't update all the archs, just x86..  Enjoy.  This is not an
official patch submission (so Linus if you see it, don't apply...)? .config
? .tmpconfig
? .tmpconfig.h
? include/config
? include/linux/modules
? include/linux/autoconf.h
? include/linux/version.h
? include/linux/module.mak
? scripts/split-include
? scripts/mkdep
Index: arch/i386/kernel/pci-i386.c
===================================================================
RCS file: /g/cvslan/linux_2_3/arch/i386/kernel/pci-i386.c,v
retrieving revision 1.1.1.15
diff -u -r1.1.1.15 pci-i386.c
--- arch/i386/kernel/pci-i386.c 2000/07/26 02:13:59 1.1.1.15
+++ arch/i386/kernel/pci-i386.c 2000/09/22 11:20:36
@@ -303,7 +303,7 @@
pcibios_assign_resources();
}

-int pcibios_enable_resources(struct pci_dev *dev)
+int pcibios_enable_resources(struct pci_dev *dev, int enable_mask)
{
u16 cmd, old_cmd;
int idx;
@@ -317,12 +317,12 @@
printk(KERN_ERR "PCI: Device %s not available because of resource collisions\n", dev->slot_name);
return -EINVAL;
}
- if (r->flags & IORESOURCE_IO)
+ if ((r->flags & IORESOURCE_IO) && (enable_mask & PCI_COMMAND_IO))
cmd |= PCI_COMMAND_IO;
- if (r->flags & IORESOURCE_MEM)
+ if ((r->flags & IORESOURCE_MEM) && (enable_mask & PCI_COMMAND_MEMORY))
cmd |= PCI_COMMAND_MEMORY;
}
- if (dev->resource[PCI_ROM_RESOURCE].start)
+ if ((dev->resource[PCI_ROM_RESOURCE].start) && (enable_mask & PCI_COMMAND_MEMORY))
cmd |= PCI_COMMAND_MEMORY;
if (cmd != old_cmd) {
printk("PCI: Enabling device %s (%04x -> %04x)\n", dev->slot_name, old_cmd, cmd);
Index: arch/i386/kernel/pci-i386.h
===================================================================
RCS file: /g/cvslan/linux_2_3/arch/i386/kernel/pci-i386.h,v
retrieving revision 1.1.1.5
diff -u -r1.1.1.5 pci-i386.h
--- arch/i386/kernel/pci-i386.h 2000/06/22 15:29:19 1.1.1.5
+++ arch/i386/kernel/pci-i386.h 2000/09/22 11:20:36
@@ -28,7 +28,7 @@
extern unsigned int pcibios_max_latency;

void pcibios_resource_survey(void);
-int pcibios_enable_resources(struct pci_dev *);
+int pcibios_enable_resources(struct pci_dev *, int enable_mask);

/* pci-pc.c */

Index: arch/i386/kernel/pci-pc.c
===================================================================
RCS file: /g/cvslan/linux_2_3/arch/i386/kernel/pci-pc.c,v
retrieving revision 1.1.1.23
diff -u -r1.1.1.23 pci-pc.c
--- arch/i386/kernel/pci-pc.c 2000/06/22 15:29:16 1.1.1.23
+++ arch/i386/kernel/pci-pc.c 2000/09/22 11:20:36
@@ -1039,11 +1039,11 @@
return str;
}

-int pcibios_enable_device(struct pci_dev *dev)
+int pcibios_enable_device(struct pci_dev *dev, int enable_mask)
{
int err;

- if ((err = pcibios_enable_resources(dev)) < 0)
+ if ((err = pcibios_enable_resources(dev, enable_mask)) < 0)
return err;
pcibios_enable_irq(dev);
return 0;
Index: drivers/pci/pci.c
===================================================================
RCS file: /g/cvslan/linux_2_3/drivers/pci/pci.c,v
retrieving revision 1.1.1.31
diff -u -r1.1.1.31 pci.c
--- drivers/pci/pci.c 2000/09/21 00:29:16 1.1.1.31
+++ drivers/pci/pci.c 2000/09/22 11:20:56
@@ -238,24 +238,40 @@
}

/**
- * pci_enable_device - Initialize device before it's used by a driver.
+ * pci_enable_device_mask - Initialize device before it's used by a driver.
* @dev: PCI device to be initialized
+ * @enable_mask: zero, one, or both of %PCI_COMMAND_IO and %PCI_COMMAND_MEMORY
*
* Initialize device before it's used by a driver. Ask low-level code
- * to enable I/O and memory. Wake up the device if it was suspended.
+ * to enable the bits in @enable_mask. Wake up the device if it was suspended.
* Beware, this function can fail.
*/
int
-pci_enable_device(struct pci_dev *dev)
+pci_enable_device_mask(struct pci_dev *dev, int enable_mask)
{
int err;

- if ((err = pcibios_enable_device(dev)) < 0)
+ if ((err = pcibios_enable_device(dev, enable_mask)) < 0)
return err;
pci_set_power_state(dev, 0);
return 0;
}

+
+/**
+ * pci_enable_device - Initialize device before it's used by a driver.
+ * @dev: PCI device to be initialized
+ *
+ * Initialize device before it's used by a driver. Ask low-level code
+ * to enable I/O and memory. Wake up the device if it was suspended.
+ * Beware, this function can fail.
+ */
+int
+pci_enable_device(struct pci_dev *dev)
+{
+ return pci_enable_device_mask(dev, PCI_COMMAND_IO | PCI_COMMAND_MEMORY);
+}
+
int
pci_get_interrupt_pin(struct pci_dev *dev, struct pci_dev **bridge)
{
@@ -1114,6 +1130,7 @@
EXPORT_SYMBOL(pci_devices);
EXPORT_SYMBOL(pci_root_buses);
EXPORT_SYMBOL(pci_enable_device);
+EXPORT_SYMBOL(pci_enable_device_mask);
EXPORT_SYMBOL(pci_find_capability);
EXPORT_SYMBOL(pci_find_class);
EXPORT_SYMBOL(pci_find_device);
\
 
 \ /
  Last update: 2005-03-22 12:45    [W:0.033 / U:7.044 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site