Skip to contentSkip to conversation

ioports 0x100-0x3af and iomem 0xd000-0xdffff, 0xa0000000-0xa0ffffff -- safe to use on x86 for pcmcia?

DISCUSSION Dominik Brodowski 4 participants 5 messages Nov 24, 2009 – Nov 28, 2009

lore
Share & tools
lore
#0 lore raw

Hej!

One of the most problematic issues with the whole 16-bit PCMCIA subsystem on the x86 architecture is the following: cards request iomem or ioport resources, but the PCMCIA subsystem does and can not know reliably at what addresses iomem and ioport resources may be used, without interfering with any third hardware.

Currently, we utilize two approaches to correctly "guess" which iomem and ioport resource areas are safe to use[*]:

- If the PCMCIA bridge resides behind a PCI-PCI bridge or a PCI root bridge with specific memory or I/O windows, these resoruces -- if not registered otherwise -- are made available to PCMCIA devices. This works great on modern hardware, and hasn't caused us any major hassles since its introduction in 2.6.13 or so.

- Userspace (pcmcia-cs or pcmciautils) parses /etc/pcmcia/config.opts and registers a couple of memory and I/O resources.

This latter configuration file most often contains

	include port 0x100-0x3af
	include memory 0xc0000-0xfffff
	include memory 0xa0000000-0xa0ffffff

And so Komuro (CCed) suggested to add these default resource entries to the kernel, so that it can later use parts of these resource areas to enable PCMCIA devices without userspace interaction.

Do you think it would be safe to enable these areas by (kernel) default on x86? Of course, other entries in /proc/io{mem,ports} would be honoured, there would be a boot option to disable this feature, and some tests are run on the iomem and ioport resource areas.

Best,
Dominik

[*] In addition, there are some tests which are run on iomem and ioport resources before marking them as available to PCMCIA devices, but let's ignore this aspect for the moment.

#1 lore raw
Quoted 3 lines · Dominik Brodowski
	include port 0x100-0x3af
	include memory 0xc0000-0xfffff
	include memory 0xa0000000-0xa0ffffff

..

Quoted 2 lines

Do you think it would be safe to enable these areas by (kernel) default on x86?

c0000-fffff is option ROM and BIOS land. Maybe every BIOS out there is being a good boy/girl and actually adds entries to e820 or similar but I would kindof like to stay away from the region anyway.

0xa0000000 is 2.5GB, so it's doomed on systems with >=2.5GB RAM. :(

//Peter

#2 lore raw

Hi,

Quoted 8 lines

c0000-fffff is option ROM and BIOS land. Maybe every BIOS out there is being a good boy/girl and actually adds entries to e820 or similar but I would kindof like to stay away from the region anyway.

0xa0000000 is 2.5GB, so it's doomed on systems with >=2.5GB RAM. :(

//Peter

(1)
The i82365(ISA-pcmcia controller) and some older card-bus controller need the c000-fffff area to access the CIS instead of high memory area (1MB above).

(2)
Most of the PC that need the PCMCIA card is not so new. and have less than 2.5GB.

Best Regards
Komuro

#3 lore raw
In reply to Peter Stuge

Hey,

Quoted 11 lines · Komuro
Quoted 4 lines

Do you think it would be safe to enable these areas by (kernel) default on x86? Of course, other entries in /proc/io{mem,ports} would be honoured, there would be a boot option to disable this feature, and some tests are run on the iomem and ioport resource areas.

The problem you have is that you change the ordering.

If you load the ne2k ISA driver before pcmcia (as occurs now because of it being done from user space) the resources get claimed first. If you do it the other way around and test then merely reading an I/O register mapped to an NE2K or most NE2K clones crashes the machine.

... and even adding a late_initcall() has its problems.

Quoted 2 lines

Are there any modern systems where the PCI based autoconfig is insufficient, or is this just ancient stuff ?

I'm not familiar with embedded stuff, but usually PCI-based autoconfig should be sufficient nowadays. Therefore, the only workable way seems to be an optional module parameter

rsrc_nonstatic.include_io=0x100,0x3af,0x3e0,0x4ff,0x800,0x820,0xc00,0xcf7,0xa00,0xaff rsrc_nonstatic.include_mem=0xc0000,0xfffff,0xa0000000,0xa0ffffff,0x60000000,0x60ffffff

or something like that. Thanks for the input!

Best,
Dominik

#4 lore raw
In reply to Dominik Brodowski
Quoted 4 lines

This latter configuration file most often contains

	include port 0x100-0x3af
	include memory 0xc0000-0xfffff
	include memory 0xa0000000-0xa0ffffff

Which crashes older thinkpads, some ATI chipset systems and usually anything containing an NE2000 clone in ISA space.

Quoted 8 lines

And so Komuro (CCed) suggested to add these default resource entries to the kernel, so that it can later use parts of these resource areas to enable PCMCIA devices without userspace interaction.

Do you think it would be safe to enable these areas by (kernel) default on x86? Of course, other entries in /proc/io{mem,ports} would be honoured, there would be a boot option to disable this feature, and some tests are run on the iomem and ioport resource areas.

The problem you have is that you change the ordering.

If you load the ne2k ISA driver before pcmcia (as occurs now because of it being done from user space) the resources get claimed first. If you do it the other way around and test then merely reading an I/O register mapped to an NE2K or most NE2K clones crashes the machine.

Are there any modern systems where the PCI based autoconfig is insufficient, or is this just ancient stuff ?

Alan