From: James Bottomley <James.Bottomley@steeleye.com>
To: PARISC list <parisc-linux@lists.parisc-linux.org>
Cc: parisc-linux-cvs@lists.parisc-linux.org
Subject: [parisc-linux] Re: [parisc-linux-cvs] linux-2.6 jejb
Date: 03 Sep 2003 16:07:01 -0400 [thread overview]
Message-ID: <1062619623.1781.31.camel@mulgrave> (raw)
In-Reply-To: <20030903200300.8B7B7494064@palinux.hppa>
On Wed, 2003-09-03 at 16:03, James Bottomley wrote:
> CVSROOT: /var/cvs
> Module name: linux-2.6
> Changes by: jejb 03/09/03 14:03:00
>
> Modified files:
> . : Makefile
> drivers/parisc : ccio-dma.c dino.c
>
> Log message:
> Add card mode dino support for machines with a CCIO.
>
> This is rather simplistic: basically it simply tries to expand the
> existing ccio window by the dino card mode size (currently 8MB). This could
> easily fail if there's no room on either side.
>
> Unfortunately, the correct fix (to reprogram the ccio to take into account
> card mode dinos before beginning bus scanning) is rather complex.
>
> Also fixed the allocation failure case to delete the devices on the bus
> so drivers don't try attaching to them.
Index: ccio-dma.c
===================================================================
RCS file: /var/cvs/linux-2.6/drivers/parisc/ccio-dma.c,v
retrieving revision 1.3
diff -u -p -r1.3 ccio-dma.c
--- ccio-dma.c 2 Sep 2003 18:42:42 -0000 1.3
+++ ccio-dma.c 3 Sep 2003 19:59:34 -0000
@@ -1534,13 +1534,74 @@ static void __init ccio_init_resources(s
(unsigned long)&ioc->ioc_hpa->io_io_low_hv);
}
-static void expand_ioc_area(struct ioc *ioc, unsigned long size,
- unsigned long min, unsigned long max, unsigned long align)
+static int expand_resource(struct resource *res, unsigned long size,
+ unsigned long align)
{
-#ifdef NASTY_HACK_FOR_K_CLASS
- __raw_writel(0xfffff600, (unsigned long)&(ioc->ioc_hpa->io_io_high));
- ioc->mmio_region[0].end = 0xf5ffffff;
-#endif
+ struct resource *temp_res;
+ unsigned long start = res->start;
+ unsigned long end ;
+
+ /* see if we can expand above */
+ end = (res->end + size + align - 1) & ~(align - 1);;
+
+ temp_res = __request_region(res->parent, res->end, end - res->end,
+ "expansion");
+ if(!temp_res) {
+ /* now try below */
+ start = ((res->start - size + align) & ~(align - 1)) - align;
+ end = res->end;
+ temp_res = __request_region(res->parent, start, size,
+ "expansion");
+ if(!temp_res) {
+ return -ENOMEM;
+ }
+ }
+ release_resource(temp_res);
+ temp_res = res->parent;
+ release_resource(res);
+ res->start = start;
+ res->end = end;
+
+ /* This could be caused by some sort of race. Basically, if
+ * this tripped something stole the region we just reserved
+ * and then released to check for expansion */
+ BUG_ON(request_resource(temp_res, res) != 0);
+
+ return 0;
+}
+
+static void expand_ioc_area(struct resource *parent, struct ioc *ioc,
+ unsigned long size, unsigned long min,
+ unsigned long max, unsigned long align)
+{
+ if(ioc == NULL)
+ /* no IOC, so nothing to expand */
+ return;
+
+ if (expand_resource(parent, size, align) != 0) {
+ printk(KERN_ERR "Unable to expand %s window by 0x%lx\n",
+ parent->name, size);
+ return;
+ }
+
+ /* OK, we have the memory, now expand the window */
+ if (parent == &ioc->mmio_region[0]) {
+ __raw_writel(((parent->start)>>16) | 0xffff0000,
+ (unsigned long)&(ioc->ioc_hpa->io_io_low));
+ __raw_writel(((parent->end)>>16) | 0xffff0000,
+ (unsigned long)&(ioc->ioc_hpa->io_io_high));
+ } else if (parent == &ioc->mmio_region[1]) {
+ __raw_writel(((parent->start)>>16) | 0xffff0000,
+ (unsigned long)&(ioc->ioc_hpa->io_io_low_hv));
+ __raw_writel(((parent->end)>>16) | 0xffff0000,
+ (unsigned long)&(ioc->ioc_hpa->io_io_high_hv));
+ } else {
+ /* This should be impossible. It means
+ * expand_ioc_area got called with a resource that
+ * didn't belong to the ioc
+ */
+ BUG();
+ }
}
static struct resource *ccio_get_resource(struct ioc* ioc,
@@ -1574,7 +1635,7 @@ int ccio_allocate_resource(const struct
alignf_data))
return 0;
- expand_ioc_area(ioc, size, min, max, align);
+ expand_ioc_area(parent, ioc, size, min, max, align);
return allocate_resource(parent, res, size, min, max, align, alignf,
alignf_data);
}
Index: dino.c
===================================================================
RCS file: /var/cvs/linux-2.6/drivers/parisc/dino.c,v
retrieving revision 1.3
diff -u -p -r1.3 dino.c
--- dino.c 3 Sep 2003 16:51:12 -0000 1.3
+++ dino.c 3 Sep 2003 19:59:36 -0000
@@ -480,7 +480,18 @@ dino_card_setup(struct pci_bus *bus, uns
(unsigned long) 0xfffffffff0000000UL | _8MB,
0xffffffffffffffffUL &~ _8MB, _8MB,
NULL, NULL) < 0) {
- printk(KERN_WARNING "Dino: Failed to allocate memory region\n");
+ struct list_head *ln, *tmp_ln;
+
+ printk(KERN_ERR "Dino: cannot attach bus %s\n",
+ bus->dev->bus_id);
+ /* kill the bus, we can't do anything with it */
+ list_for_each_safe(ln, tmp_ln, &bus->devices) {
+ struct pci_dev *dev = pci_dev_b(ln);
+
+ list_del(&dev->global_list);
+ list_del(&dev->bus_list);
+ }
+
return;
}
bus->resource[1] = res;
@@ -526,7 +537,6 @@ dino_card_fixup(struct pci_dev *dev)
** The additional "-1" adjusts for skewing the IRQ<->slot.
*/
dino_cfg_read(dev->bus, dev->devfn, PCI_INTERRUPT_PIN, 1, &irq_pin);
- printk("DINO CONFIG READ GIVES irq_pin %d\n", irq_pin);
dev->irq = (irq_pin + PCI_SLOT(dev->devfn) - 1) % 4 ;
/* Shouldn't really need to do this but it's in case someone tries
next parent reply other threads:[~2003-09-03 20:07 UTC|newest]
Thread overview: 50+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20030903200300.8B7B7494064@palinux.hppa>
2003-09-03 20:07 ` James Bottomley [this message]
[not found] <20040505204811.27F0C4945E4@palinux.hppa>
2004-05-05 20:50 ` [parisc-linux] Re: [parisc-linux-cvs] linux-2.6 jejb James Bottomley
2004-05-06 5:05 ` Randolph Chung
2004-05-06 5:22 ` Randolph Chung
2004-05-06 9:33 ` M. Grabert
2004-05-06 13:25 ` Kyle McMartin
[not found] <20040502161601.DC7C24945C7@palinux.hppa>
2004-05-03 20:51 ` James Bottomley
[not found] <20040501200312.40BB74945E1@palinux.hppa>
2004-05-01 20:09 ` James Bottomley
2004-05-03 8:57 ` Joel Soete
[not found] <20040501160556.D07DC4945CA@palinux.hppa>
2004-05-01 16:13 ` James Bottomley
[not found] <20040430162037.9D2B94945CD@palinux.hppa>
2004-04-30 16:25 ` James Bottomley
[not found] <20040427171140.706074945BD@palinux.hppa>
2004-04-27 17:15 ` James Bottomley
[not found] <20040425145051.10F5C4942B8@palinux.hppa>
2004-04-25 14:55 ` James Bottomley
[not found] <20040414174535.81173494194@palinux.hppa>
2004-04-14 17:53 ` James Bottomley
[not found] <20040412154800.D31F6494194@palinux.hppa>
2004-04-12 15:55 ` James Bottomley
[not found] <20040407004901.031D3494194@palinux.hppa>
2004-04-07 0:54 ` James Bottomley
2004-04-08 6:15 ` Joel Soete
2004-04-08 12:36 ` James Bottomley
[not found] <20040406213446.CB675494194@palinux.hppa>
2004-04-06 21:37 ` James Bottomley
[not found] <20040405174131.84BF1494194@palinux.hppa>
2004-04-06 13:21 ` Carlos O'Donell
2004-04-06 14:18 ` James Bottomley
2004-04-06 15:40 ` Randolph Chung
[not found] <20040405024740.9330F494194@palinux.hppa>
2004-04-05 2:49 ` James Bottomley
2004-04-05 2:54 ` James Bottomley
[not found] <20040320210116.7A727494553@palinux.hppa>
2004-03-20 21:04 ` James Bottomley
2004-03-20 21:10 ` Helge Deller
2004-03-20 21:13 ` Helge Deller
[not found] <20040228212407.DB126494190@palinux.hppa>
2004-02-28 22:21 ` Joel Soete
2004-02-28 22:42 ` James Bottomley
2004-02-29 9:39 ` Joel Soete
2004-03-04 16:39 ` Joel Soete
2004-02-06 7:31 [parisc-linux] " Joel Soete
2004-02-06 17:50 ` Grant Grundler
2004-02-06 18:06 ` bame
2004-02-06 19:16 ` Randolph Chung
2004-02-06 17:08 ` Joel Soete
2004-02-07 6:40 ` Randolph Chung
2004-02-09 7:26 ` Joel Soete
[not found] <20040204182455.1CC11494191@palinux.hppa>
2004-02-05 9:20 ` [parisc-linux] " Randolph Chung
2004-02-05 15:19 ` James Bottomley
2004-02-05 15:29 ` [parisc-linux] " Joel Soete
2004-02-05 20:31 ` Randolph Chung
2004-02-05 18:49 ` Joel Soete
[not found] <20040113155603.CBCC249425A@palinux.hppa>
2004-01-13 15:58 ` [parisc-linux] " James Bottomley
[not found] <20030924175431.D51BC49408B@palinux.hppa>
2003-09-24 18:01 ` James Bottomley
[not found] <20030919010356.148684940A4@palinux.hppa>
2003-09-19 1:06 ` James Bottomley
2003-09-19 11:24 ` Randolph Chung
2003-09-19 14:02 ` James Bottomley
2003-09-19 18:24 ` Jim Hull
[not found] <20030903165113.138BF494064@palinux.hppa>
2003-09-03 16:56 ` James Bottomley
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=1062619623.1781.31.camel@mulgrave \
--to=james.bottomley@steeleye.com \
--cc=parisc-linux-cvs@lists.parisc-linux.org \
--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