Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 40836
b: refs/heads/master
c: 43539c3
h: refs/heads/master
v: v3
  • Loading branch information
Eric W. Biederman authored and Linus Torvalds committed Nov 9, 2006
1 parent fda9125 commit abd52b0
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 6 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: ec68307cc5a8dc499e48693843bb42f6b6028458
refs/heads/master: 43539c38cd8edb915d1f0e1f55dcb70638b4cc8e
29 changes: 24 additions & 5 deletions trunk/drivers/pci/htirq.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ static DEFINE_SPINLOCK(ht_irq_lock);

struct ht_irq_cfg {
struct pci_dev *dev;
/* Update callback used to cope with buggy hardware */
ht_irq_update_t *update;
unsigned pos;
unsigned idx;
struct ht_irq_msg msg;
Expand All @@ -44,6 +46,8 @@ void write_ht_irq_msg(unsigned int irq, struct ht_irq_msg *msg)
pci_write_config_byte(cfg->dev, cfg->pos + 2, cfg->idx + 1);
pci_write_config_dword(cfg->dev, cfg->pos + 4, msg->address_hi);
}
if (cfg->update)
cfg->update(cfg->dev, irq, msg);
spin_unlock_irqrestore(&ht_irq_lock, flags);
cfg->msg = *msg;
}
Expand Down Expand Up @@ -79,16 +83,14 @@ void unmask_ht_irq(unsigned int irq)
}

/**
* ht_create_irq - create an irq and attach it to a device.
* __ht_create_irq - create an irq and attach it to a device.
* @dev: The hypertransport device to find the irq capability on.
* @idx: Which of the possible irqs to attach to.
*
* ht_create_irq is needs to be called for all hypertransport devices
* that generate irqs.
* @update: Function to be called when changing the htirq message
*
* The irq number of the new irq or a negative error value is returned.
*/
int ht_create_irq(struct pci_dev *dev, int idx)
int __ht_create_irq(struct pci_dev *dev, int idx, ht_irq_update_t *update)
{
struct ht_irq_cfg *cfg;
unsigned long flags;
Expand Down Expand Up @@ -123,6 +125,7 @@ int ht_create_irq(struct pci_dev *dev, int idx)
return -ENOMEM;

cfg->dev = dev;
cfg->update = update;
cfg->pos = pos;
cfg->idx = 0x10 + (idx * 2);
/* Initialize msg to a value that will never match the first write. */
Expand All @@ -144,6 +147,21 @@ int ht_create_irq(struct pci_dev *dev, int idx)
return irq;
}

/**
* ht_create_irq - create an irq and attach it to a device.
* @dev: The hypertransport device to find the irq capability on.
* @idx: Which of the possible irqs to attach to.
*
* ht_create_irq needs to be called for all hypertransport devices
* that generate irqs.
*
* The irq number of the new irq or a negative error value is returned.
*/
int ht_create_irq(struct pci_dev *dev, int idx)
{
return __ht_create_irq(dev, idx, NULL);
}

/**
* ht_destroy_irq - destroy an irq created with ht_create_irq
*
Expand All @@ -162,5 +180,6 @@ void ht_destroy_irq(unsigned int irq)
kfree(cfg);
}

EXPORT_SYMBOL(__ht_create_irq);
EXPORT_SYMBOL(ht_create_irq);
EXPORT_SYMBOL(ht_destroy_irq);
5 changes: 5 additions & 0 deletions trunk/include/linux/htirq.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,9 @@ void unmask_ht_irq(unsigned int irq);
/* The arch hook for getting things started */
int arch_setup_ht_irq(unsigned int irq, struct pci_dev *dev);

/* For drivers of buggy hardware */
typedef void (ht_irq_update_t)(struct pci_dev *dev, int irq,
struct ht_irq_msg *msg);
int __ht_create_irq(struct pci_dev *dev, int idx, ht_irq_update_t *update);

#endif /* LINUX_HTIRQ_H */

0 comments on commit abd52b0

Please sign in to comment.