pci_bus_for_each_resource, transparent bridges and rsrc_nonstatic.c

Bjorn Helgaas bjorn.helgaas at hp.com
Wed Mar 24 13:23:16 EDT 2010


On Tue, 2010-03-23 at 19:02 +0100, Dominik Brodowski wrote:
> > If you make PCMCIA smart enough to avoid these low ports, do we still
> > need these &ioport_resource and &iomem_resource checks?  Having two
> > mechanisms will lead to more complicated behavior and more special
> > cases.
> 
> Well, it aren't only the low ports (<0x100) I'm concerned about, it's also
> (and especially on pre-2008 systems) ports in higher areas
> (0x100 < x < 0xffff). If we don't use _CRS, we need to be more careful to
> avoid accidentally hitting wrong I/O-ports.

> From: Dominik Brodowski <linux at dominikbrodowski.net>
> Date: Tue, 23 Mar 2010 16:05:00 +0100
> Subject: [PATCH] pcmcia: do not use ioports < 0x100 on x86
> 
> On x86 systems using ACPI _CRS information -- now the default for
> post-2008 systems -- the PCI root bus no longer pretends to be
> offering the root ioport_resource. To avoid accidentally hitting
> some platform / system device, use only I/O ports >= 0x100 for
> PCMCIA devices on x86.
> 
> Reported-by: Komuro <komurojun-mbn at nifty.com>
> CC: Bjorn Helgaas <bjorn.helgaas at hp.com>
> Signed-off-by: Dominik Brodowski <linux at dominikbrodowski.net>
> 
> diff --git a/drivers/pcmcia/rsrc_nonstatic.c b/drivers/pcmcia/rsrc_nonstatic.c
> index 4663b3f..dcc6021 100644
> --- a/drivers/pcmcia/rsrc_nonstatic.c
> +++ b/drivers/pcmcia/rsrc_nonstatic.c
> @@ -810,6 +810,13 @@ static int adjust_io(struct pcmcia_socket *s, unsigned int action, unsigned long
>  	unsigned long size = end - start + 1;
>  	int ret = 0;
>  
> +#if defined(CONFIG_X86)
> +	/* on x86, avoid anything < 0x100 for it is often used for
> +	 * legacy platform devices */
> +	if (start < 0x100)
> +		start = 0x100;
> +#endif

This looks OK to me (but we've already established that I don't know
anything about PCMCIA :)).  I do wonder whether we should have a generic
mechanism to define areas we should avoid, along the lines of
PCIBIOS_MIN_IO and PCIBIOS_MIN_CARDBUS_IO.  PNP should probably avoid
the same areas.

Which reminds me, what little I gleaned from the MindShare PCMCIA book
suggests that PCMCIA devices are similar to PNPBIOS devices in some ways
-- you get a list of possible resource assignments from CIS, sometimes
those assignments are fixed, other times they're programmable, and then
you pick something that works.  I wonder if there'd be any point in
integrating PNP and PCMCIA somehow.

Bjorn

>  	if (end < start)
>  		return -EINVAL;
>  




More information about the linux-pcmcia mailing list