From: James Bottomley <James.Bottomley@steeleye.com>
To: PARISC list <parisc-linux@lists.parisc-linux.org>
Subject: [parisc-linux] proposed changes to dino.c
Date: 09 Dec 2003 23:37:16 -0500 [thread overview]
Message-ID: <1071031038.1977.1.camel@mulgrave> (raw)
This updates dino to configure unassigned resources (primarily so I can
get it to recognise my yenta cardbus bridge).
The side effect is that it will reorder all the resources in the dino
window.
James
===== drivers/parisc/dino.c 1.9 vs edited =====
--- 1.9/drivers/parisc/dino.c Fri Oct 10 05:11:03 2003
+++ edited/drivers/parisc/dino.c Tue Dec 9 22:33:18 2003
@@ -165,6 +165,13 @@
#define DINO_CFG_TOK(bus,dfn,pos) ((u32) ((bus)<<16 | (dfn)<<8 | (pos)))
+/*
+ * keep the current highest bus count to assist in allocating busses. This
+ * tries to keep a global bus count total so that when we discover an
+ * entirely new bus, it can be given a unique bus number.
+ */
+static int dino_current_bus = 0;
+
static int dino_cfg_read(struct pci_bus *bus, unsigned int devfn, int where,
int size, u32 *val)
{
@@ -559,8 +566,14 @@
__FUNCTION__, bus, bus->secondary, bus->dev->platform_data);
/* Firmware doesn't set up card-mode dino, so we have to */
- if (is_card_dino(&dino_dev->hba.dev->id))
+ if (is_card_dino(&dino_dev->hba.dev->id)) {
dino_card_setup(bus, dino_dev->hba.base_addr);
+ } else {
+ bus->resource[0] = &(dino_dev->hba.io_space);
+ bus->resource[1] = &(dino_dev->hba.lmmio_space);
+ pci_bus_assign_resources(bus);
+ pci_enable_bridges(bus);
+ }
/* If this is a PCI-PCI Bridge, read the window registers etc */
if (bus->self)
@@ -595,9 +608,29 @@
}
#endif
}
+ if(dev->irq == 255) {
+#if 0
+ /* This code tries to assign an unassigned interrupt
+ * leave it disabled unless you know what you're doing
+ * since the pin<->interrupt line mapping varies
+ * by bus and machine */
+
+ u32 irq_pin;
+
+ dino_cfg_read(dev->bus, dev->devfn, PCI_INTERRUPT_PIN, 1, &irq_pin);
+ dev->irq = (irq_pin + PCI_SLOT(dev->devfn)) % 4 ;
+ dino_cfg_write(dev->bus, dev->devfn, PCI_INTERRUPT_LINE, 1, dev->irq);
+ dev->irq += dino_dev->dino_region->data.irqbase
+ printk(KERN_WARNING "Device %s has undefined IRQ, setting to %d\n", dev->slot_name, irq_pin);
+#else
+ dev->irq = 65535;
+ printk(KERN_WARNING "Device %s has unassigned IRQ\n", dev->slot_name);
+#endif
+ } else {
- /* Adjust INT_LINE for that busses region */
- dev->irq = dino_dev->dino_region->data.irqbase + dev->irq;
+ /* Adjust INT_LINE for that busses region */
+ dev->irq += dino_dev->dino_region->data.irqbase;
+ }
}
}
@@ -826,6 +859,7 @@
const int name_len = 32;
char *name;
int is_cujo = 0;
+ struct pci_bus *bus;
name = kmalloc(name_len, GFP_KERNEL);
if(name)
@@ -911,9 +945,19 @@
** It's not used to avoid chicken/egg problems
** with configuration accessor functions.
*/
- dino_dev->hba.hba_bus =
- pci_scan_bus_parented(&dev->dev, dino_dev->hba.hba_num,
- &dino_cfg_ops, NULL);
+ bus = pci_scan_bus_parented(&dev->dev, dino_current_bus,
+ &dino_cfg_ops, NULL);
+ if(bus) {
+ /* This code *depends* on scanning being single threaded
+ * if it isn't, this global bus number count will fail
+ */
+ dino_current_bus = bus->subordinate + 1;
+ } else {
+ printk(KERN_ERR "ERROR: failed to scan PCI bus on %s (probably duplicate bus number %d)\n", dev->dev.bus_id, dino_current_bus);
+ /* increment the bus number in case of duplicates */
+ dino_current_bus++;
+ }
+ dino_dev->hba.hba_bus = bus;
return 0;
}
next reply other threads:[~2003-12-10 4:37 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-12-10 4:37 James Bottomley [this message]
2003-12-10 4:54 ` [parisc-linux] proposed changes to dino.c Grant Grundler
2003-12-10 15:12 ` James Bottomley
2003-12-10 21:54 ` James Bottomley
2003-12-12 7:48 ` Grant Grundler
2003-12-12 11:30 ` Thomas Bogendoerfer
2003-12-12 15:00 ` James Bottomley
2003-12-12 15:38 ` Thomas Bogendoerfer
2003-12-12 14:58 ` James Bottomley
2003-12-12 19:28 ` Alan Cox
2003-12-13 3:51 ` Grant Grundler
2003-12-13 15:33 ` Alan Cox
2003-12-13 15:45 ` James Bottomley
2003-12-13 20:33 ` Matthew Wilcox
2003-12-13 20:52 ` Grant Grundler
2003-12-13 3:53 ` Grant Grundler
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1071031038.1977.1.camel@mulgrave \
--to=james.bottomley@steeleye.com \
--cc=parisc-linux@lists.parisc-linux.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox