Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 174736
b: refs/heads/master
c: 15ea76d
h: refs/heads/master
v: v3
  • Loading branch information
Tejun Heo authored and Jesse Barnes committed Nov 4, 2009
1 parent dc944d0 commit a04d31f
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 29 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 4c0eec7a86303ce6e3edf7825d0ef1d414e76767
refs/heads/master: 15ea76d407d560f985224b65fe59c9db01692a0d
40 changes: 20 additions & 20 deletions trunk/drivers/pci/pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -1875,23 +1875,6 @@ void pci_clear_master(struct pci_dev *dev)
__pci_set_master(dev, false);
}

#ifdef PCI_DISABLE_MWI
int pci_set_mwi(struct pci_dev *dev)
{
return 0;
}

int pci_try_set_mwi(struct pci_dev *dev)
{
return 0;
}

void pci_clear_mwi(struct pci_dev *dev)
{
}

#else

/**
* pci_set_cacheline_size - ensure the CACHE_LINE_SIZE register is programmed
* @dev: the PCI device for which MWI is to be enabled
Expand All @@ -1902,13 +1885,12 @@ void pci_clear_mwi(struct pci_dev *dev)
*
* RETURNS: An appropriate -ERRNO error value on error, or zero for success.
*/
static int
pci_set_cacheline_size(struct pci_dev *dev)
int pci_set_cacheline_size(struct pci_dev *dev)
{
u8 cacheline_size;

if (!pci_cache_line_size)
return -EINVAL; /* The system doesn't support MWI. */
return -EINVAL;

/* Validate current setting: the PCI_CACHE_LINE_SIZE must be
equal to or multiple of the right value. */
Expand All @@ -1929,6 +1911,24 @@ pci_set_cacheline_size(struct pci_dev *dev)

return -EINVAL;
}
EXPORT_SYMBOL_GPL(pci_set_cacheline_size);

#ifdef PCI_DISABLE_MWI
int pci_set_mwi(struct pci_dev *dev)
{
return 0;
}

int pci_try_set_mwi(struct pci_dev *dev)
{
return 0;
}

void pci_clear_mwi(struct pci_dev *dev)
{
}

#else

/**
* pci_set_mwi - enables memory-write-invalidate PCI transaction
Expand Down
23 changes: 15 additions & 8 deletions trunk/drivers/pcmcia/cardbus.c
Original file line number Diff line number Diff line change
Expand Up @@ -184,26 +184,33 @@ int read_cb_mem(struct pcmcia_socket * s, int space, u_int addr, u_int len, void
=====================================================================*/

/*
* Since there is only one interrupt available to CardBus
* devices, all devices downstream of this device must
* be using this IRQ.
*/
static void cardbus_assign_irqs(struct pci_bus *bus, int irq)
static void cardbus_config_irq_and_cls(struct pci_bus *bus, int irq)
{
struct pci_dev *dev;

list_for_each_entry(dev, &bus->devices, bus_list) {
u8 irq_pin;

/*
* Since there is only one interrupt available to
* CardBus devices, all devices downstream of this
* device must be using this IRQ.
*/
pci_read_config_byte(dev, PCI_INTERRUPT_PIN, &irq_pin);
if (irq_pin) {
dev->irq = irq;
pci_write_config_byte(dev, PCI_INTERRUPT_LINE, dev->irq);
}

/*
* Some controllers transfer very slowly with 0 CLS.
* Configure it. This may fail as CLS configuration
* is mandatory only for MWI.
*/
pci_set_cacheline_size(dev);

if (dev->subordinate)
cardbus_assign_irqs(dev->subordinate, irq);
cardbus_config_irq_and_cls(dev->subordinate, irq);
}
}

Expand All @@ -228,7 +235,7 @@ int __ref cb_alloc(struct pcmcia_socket * s)
*/
pci_bus_size_bridges(bus);
pci_bus_assign_resources(bus);
cardbus_assign_irqs(bus, s->pci_irq);
cardbus_config_irq_and_cls(bus, s->pci_irq);

/* socket specific tune function */
if (s->tune_bridge)
Expand Down
1 change: 1 addition & 0 deletions trunk/include/linux/pci.h
Original file line number Diff line number Diff line change
Expand Up @@ -701,6 +701,7 @@ void pci_disable_device(struct pci_dev *dev);
void pci_set_master(struct pci_dev *dev);
void pci_clear_master(struct pci_dev *dev);
int pci_set_pcie_reset_state(struct pci_dev *dev, enum pcie_reset_state state);
int pci_set_cacheline_size(struct pci_dev *dev);
#define HAVE_PCI_SET_MWI
int __must_check pci_set_mwi(struct pci_dev *dev);
int pci_try_set_mwi(struct pci_dev *dev);
Expand Down

0 comments on commit a04d31f

Please sign in to comment.