From: Jesse Barnes <jbarnes@sgi.com>
To: linux-ia64@vger.kernel.org
Subject: Re: [Linux-ia64] [PATCH] 1/4 multi-ioport space support for 2.5
Date: Thu, 24 Apr 2003 22:37:00 +0000 [thread overview]
Message-ID: <marc-linux-ia64-105590723705603@msgid-missing> (raw)
In-Reply-To: <marc-linux-ia64-105590723705599@msgid-missing>
Bjorn, what about the patches posted in this thread?
http://marc.theaimsgroup.com/?t\x104359481700001&r=1&w=2
They seem to deal with the legacy resource issue quite nicely, and for
the non-legacy case, pci_fixup should be making the
pci_dev->resource[] arrays contain valid I/O addresss, shouldn't it?
Or do you have something else in mind?
Thanks,
Jesse
On Thu, Apr 24, 2003 at 04:25:26PM -0600, Bjorn Helgaas wrote:
> This has been in my 2.4 BK tree for a while, but I should have
> posted it in case there's feedback from other people working
> on large machines. So here it is, in four parts:
>
> 1 enhance __ia64_mk_io_addr(port)
> 2 enhance pcibios_scan_root to get multiple mem & io windows
> from ACPI _CRS, and fixup all the resources
> 3 add support for /proc/iomem and /proc/ioports
> 4 trivial (whitespace, copyright, and move pcibios_fixup_device_resources
> closer to related code)
>
> The current scheme is that IO ports are 64 bits, with the low 24
> bits being the port number within an IO port space, and the upper
> bits identifying the space. There is currently a limit of 16
> spaces.
>
> Bjorn
>
> diff -u -ur linux-2.5.67-ia64-030416/arch/ia64/kernel/setup.c linux-2.5.67-ia64-030416-io1/arch/ia64/kernel/setup.c
> --- linux-2.5.67-ia64-030416/arch/ia64/kernel/setup.c 2003-04-24 10:10:58.000000000 -0600
> +++ linux-2.5.67-ia64-030416-io1/arch/ia64/kernel/setup.c 2003-04-24 11:01:40.000000000 -0600
> @@ -63,6 +63,8 @@
> struct screen_info screen_info;
>
> unsigned long ia64_iobase; /* virtual address for I/O accesses */
> +struct io_space io_space[MAX_IO_SPACES];
> +unsigned int num_io_spaces;
>
> unsigned char aux_device_present = 0xaa; /* XXX remove this when legacy I/O is gone */
>
> @@ -415,6 +417,11 @@
> }
> ia64_iobase = (unsigned long) ioremap(phys_iobase, 0);
>
> + /* setup legacy IO port space */
> + io_space[0].mmio_base = ia64_iobase;
> + io_space[0].sparse = 1;
> + num_io_spaces = 1;
> +
> #ifdef CONFIG_SMP
> cpu_physical_id(0) = hard_smp_processor_id();
> #endif
> diff -u -ur linux-2.5.67-ia64-030416/include/asm-ia64/io.h linux-2.5.67-ia64-030416-io1/include/asm-ia64/io.h
> --- linux-2.5.67-ia64-030416/include/asm-ia64/io.h 2003-04-24 10:10:58.000000000 -0600
> +++ linux-2.5.67-ia64-030416-io1/include/asm-ia64/io.h 2003-04-24 11:29:59.000000000 -0600
> @@ -32,6 +32,24 @@
> */
> #define IO_SPACE_LIMIT 0xffffffffffffffffUL
>
> +#define MAX_IO_SPACES 16
> +#define IO_SPACE_BITS 24
> +#define IO_SPACE_SIZE (1UL << IO_SPACE_BITS)
> +
> +#define IO_SPACE_NR(port) ((port) >> IO_SPACE_BITS)
> +#define IO_SPACE_BASE(space) ((space) << IO_SPACE_BITS)
> +#define IO_SPACE_PORT(port) ((port) & (IO_SPACE_SIZE - 1))
> +
> +#define IO_SPACE_SPARSE_ENCODING(p) ((((p) >> 2) << 12) | (p & 0xfff))
> +
> +struct io_space {
> + unsigned long mmio_base; /* base in MMIO space */
> + int sparse;
> +};
> +
> +extern struct io_space io_space[];
> +extern unsigned int num_io_spaces;
> +
> # ifdef __KERNEL__
>
> #include <asm/machvec.h>
> @@ -80,11 +98,17 @@
> static inline void*
> __ia64_mk_io_addr (unsigned long port)
> {
> - const unsigned long io_base = __ia64_get_io_port_base();
> - unsigned long addr;
> + struct io_space *space;
> + unsigned long offset;
> +
> + space = &io_space[IO_SPACE_NR(port)];
> + port = IO_SPACE_PORT(port);
> + if (space->sparse)
> + offset = IO_SPACE_SPARSE_ENCODING(port);
> + else
> + offset = port;
>
> - addr = io_base | ((port >> 2) << 12) | (port & 0xfff);
> - return (void *) addr;
> + return (void *) (space->mmio_base | offset);
> }
>
> /*
>
>
> _______________________________________________
> Linux-IA64 mailing list
> Linux-IA64@linuxia64.org
> http://lists.linuxia64.org/lists/listinfo/linux-ia64
next prev parent reply other threads:[~2003-04-24 22:37 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-04-24 22:25 [Linux-ia64] [PATCH] 1/4 multi-ioport space support for 2.5 Bjorn Helgaas
2003-04-24 22:37 ` Jesse Barnes [this message]
2003-04-25 0:44 ` Bjorn Helgaas
2003-04-25 1:05 ` Jesse Barnes
2003-04-25 11:36 ` Matthew Wilcox
2003-04-25 16:13 ` Bjorn Helgaas
2003-04-25 17:18 ` Jesse Barnes
2003-05-09 23:20 ` David Mosberger
2003-05-09 23:31 ` David Mosberger
2003-05-12 20:58 ` Bjorn Helgaas
2003-05-12 22:50 ` David Mosberger
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=marc-linux-ia64-105590723705603@msgid-missing \
--to=jbarnes@sgi.com \
--cc=linux-ia64@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.