LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices


Reply
  Search this Thread
Old 10-17-2023, 08:37 PM   #1
fib0112358
LQ Newbie
 
Registered: Oct 2023
Distribution: Debian, Fedora
Posts: 4

Rep: Reputation: 0
Insertion of any PCMCIA card results in error code -12 (Cannot allocate memory)


Hello Community,

I'm a long time user of Linux, but only just recently began exploring how devices are managed under the hood. I'm hoping this question will be a learning experience.

Whenever I insert a PC Card (e.g. SD card adapter, CF card adapter, ATA flash card, etc) into the PC Card slot on my laptop I get the following error:

Code:
>dmesg
...
[  529.852792] pcmcia_socket pcmcia_socket0: pccard: PCMCIA card inserted into slot 0
[  529.852809] pcmcia_socket pcmcia_socket0: cs: memory probe 0xe4d30000-0xe576ffff:
[  529.862125]  excluding 0xe4fc0000-0xe5063fff
[  529.880120] pcmcia 0.0: pcmcia: registering new device pcmcia0.0 (IRQ: 18)
[  529.906778] pata_pcmcia: probe of 0.0 failed with error -12
I have a fresh install of Debian 12, kernel version 6.1.0-13-amd64. I get the same message with a fresh install of Fedora 38 on the same laptop. In order to rule out the possibility that the PCMCIA hardware is bad, I installed Windows 10 and official drivers on the same laptop, and the hardware works fine - all PC Cards work as intended. My goal is to get the PC Card slot to work in Linux.

Here is some relevant information about my system:

Code:
>lspci -vvv
...
04:00.0 CardBus bridge: Ricoh Co Ltd CardBus bridge (rev 02)
        Subsystem: Dell Latitude E6510
        Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx-
        Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
        Latency: 0
        Interrupt: pin A routed to IRQ 18
        IOMMU group: 19
        Region 0: Memory at e5940000 (32-bit, non-prefetchable) [size=4K]
        Bus: primary=04, secondary=05, subordinate=08, sec-latency=176
        Memory window 0: e3100000-e44fffff (prefetchable)
        Memory window 1: e4800000-e4bfffff
        I/O window 0: 00002000-00003fff
        I/O window 1: 00000000-00000003
        BridgeCtl: Parity- SERR- ISA- VGA- MAbort- >Reset- 16bInt+ PostWrite+
        16-bit legacy interface ports at 0001
        Capabilities: [a0] MSI: Enable- Count=1/1 Maskable- 64bit+
                Address: 0000000000000000  Data: 0000
        Capabilities: [98] Power Management version 3
                Flags: PMEClk- DSI- D1+ D2+ AuxCurrent=0mA PME(D0+,D1+,D2+,D3hot+,D3cold+)
                Status: D0 NoSoftRst- PME-Enable- DSel=0 DScale=2 PME+
        Capabilities: [80] Express (v1) PCI-Express to PCI/PCI-X Bridge, MSI 00
                DevCap: MaxPayload 128 bytes, PhantFunc 0
                        ExtTag- AttnBtn+ AttnInd+ PwrInd+ RBE+ SlotPowerLimit 10W
                DevCtl: CorrErr- NonFatalErr- FatalErr- UnsupReq-
                        RlxdOrd+ ExtTag- PhantFunc- AuxPwr- NoSnoop+ BrConfRtry-
                        MaxPayload 128 bytes, MaxReadReq 512 bytes
                DevSta: CorrErr+ NonFatalErr+ FatalErr- UnsupReq+ AuxPwr- TransPend-
                LnkCap: Port #1, Speed 2.5GT/s, Width x1, ASPM L0s L1, Exit Latency L0s <4us, L1 <64us
                        ClockPM+ Surprise- LLActRep- BwNot- ASPMOptComp-
                LnkCtl: ASPM L1 Enabled; RCB 64 bytes, Disabled- CommClk+
                        ExtSynch- ClockPM+ AutWidDis- BWInt- AutBWInt-
                LnkSta: Speed 2.5GT/s, Width x1
                        TrErr- Train- SlotClk+ DLActive- BWMgmt- ABWMgmt-
        Kernel driver in use: yenta_cardbus
        Kernel modules: yenta_socket
The second line from lspcmcia always appear the same regardless of the PC Card inserted. (Note: I know from a different laptop with the same Linux kernel that the driver should be pata_pcmcia if it's working. Debian and Fedora do support PCMCIA out of the box on certain laptops.)

Code:
>lspcmcia
...
Socket 0 Bridge:        [yenta_cardbus]         (bus ID: 0000:04:00.0)
Socket 0 Device 0:      [-- no driver --]       (bus ID: 0.0)
The system is detecting the PC Cards that I'm inserting. But the devices are not showing up in /dev. Instead I always get the error in dmesg, "pata_pcmcia: probe of 0.0 failed with error -12".

Code:
>pccardctl ident 0
...
  product info: "STI
", "Flash 8.0.0
", "", ""
  manfid: 0x014d, 0x0100
  function: 4 (fixed disk)
Code:
>lsmod | grep pcmcia
...
pata_pcmcia            20480  0
pcmcia                 77824  1 pata_pcmcia
pcmcia_rsrc            24576  1 yenta_socket
pcmcia_core            36864  3 pcmcia,pcmcia_rsrc,yenta_socket
libata                401408  3 libahci,ahci,pata_pcmcia
I've tried modifying /etc/pcmcia/config.opts with memory ranges and I/O port ranges that I know worked while I had Windows 10 installed on the same laptop. But from dmesg and lspci -vvv it appears this file is ignored because the assigned memory window is always outside the ranges that I specify.

I've also tried modifying GRUB with the parameter pci=assign-busses, because in an old post on another forum someone mentioned that in their case "...The BIOS-provided PCI bus numbering didn't leave any space for the CardBus bus on the other side of the bridge to receive a bus number." To be honest, I don't know what this means and the solution worked for them but didn't work for me.

Is there anything else I can try? I appreciate your time and experience.

Thank you in advance.
 
Old 10-18-2023, 08:54 AM   #2
smallpond
Senior Member
 
Registered: Feb 2011
Location: Massachusetts, USA
Distribution: Fedora
Posts: 4,269

Rep: Reputation: 1314Reputation: 1314Reputation: 1314Reputation: 1314Reputation: 1314Reputation: 1314Reputation: 1314Reputation: 1314Reputation: 1314Reputation: 1314
In early Unix to change devices you had to rebuild the kernel with a new device table.

Then a big advance! Scan devices and build device table at boot time. Way more convenient.

Now you kids today want runtime device changes. This requires the hotplug code in your kernel, a driver that supports hotplug, and smart enough firmware to have done all the right prep.

For the kernel, grep HOTPLUG /boot/config-$(uname -r)

Driver is ok.

The memory it can't allocate is likely PCI config space. The PCI device tree sets like 5-minute epoxy. You can't move anything after boot so you better have left room. Check the firmware menus for any hotplug stuff and make sure it is enabled.

Side note: PCMCIA = People Can't Memorize Computer Industry Acronyms
 
Old 10-18-2023, 07:24 PM   #3
fib0112358
LQ Newbie
 
Registered: Oct 2023
Distribution: Debian, Fedora
Posts: 4

Original Poster
Rep: Reputation: 0
Thank you, smallpond. I've definitely been spoiled by all the progress made in Linux . I'm grateful for all the hard work the community has put into making Linux what it is today.

Here is the output I get from
Quote:
grep HOTPLUG /boot/config-$(uname -r)
Code:
CONFIG_HOTPLUG_CPU=y
# CONFIG_BOOTPARAM_HOTPLUG_CPU0 is not set
# CONFIG_DEBUG_HOTPLUG_CPU0 is not set
CONFIG_ACPI_HOTPLUG_CPU=y
CONFIG_ACPI_HOTPLUG_MEMORY=y
CONFIG_ACPI_HOTPLUG_IOAPIC=y
CONFIG_HOTPLUG_SMT=y
CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
CONFIG_MEMORY_HOTPLUG=y
# CONFIG_MEMORY_HOTPLUG_DEFAULT_ONLINE is not set
CONFIG_HOTPLUG_PCI_PCIE=y
CONFIG_HOTPLUG_PCI=y
CONFIG_HOTPLUG_PCI_ACPI=y
CONFIG_HOTPLUG_PCI_ACPI_IBM=m
CONFIG_HOTPLUG_PCI_CPCI=y
CONFIG_HOTPLUG_PCI_CPCI_ZT5550=m
CONFIG_HOTPLUG_PCI_CPCI_GENERIC=m
CONFIG_HOTPLUG_PCI_SHPC=y
CONFIG_XEN_BALLOON_MEMORY_HOTPLUG=y
CONFIG_XEN_MEMORY_HOTPLUG_LIMIT=512
CONFIG_SURFACE_HOTPLUG=m
# CONFIG_CPU_HOTPLUG_STATE_CONTROL is not set
Quote:
Check the firmware menus for any hotplug stuff and make sure it is enabled.
Sorry, I'm not familiar with firmware menus. Can you point me in the direction of some documentation or examples?
 
Old 10-22-2023, 08:29 AM   #4
smallpond
Senior Member
 
Registered: Feb 2011
Location: Massachusetts, USA
Distribution: Fedora
Posts: 4,269

Rep: Reputation: 1314Reputation: 1314Reputation: 1314Reputation: 1314Reputation: 1314Reputation: 1314Reputation: 1314Reputation: 1314Reputation: 1314Reputation: 1314
Usually it is something like F1 at boot to get to the menus. When computers had BIOS they used to have manuals to explain these things. Now that the firmware does so much more there is paradoxically less information.

There's too many variations to point to documentation. Even on the same hardware, there can be be multiple versions of firmware.
 
Old 10-22-2023, 11:33 PM   #5
fib0112358
LQ Newbie
 
Registered: Oct 2023
Distribution: Debian, Fedora
Posts: 4

Original Poster
Rep: Reputation: 0
Oh, I see. Firmware menus = BIOS/UEFI menus. That's one of the first places I looked. I'm not able to control IRQ or Plug and Play settings in the BIOS, but I did try disabling unused serial COM ports, parallel ports, and other devices in the BIOS, only leaving the PCMCIA port enabled, with the hope of freeing up IRQ and memory resources for the PCMCIA port. No matter what I do in the BIOS I see the same error from dmesg as shown in my original post: "pata_pcmcia: probe of 0.0 failed with error -12"

PC Card insertions and ejects are definitely being detected:

Code:
>udevadm monitor

monitor will print the received events for:
UDEV - the event which udev sends out after rule processing
KERNEL - the kernel uevent

KERNEL[656.992561] add      /devices/pci0000:00/0000:00:1c.2/0000:04:00.0/0.0 (pcmcia)
KERNEL[657.019419] add      /bus/pcmcia/drivers/pata_pcmcia (drivers)
KERNEL[657.019501] add      /module/pata_pcmcia (module)
UDEV  [657.019599] add      /devices/pci0000:00/0000:00:1c.2/0000:04:00.0/0.0 (pcmcia)
UDEV  [657.021949] add      /module/pata_pcmcia (module)
UDEV  [657.023094] add      /bus/pcmcia/drivers/pata_pcmcia (drivers)
And since error code -12 means memory allocation failed, I tried specifying specific memory and port addresses in /etc/pcmcia/config.opts with memory and port addresses allocated to the Cardbus bridge as listed with lscpi -vvv.

Code:
>vim /etc/pcmcia/config.opts

include port 0x2000-0x3fff
include port 0x0000-0x0003

include memory 0xe3100000-0xe44fffff
include memory 0xe4800000-0xe4bfffff
Nothing changes though, I always get the same output from the commands in my original post. The driver always probes 0xe4d30000-0xe576ffff when I insert a PC Card as displayed in dmesg, apparently ignoring /etc/pcmcia/config.opts, even after a reboot. I wonder if there's another way to force pata_pcmcia to probe the correct memory window. It keeps probing 0xe4d30000-0xe576ffff even though I specified the windows 0xe3100000-0xe44fffff, 0xe4800000-0xe4bfffff.

Last edited by fib0112358; 10-22-2023 at 11:41 PM.
 
Old 10-25-2023, 01:40 PM   #6
fib0112358
LQ Newbie
 
Registered: Oct 2023
Distribution: Debian, Fedora
Posts: 4

Original Poster
Rep: Reputation: 0
Interestingly, I booted into a live image of Tiny Core Linux on the same laptop, kernel version 6.1.2-tinycore, and the PCMCIA port worked out of the box.

Debian 12 (kernel ver. 6.1.0-13-amd64) and Tiny Core Linux 14 (kernel ver. 6.1.2-tinycore) both use the package pcmciautils to manage PCMCIA activity, and both loaded the module pata_pcmcia. Only glaring difference is Debian throws error code -12 (Cannot allocate memory) when trying to bind pata_pcmcia to PC CARDs upon insertion, while Tiny Core Linux binds pata_pcmcia to PC Cards successfully.

Is there anything in particular I can look at while on Tiny Core Linux to see how I can fix the PCMCIA configuration in Debian? I'm open to rebuilding the kernel and/or modules if necessary. I've never compiled my own kernel or module before, but if I know what to look for I will certainly try. As I mentioned, this is a good learning opportunity for me.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Operating system error: Cannot allocate memory (FORTRAN Code, RedHat) Arashjj9 Linux - Software 4 04-07-2018 05:34 PM
SOLVED: virtual memory exhausted: Cannot allocate memory tonj Linux - Newbie 6 06-12-2014 08:27 AM
[SOLVED] error while compiling llvm : virtual memory exhausted: Cannot allocate memory aashayshah Linux From Scratch 5 03-13-2013 11:04 AM
pthread_create Cannot allocate memory error code 12 goodman888 Programming 4 05-20-2008 08:19 PM
Slackware 10 not detecting PCMCIA card on insertion buddhahat Linux - Newbie 0 08-13-2004 11:05 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware

All times are GMT -5. The time now is 02:54 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration